Changes have been pushed for the repository "fawkesrobotics/fawkes".

Clone:  https://github.com/fawkesrobotics/fawkes.git
Gitweb: https://github.com/fawkesrobotics/fawkes

The branch, tviehmann/cx-precondition-removal-fix has been created
        at  4f601854cf05ecad4668e86b9a9b9992d63e4067 (commit)

https://github.com/fawkesrobotics/fawkes/tree/tviehmann/cx-precondition-removal-fix

- *Log* ---------------------------------------------------------------
commit 4f601854cf05ecad4668e86b9a9b9992d63e4067
Author:     Tarik Viehmann <[email protected]>
AuthorDate: Sun Nov 15 12:00:54 2020 +0100
Commit:     Tarik Viehmann <[email protected]>
CommitDate: Sun Nov 15 12:02:49 2020 +0100

    clips-executive: fix recursive removal of preconditions
    
    The precondition might not be atomic, but rather a compound one.

https://github.com/fawkesrobotics/fawkes/commit/4f601854c

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------


- *Diffs* -------------------------------------------------------------

- *commit* 4f601854cf05ecad4668e86b9a9b9992d63e4067 - - - - - - - - - -
Author:  Tarik Viehmann <[email protected]>
Date:    Sun Nov 15 12:00:54 2020 +0100
Subject: clips-executive: fix recursive removal of preconditions

 src/plugins/clips-executive/clips/domain.clp | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/clips-executive/clips/domain.clp 
b/src/plugins/clips-executive/clips/domain.clp
index 7acfa8c69..2c8c314a1 100644
--- a/src/plugins/clips-executive/clips/domain.clp
+++ b/src/plugins/clips-executive/clips/domain.clp
@@ -249,14 +249,28 @@
    true by removing it recursively. If it is a negation, remove it recursively.
    If it's a conjunction, only remove the conjunct."
   (?precond-name)
-  (do-for-fact
-    ((?precond domain-atomic-precondition) (?parent domain-precondition))
-    (and (eq ?precond:name ?precond-name) (eq ?precond:part-of ?parent:name))
-    (if (or (eq ?parent:type disjunction) (eq ?parent:type negation)) then
-      (remove-precondition ?parent:name)
+  (bind ?atomic (find-fact ((?precond domain-atomic-precondition))
+                           (eq ?precond:name ?precond-name)))
+  (if (> (length$ ?atomic) 0)
+   then
+    (bind ?atomic (nth$ 1 ?atomic))
+    (do-for-fact ((?parent domain-precondition))
+                 (eq (fact-slot-value ?atomic part-of) ?parent:name)
+      (if (or (eq ?parent:type disjunction) (eq ?parent:type negation)) then
+        (remove-precondition ?parent:name)
+      )
     )
-    (retract ?precond)
-  )
+    (retract ?atomic)
+   else
+    (do-for-fact
+      ((?precond domain-precondition) (?parent domain-precondition))
+      (and (eq ?precond:name ?precond-name) (eq ?precond:part-of ?parent:name))
+      (if (or (eq ?parent:type disjunction) (eq ?parent:type negation)) then
+        (remove-precondition ?parent:name)
+      )
+      (retract ?precond)
+    )
+ )
 )
 
 (deffunction domain-retract-grounding



_______________________________________________
fawkes-commits mailing list
[email protected]
https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits

Reply via email to