【问题标题】:Clips matching expression is not working剪辑匹配表达式不起作用
【发布时间】:2011-05-17 22:32:48
【问题描述】:

你好剪辑我有这个模板:

(deftemplate cell(slot x)(slot y)(slot alive))

这个事实:

(start 1 1)

那么我在 LHS 中有这个条款:

?start<-(start ?x ?y)

我想得到变量?a1

(cell (x (+ ?x 1) )(y ?y)(alive ?a1))

似乎不允许添加到变量"(+ ?x 1)"所以如何 我能达到我想要的吗?

【问题讨论】:

  • 通过将部分标记为代码,使用“代码示例”按钮,您可以使您的帖子更清晰。

标签: expert-system clips


【解决方案1】:
CLIPS> (deftemplate cell (slot x) (slot y) (slot alive)) 
CLIPS>  
(deffacts initial
    (start 1 1)
    (cell (x 2) (y 1) (alive yes)))
CLIPS>     
(defrule example
    (start ?x ?y)
    (cell (x =(+ ?x 1)) (y ?y) (alive ?a1))
    =>
    (printout t "?a1 = " ?a1 crlf))
CLIPS> (reset)
CLIPS> (run)
?a1 = yes
CLIPS> 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-03
    • 1970-01-01
    • 1970-01-01
    • 2023-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多