]> ruin.nu Git - popboot.git/commitdiff
removing unsatisfiable soft conditions
authorMichael Andreen <harv@ruin.nu>
Thu, 19 May 2005 11:03:10 +0000 (11:03 +0000)
committerMichael Andreen <harv@ruin.nu>
Thu, 19 May 2005 11:03:10 +0000 (11:03 +0000)
input.txt
node.cpp
node.h
planner.cpp

index fb943a87619deedc736165eb19e82eaf7e1f54b7..2f52d14f18941cdcd2a676031e2a5843667ed72f 100644 (file)
--- a/input.txt
+++ b/input.txt
@@ -8,7 +8,7 @@
 
 # kommenatar
 apache
-NET
+NET, ?LOGGER
 httpd.sh
 0: HTTPD, APACHE # kommentar
 
index 899f38bf325592f2a9fa200f48edfb0acf5cb66c..fb1c314dcf682a059c3eff9d7235885d214bf2a7 100644 (file)
--- 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 b49d0109ee042005010a2bae4eb455395db8b57c..77a9d7bbefce9d7265d870e2f80c9b5fb400dfc7 100644 (file)
--- 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;
index 10f5e57f2970f1cd7a111d497de7d75c81dc848b..747f3517760b42634ee5dcb5caa9d428dc93cc83 100644 (file)
@@ -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);
                                }
                        }
                }