From 85cd90baef74b1af28f9f287bf0dee583d10546d Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Tue, 17 May 2005 22:01:08 +0000 Subject: [PATCH] some changes --- input.txt | 4 ++-- parser.y | 1 + planner.cpp | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/input.txt b/input.txt index 96e8683..f6c2874 100644 --- a/input.txt +++ b/input.txt @@ -2,14 +2,14 @@ apache NET httpd.sh -0: HTPPD # kommentar +0: HTPPD # kommentar # # fds sfd #32 #dasdssad eth0 -"" +"1" "ifconfig up eth0" 0: NET # kommentar diff --git a/parser.y b/parser.y index 663442a..e286054 100644 --- a/parser.y +++ b/parser.y @@ -201,6 +201,7 @@ vector stringToVector(string str){ istringstream ist(str); while (ist >> str){ + cout << str << endl; strings.push_back(str); } diff --git a/planner.cpp b/planner.cpp index e064896..884567d 100644 --- a/planner.cpp +++ b/planner.cpp @@ -10,14 +10,16 @@ Planner::Planner(std::vector actions, Literals init, Literals goal){ _goal = goal; _start = new StartNode(_init); _finish = new EndNode(_goal); + addNode(_start); for(vector::iterator action = actions.begin(); action != actions.end(); ++action){ const Literals& effects = action->effects(0); for (Literals::const_iterator effect = effects.begin(); effect != effects.end(); ++effect){ - cerr << "Adding effect: " << *effect << endl; + cerr << "Adding effect: '" << *effect << "', action: " << action->name() << endl; _actions[*effect] = *action; } } + cout << "Number of actions: " << _actions.size() << endl; makePlan(_finish); } @@ -42,7 +44,7 @@ void Planner::makePlan(Node* node){ _start->addChild(node); }else{ for (Preconditions::const_iterator precond = preconds.begin(); precond != preconds.end(); ++precond){ - cerr << "Looking for: " << precond->first << endl; + cerr << "Looking for: '" << precond->first << "'" << endl; hash_map::iterator addedNode = _addedNodes.find(precond->first); if(addedNode != _addedNodes.end()){ cerr << "Using already added node" << endl; @@ -68,7 +70,9 @@ void Planner::makePlan(Node* node){ } void Planner::addNode(Node* node){ + cerr << "Adding node for action: " << node->action().name() << endl; const Literals& effects = node->action().effects(0); + cerr << "Number of effects: " << effects.size() << endl; for (Literals::const_iterator effect = effects.begin(); effect != effects.end(); ++effect){ cout << "Adding node for effect: " << *effect << endl; -- 2.39.2