From dc4211bc1dc77ba3f1a71ec5737c61731614004b Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Thu, 19 May 2005 11:03:10 +0000 Subject: [PATCH] removing unsatisfiable soft conditions --- input.txt | 2 +- node.cpp | 3 +++ node.h | 1 + planner.cpp | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/input.txt b/input.txt index fb943a8..2f52d14 100644 --- a/input.txt +++ b/input.txt @@ -8,7 +8,7 @@ # kommenatar apache -NET +NET, ?LOGGER httpd.sh 0: HTTPD, APACHE # kommentar diff --git a/node.cpp b/node.cpp index 899f38b..fb1c314 100644 --- a/node.cpp +++ b/node.cpp @@ -34,6 +34,9 @@ bool Node::executed() const{ const Literals& Node::effects() const{ return _effects; } +void Node::satisfyCondition(std::string effect){ + _preconditions.erase(_preconditions.find(effect)); +} void Node::execute(const Literals& effects){ cerr << "Executing: " << _action.name() << endl; diff --git a/node.h b/node.h index b49d010..77a9d7b 100644 --- a/node.h +++ b/node.h @@ -17,6 +17,7 @@ class Node { void execute(const Literals& effects); bool executed() const; const Literals& effects() const; + void satisfyCondition(std::string effect); protected: Action _action; diff --git a/planner.cpp b/planner.cpp index 10f5e57..747f351 100644 --- a/planner.cpp +++ b/planner.cpp @@ -63,6 +63,7 @@ void Planner::makePlan(Node* node){ }else{ cerr << "Action with effect: " << precond->first << " not found!" << endl; cerr << "This is a soft precondition, so we will continue" << endl; + node->satisfyCondition(precond->first); } } } -- 2.39.2