一、通过定义规则来控制先后,不通过优先级
二、
CLIPS> (ppdeffacts control-information)
(deffacts MAIN::control-information
(phase detection)
(phase-after detectionisolation)
(phase-after isolationrecovery)
(phase-after recoverydetection))
CLIPS> (ppdefrule change-phase)
(defrule MAIN::change-phase
(declare (salience -10))
?phase <-(phase ?current-phase)
(phase-after ?current-phase?next-phase)
=>
(retract ?phase)
(assert (phase?next-phase)))
CLIPS> (run 10)
FIRE 1change-phase: f-1591,f-2
<== f-1591 (phase detection)
==> f-1592 (phase isolation)
==> Activation-10change-phase: f-1592,f-3
FIRE 2change-phase: f-1592,f-3
<== f-1592 (phase isolation)
==> f-1593 (phase recovery)
==> Activation-10change-phase: f-1593,f-4
FIRE 3change-phase: f-1593,f-4
<== f-1593 (phase recovery)
==> f-1594 (phase detection)
==> Activation-10change-phase: f-1594,f-2
FIRE 4change-phase: f-1594,f-2
<== f-1594 (phase detection)
==> f-1595 (phase isolation)
==> Activation-10change-phase: f-1595,f-3
FIRE 5change-phase: f-1595,f-3
<== f-1595 (phase isolation)
==> f-1596 (phase recovery)
==> Activation-10change-phase: f-1596,f-4
FIRE 6change-phase: f-1596,f-4
<== f-1596 (phase recovery)
==> f-1597 (phase detection)
==> Activation-10change-phase: f-1597,f-2
FIRE 7change-phase: f-1597,f-2
<== f-1597 (phase detection)
==> f-1598 (phase isolation)
==> Activation-10change-phase: f-1598,f-3
FIRE 8change-phase: f-1598,f-3
<== f-1598 (phase isolation)
==> f-1599 (phase recovery)
==> Activation-10change-phase: f-1599,f-4
FIRE 9change-phase: f-1599,f-4
<== f-1599 (phase recovery)
==> f-1600 (phase detection)
==> Activation-10change-phase: f-1600,f-2
FIRE 10 change-phase:f-1600,f-2
<== f-1600 (phase detection)
==> f-1601 (phase isolation)
==> Activation-10change-phase: f-1601,f-3
10 rulesfiredRun time is 0.0899999999999181 seconds.
111.111111111212 rules per second.
5 mean number of facts (5 maximum).
1 mean number of instances (1 maximum).
1 mean number of activations (1 maximum).