I'm trying to write a CLIPS program which use the Iterative Deepening algorithm to solve a planning problem. For this same reason I would like to keep a low branching factor.
In the following code ?s is the variable which represent the level of the tree; I would like to use a single rule to make different checks. This is what I tried to do:
(defrule EXPAND::action
(declare (salience ?*load*))
(or
(and ?f1_a <- (status ?s transport ?c1&:(> ?c1 0) …Run Code Online (Sandbox Code Playgroud) 我写了一个程序,断言本规则的LHS中的事实:
(defrule check-open-better (declare (salience 50))
?f1 <- (newnode (ident ?id) (gcost ?g) (fcost ?f) (father ?anc))
(status (ident ?id) (subject ?subject) (data $?eqL))
?f2 <- (status (ident ?old) (subject ?subject) (data $?eqL))
?f3 <- (node (ident ?old) (gcost ?g-old) (open yes))
(test
(eq
(implode$
(find-all-facts ((?f status))
(and
(eq(str-compare ?f:ident ?id) 0)
(eq(str-compare ?f:subject ?subject) 0)
(eq(str-compare (implode$ ?f:data) (implode$ $?eqL)) 0)
)
)
)
(implode$
(find-all-facts ((?f status))
(and
(eq(str-compare ?f:ident ?old) 0)
(eq(str-compare ?f:subject ?subject) 0)
(eq(str-compare …Run Code Online (Sandbox Code Playgroud)