+
+void Node::execute(){
+ cerr << "Executing: " << _action->name() << endl;
+ if(_executed)
+ cerr << "Already executed" << endl;
+ if ((_preconditions.size() != 0) || _executed)
+ return;
+
+ _executed = true;
+ int value = _action->execute();
+ _effects = _action->effects(value);
+
+ cerr << "Got returnvalue: " << value << ", number of effects: " << _effects.size() << endl;
+
+}
+
+const std::vector<Node*>& Node::children() const{
+ return _children;
+}
+StartNode::StartNode(const Literals& init){
+ EffectsMap initial;
+ initial[0] = init;
+ _action = new Action("start",Preconditions(),"", initial);
+}
+
+EndNode::EndNode(const Literals& goal){
+ Preconditions goalState;
+ for(Literals::const_iterator g = goal.begin(); g != goal.end(); ++g)
+ goalState[*g] = false;
+ _action = new Action("finish",goalState,"",EffectsMap());
+ _preconditions = _action->preconditions();
+}
+