-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a75b95
commit e147646
Showing
370 changed files
with
8,766 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
(deffunction test-something () | ||
) | ||
|
||
|
||
(printout t "Testing *** :" crlf) | ||
(test-something) | ||
(printout t "Test done." crlf) | ||
(exit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Testing *** : | ||
Test done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Testing *** : | ||
Test done. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
(defmodule module-1) | ||
(defmodule module-2) | ||
|
||
(defrule module-1::rule-1 => ) | ||
(defrule module-1::rule-2 => ) | ||
(defrule module-2::rule-3 => ) | ||
(defrule module-2::rule-4 => ) | ||
|
||
(deffunction test-something () | ||
(reset) | ||
(printout t "Explicit module 1" crlf) | ||
(agenda module-1) | ||
(rules module-1) | ||
(printout t "Explicit module 2" crlf) | ||
(agenda module-2) | ||
(rules module-2) | ||
(printout t "No qualifier -- should be module-2" crlf) | ||
(agenda) | ||
(rules) | ||
(printout t "Agenda *" crlf) | ||
(agenda *) | ||
(rules *) | ||
) | ||
|
||
|
||
(printout t "Testing agenda command :" crlf) | ||
(test-something) | ||
(printout t "Test done." crlf) | ||
(exit) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
truetrueEncountered "(" at line 11, column 3. | ||
Was expecting: | ||
")" ... | ||
|
||
AlphaNode count 2 | ||
total AlphaMemories = 0 | ||
BetaNode Count 0 | ||
total BetaMemories = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Testing agenda command : | ||
Explicit module 1 | ||
[Activation: module-1::rule-1 f-0 ; time=1 ; salience=0] | ||
[Activation: module-1::rule-2 f-0 ; time=1 ; salience=0] | ||
For a total of 2 activations. | ||
module-1::rule-1 | ||
module-1::rule-2 | ||
For a total of 2 rules. | ||
Explicit module 2 | ||
[Activation: module-2::rule-3 f-0 ; time=1 ; salience=0] | ||
[Activation: module-2::rule-4 f-0 ; time=1 ; salience=0] | ||
For a total of 2 activations. | ||
module-2::rule-4 | ||
module-2::rule-3 | ||
For a total of 2 rules. | ||
No qualifier -- should be module-2 | ||
[Activation: module-2::rule-3 f-0 ; time=1 ; salience=0] | ||
[Activation: module-2::rule-4 f-0 ; time=1 ; salience=0] | ||
For a total of 2 activations. | ||
module-2::rule-4 | ||
module-2::rule-3 | ||
For a total of 2 rules. | ||
Agenda * | ||
MAIN: | ||
module-1: | ||
[Activation: module-1::rule-1 f-0 ; time=1 ; salience=0] | ||
[Activation: module-1::rule-2 f-0 ; time=1 ; salience=0] | ||
module-2: | ||
[Activation: module-2::rule-3 f-0 ; time=1 ; salience=0] | ||
[Activation: module-2::rule-4 f-0 ; time=1 ; salience=0] | ||
For a total of 4 activations. | ||
module-1::rule-1 | ||
module-2::rule-4 | ||
module-2::rule-3 | ||
module-1::rule-2 | ||
For a total of 4 rules. | ||
Test done. |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(defrule MAIN::rule-1 => ) | ||
(defrule MAIN::rule-2 => ) | ||
(defrule MAIN::rule-3 => ) | ||
(defrule MAIN::rule-4 => ) | ||
|
||
|
||
(printout t "Make sure single stepping works" crlf) | ||
(reset) | ||
(printout t "1: " (run 1) crlf) | ||
(printout t "2: " (run 2) crlf) | ||
(printout t "1: " (run 1) crlf) | ||
|
||
(printout t "0: " (run 1) crlf) | ||
|
||
(printout t "Test done." crlf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Make sure single stepping works | ||
1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Make sure single stepping works | ||
1: 1 | ||
2: 2 | ||
1: 1 | ||
0: 0 | ||
Test done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(printout t "Testing auto-focus :" crlf) | ||
|
||
(defmodule DETECTION) | ||
|
||
(defrule DETECTION::example | ||
(declare (auto-focus TRUE)) | ||
=> | ||
(printout t "Fire!" crlf)) | ||
|
||
(watch focus) | ||
(reset) | ||
(run) | ||
|
||
(printout t "Test done." crlf) | ||
(exit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Testing auto-focus : | ||
==> Focus MAIN | ||
<== Focus MAIN | ||
==> Focus DETECTION | ||
Fire! | ||
<== Focus DETECTION | ||
==> Focus MAIN | ||
<== Focus MAIN | ||
Test done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Testing auto-focus : | ||
==> Focus MAIN | ||
<== Focus MAIN | ||
==> Focus DETECTION | ||
Fire! | ||
<== Focus DETECTION | ||
==> Focus MAIN | ||
<== Focus MAIN | ||
Test done. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(deftemplate pattern (slot slot)) | ||
|
||
(do-backward-chaining pattern) | ||
|
||
(defrule rule-1 | ||
(not (pattern (slot 1))) | ||
=>) | ||
|
||
(deffunction test-something () | ||
(reset) | ||
(facts) | ||
) | ||
|
||
|
||
(printout t "Testing that negated patterns shouldn't trigger backward chaining :" crlf) | ||
(test-something) | ||
(printout t "Test done." crlf) | ||
(exit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Testing that negated patterns shouldn't trigger backward chaining : | ||
f-0 (MAIN::initial-fact) | ||
For a total of 1 facts. | ||
Test done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Testing that negated patterns shouldn't trigger backward chaining : | ||
f-0 (MAIN::initial-fact) | ||
For a total of 1 facts. | ||
Test done. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
(deftemplate factorial (slot in) (slot out)) | ||
|
||
(do-backward-chaining factorial) | ||
|
||
(deffacts one-value (factorial (in 5) (out 120))) | ||
|
||
(defquery get-factorial-1 | ||
(declare (variables ?x)) | ||
(factorial (in ?x) (out ?y))) | ||
|
||
(defquery get-factorial-2 | ||
(declare (variables ?x) | ||
(max-background-rules 10)) | ||
(factorial (in ?x) (out ?y))) | ||
|
||
(defrule do-factorial | ||
(need-factorial (in ?x)) | ||
=> | ||
(printout t "( Calculating the factorial of " ?x "... )" crlf) | ||
(bind ?r 1) | ||
(bind ?n ?x) | ||
(while (> ?n 1) | ||
(bind ?r (* ?r ?n)) | ||
(bind ?n (- ?n 1))) | ||
(assert (factorial (in ?x) (out ?r)))) | ||
|
||
(printout t "Testing backwards chaining in during defqueries:" crlf) | ||
|
||
(deffacts facts (factorial (in 5) (out 120))) | ||
(reset) | ||
|
||
(printout t "#1, in WM " (count-query-results get-factorial-1 5) crlf) | ||
(printout t "#1, not in WM " (count-query-results get-factorial-1 10) crlf) | ||
|
||
(reset) | ||
|
||
(printout t "#2, in WM " (count-query-results get-factorial-2 5) crlf) | ||
(printout t "#2, not in WM " (count-query-results get-factorial-2 10) crlf) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Testing backwards chaining in during defqueries: | ||
#1, in WM 1 | ||
#1, not in WM 0 | ||
#2, in WM 1 | ||
( Calculating the factorial of 10... ) | ||
#2, not in WM 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Testing backwards chaining in during defqueries: | ||
#1, in WM 1 | ||
#1, not in WM 0 | ||
#2, in WM 1 | ||
( Calculating the factorial of 10... ) | ||
#2, not in WM 1 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
(do-backward-chaining factorial) | ||
|
||
(defrule print-factorial-10 | ||
(factorial 10 ?r1) | ||
=> | ||
(printout t "The factorial of 10 is " ?r1 crlf)) | ||
|
||
(defrule print-factorial-10-and-12 | ||
(factorial 12 ?r1) | ||
(factorial 10 ?r2) | ||
=> | ||
(printout t "The factorial of 12 is " ?r1 | ||
", and of 10 is " ?r2 crlf)) | ||
|
||
(defrule print-factorial-5-10-and-12 | ||
"Shows how chaining won't be done if fact already exists" | ||
(factorial 5 ?r0) | ||
(factorial 12 ?r1) | ||
(factorial 10 ?r2) | ||
=> | ||
(printout t "The factorial of 12 is " ?r1 | ||
", and of 10 is " ?r2 ", and of 5 is " ?r0 crlf)) | ||
|
||
(defrule print-factorial-1000 | ||
"Shows how explicit modifer can be used to prevent backwards chaining." | ||
?a <- (explicit (factorial 1000 ?r1)) | ||
=> | ||
(printout t "The factorial of 1000 is " ?r1 crlf)) | ||
|
||
|
||
(defrule do-factorial | ||
(need-factorial ?x ?) | ||
=> | ||
(printout t "( Calculating the factorial of " ?x "... )" crlf) | ||
(bind ?r 1) | ||
(bind ?n ?x) | ||
(while (> ?n 1) | ||
(bind ?r (* ?r ?n)) | ||
(bind ?n (- ?n 1))) | ||
(assert (factorial ?x ?r))) | ||
|
||
(printout t "Testing backwards chaining in ordered facts:" crlf) | ||
(reset) | ||
(assert (factorial 5 120)) | ||
|
||
(run) | ||
(printout t "Test part 2 done." crlf) | ||
|
Oops, something went wrong.