⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rulemisc.exp

📁 NASA 开发使用的一个专家系统
💻 EXP
字号:
TRUECLIPS> (batch "rulemisc.bat")TRUECLIPS> (unwatch all)CLIPS> (clear) ; Test Thing #1CLIPS> (defrule rule-1 (foo $?b ?x) =>)CLIPS> (defrule rule-2 (foo $?y) =>)CLIPS> (clear) ; Test Thing #2CLIPS> (watch facts)CLIPS> (watch activations)CLIPS> (defrule foo (not (not (and (a) (b)))) =>)CLIPS> (defrule bar (not (and (a) (b))) =>)CLIPS> (reset)==> f-0     (initial-fact)==> Activation 0      foo: f-0,==> Activation 0      bar: f-0,<== Activation 0      foo: f-0,CLIPS> (assert (a))==> f-1     (a)<Fact-1>CLIPS> (assert (b))==> f-2     (b)<== Activation 0      bar: f-0,==> Activation 0      foo: f-0,<Fact-2>CLIPS> (unwatch all)CLIPS> (clear) ; Test Thing #3CLIPS> (reset)CLIPS> (defrule foo (initial-fact) (not (a)) =>)CLIPS> (defrule bar (initial-fact) =>)CLIPS> (agenda)0      bar: f-00      foo: f-0,For a total of 2 activations.CLIPS> (unwatch all)CLIPS> (clear) ; Test Thing #4CLIPS> (defrule foo (logical (exists (a ?) (b ?))) => (assert (q)))CLIPS> (reset)CLIPS> (assert (a 1) (b 1) (a 2) (b 2) (a 3))<Fact-5>CLIPS> (run)CLIPS> (watch facts)CLIPS> (retract 1 2 3 4)<== f-1     (a 1)<== f-2     (b 1)<== f-3     (a 2)<== f-4     (b 2)<== f-6     (q)CLIPS> (unwatch all)CLIPS> (clear) ; Test Thing #5CLIPS> (defrule rule-1 (a ?x) (not (b ?x)) =>)CLIPS> (reset)CLIPS> (assert (a 1) (a 2) (b 2))<Fact-3>CLIPS> (run)CLIPS> (refresh rule-1)CLIPS> (agenda)0      rule-1: f-1,For a total of 1 activation.CLIPS> (clear) ; Test Thing #6CLIPS> (reset)CLIPS> (watch facts)CLIPS> (watch activations)CLIPS> (defrule all-players-practiced   (logical (forall (player ?name)                    (pitched ?name)                    (batted ?name)))   =>   (assert (all-players-have-practiced)))==> Activation 0      all-players-practiced: f-0,CLIPS> (assert (player Gary) (pitched Gary) (batted Gary))==> f-1     (player Gary)<== Activation 0      all-players-practiced: f-0,==> f-2     (pitched Gary)==> f-3     (batted Gary)==> Activation 0      all-players-practiced: f-0,<Fact-3>CLIPS> (assert (pitched Brian) (player Brian) (batted Brian))==> f-4     (pitched Brian)==> f-5     (player Brian)<== Activation 0      all-players-practiced: f-0,==> f-6     (batted Brian)==> Activation 0      all-players-practiced: f-0,<Fact-6>CLIPS> (run)==> f-7     (all-players-have-practiced)CLIPS> (retract 3)<== f-3     (batted Gary)<== f-7     (all-players-have-practiced)CLIPS> (unwatch all)CLIPS> (clear) ; Test Thing #7CLIPS> (defrule rule-1  (team ?x)  (forall (player ?z ?x) (batted ?z) (pitched ?z))  =>)CLIPS> (matches rule-1)Matches for Pattern 1 NoneMatches for Pattern 2 NoneMatches for Pattern 3 NoneMatches for Pattern 4 NonePartial matches for CEs 1 - 2 NoneActivations NoneCLIPS> (assert (team Reds))<Fact-0>CLIPS> (matches rule-1)Matches for Pattern 1f-0Matches for Pattern 2 NoneMatches for Pattern 3 NoneMatches for Pattern 4 NonePartial matches for CEs 1 - 2f-0,Activationsf-0,CLIPS> (assert (player Gary Reds))<Fact-1>CLIPS> (matches rule-1)Matches for Pattern 1f-0Matches for Pattern 2f-1Matches for Pattern 3 NoneMatches for Pattern 4 NonePartial matches for CEs 1 - 2 NoneActivations NoneCLIPS> (assert (batted Gary))<Fact-2>CLIPS> (matches rule-1)Matches for Pattern 1f-0Matches for Pattern 2f-1Matches for Pattern 3f-2Matches for Pattern 4 NonePartial matches for CEs 1 - 2 NoneActivations NoneCLIPS> (assert (pitched Gary))<Fact-3>CLIPS> (matches rule-1)Matches for Pattern 1f-0Matches for Pattern 2f-1Matches for Pattern 3f-2Matches for Pattern 4f-3Partial matches for CEs 1 - 2f-0,Activationsf-0,CLIPS> (clear) ; Test Thing #8 - Fact Addresses ReferencesCLIPS> (defrule theRule   ?f <- (this)  (that ?f)  =>)CLIPS> (assert (that =(assert (this))))<Fact-1>CLIPS> (agenda)0      theRule: f-0,f-1For a total of 1 activation.CLIPS> (defrule theRule  ?f <- (a)  ?f <- (b)  =>)[ANALYSIS1] Duplicate pattern-address ?f found in CE #2.ERROR:(defrule MAIN::theRule   ?f <- (a)   ?f <- (b)   =>)CLIPS> (defrule theRule  (a ?f)  ?f <- (b)  =>)[ANALYSIS2] Pattern-address ?f used in CE #2 was previously bound within a pattern CE.ERROR:(defrule MAIN::theRule   (a ?f)   ?f <- (b)   =>)CLIPS> (clear) ; Test Thing #9CLIPS> (deffacts start (rule-2))CLIPS> (defrule rule-1 (rule-2) (rule-2 green) =>)CLIPS> (defrule rule-2 (rule-2 $?) =>)CLIPS> (reset)CLIPS> (agenda)0      rule-2: f-1For a total of 1 activation.CLIPS> (clear) ; Test Thing #10CLIPS> (defrule foo (a ?) (b ?) (c ?) =>)CLIPS> (assert (a 1) (a 2) (b 1) (b 2) (c 1))<Fact-4>CLIPS> (matches foo)Matches for Pattern 1f-0f-1Matches for Pattern 2f-2f-3Matches for Pattern 3f-4Partial matches for CEs 1 - 2f-0,f-3f-1,f-3f-0,f-2f-1,f-2Partial matches for CEs 1 - 3f-1,f-2,f-4f-0,f-2,f-4f-1,f-3,f-4f-0,f-3,f-4Activationsf-1,f-2,f-4f-0,f-2,f-4f-1,f-3,f-4f-0,f-3,f-4CLIPS> (clear) ; Test Thing #11CLIPS> (defrule foo    (exists (a ?x) (b ?x))    (exists (c ?x) (d ?x))   =>)CLIPS> (reset)CLIPS> (assert (a 1) (b 1) (c 2) (d 2))<Fact-4>CLIPS> (matches foo)Matches for Pattern 1f-0Matches for Pattern 2f-1Matches for Pattern 3f-2Matches for Pattern 4f-3Matches for Pattern 5f-4Partial matches for CEs 1 - 2f-0,Partial matches for CEs 1 - 3f-0,,Activationsf-0,,CLIPS> (dribble-off)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -