#include "action.h"
+#include <iostream>
+using namespace std;
Action::Action(std::string executable, literals preconditions, literals effects){
_executable = executable;
}
int Action::execute() const{
-
+ cout << "Executing: " << _executable << endl;
return 0;
}
actions.push_back(Action(exec, stringToVector(precond), stringToVector(effects)));
}
Planner p(actions, stringToVector(argv[2]), stringToVector(argv[3]));
+
+ p.execute();
return 0;
}
#include "node.h"
+using namespace std;
Node::Node(Action action){
_action = action;
_children.push_back(node);
}
+
+void Node::execute(){
+ _action.execute();
+
+ for(vector<Node*>::iterator child = _children.begin(); child != _children.end(); ++child){
+ (*child)->execute();
+ }
+}
Node(Action action);
void addChild(Node* node);
Action action();
+ void execute();
protected:
Action _action;
Planner::Planner(std::vector<Action> actions, literals init, literals goal){
- _start = new Node(Action("",literals(), init));
+ _start = new Node(Action("start",literals(), init));
addNode(_start);
- Node* finish = new Node(Action("",goal,literals()));
+ Node* finish = new Node(Action("finish",goal,literals()));
for(vector<Action>::iterator action = actions.begin(); action != actions.end(); ++action){
literals effects = action->effects();
_addedNodes[*effect] = node;
}
}
+
+
+void Planner::execute(){
+ _start->execute();
+}
public:
Planner(std::vector<Action> actions, literals init, literals goal);
+ void execute();
+
protected:
void makePlan(Node* node);