+ _start->execute(Literals());
+ cerr << "Number of nodes: " << _addedNodes.size() << endl;
+ back_insert_iterator<Literals> ii(_init);
+ copy(_init.begin(), _init.end(), ostream_iterator<string>(cout, " "));
+ cout << endl;
+ _init.clear();
+ for (vector<Node*>::iterator node = _addedNodes.begin(); node != _addedNodes.end(); ++node){
+ cerr << "Deleting node " << (*node)->action()->name() << endl;
+ if ((*node)->executed()){
+ const Literals& effects = (*node)->effects();
+ copy(effects.begin(),effects.end(),ii);
+ cerr << "Finding action" << endl;
+ vector<Action*>::iterator action = find(_actions.begin(), _actions.end(), (*node)->action());
+ if (action != _actions.end()){
+ cerr << "Removing executed action: " << (*action)->name() << endl;
+ _actions.erase(action);
+ //BUG: Sometimes finds the wrong action.
+ //delete *action;
+ }
+ }
+ delete *node;
+ }
+ _addedNodes.clear();
+ _actionEffects.clear();
+ copy(_init.begin(), _init.end(), ostream_iterator<string>(cout, " "));
+ cerr << "Number of nodes left: " << _addedNodes.size() << endl;
+ //TODO: Fill _actionEffects with the remaining effects, create start end end nodes and create a new plan.