I'm stuck here with this Clips project. I really have no idea how to fix my problems. Any help? this is the project
and here is my code:
CLIPS> (assert (saving 30000))
<Fact-1>
CLIPS> (assert (income 50000))
<Fact-2>
CLIPS> (assert (job steady))
<Fact-3>
CLIPS> (assert (expenses 10000))
<Fact-4>
CLIPS> (defglobal ?*s* = 30000)
CLIPS> (defglobal ?*i* = 50000)
CLIPS> (defglobal ?*e* = 10000)
CLIPS> (defglobal ?*x* = 0.5)
CLIPS> (defrule rule1
(test (> ?*s* (* ?*x* ?*i*)))
=>
(assert (savingst good)))
CLIPS> (defrule rule2
(job steady)
(test(> ?*i* ?*e*))
=> (assert (incomest good))
)
CLIPS> (defrule rule3
(and (savingst good)(incomest good))
=>
(printout t "Advise is invest money in stocks" crlf)
(assert (investment ok))
)
CLIPS> (run)
Advise is invest money in stocks
CLIPS> (bsave "C:/Users/Home/Desktop/pro")
TRUE
CLIPS> (save file.clp)
first of all I dunno how should I export a *.clp file. but I did it as shown above. when I load this file and then run it , it only runs rule1. is there anyone who can help me?
If you open file.clp, you'll see that the assert statements are not present. The save function only saves constructs (such as defrule, defglobal, deftemplate, ...), not functions/commands. Use the deffacts construct to indicate facts which should be asserted each time a (reset) command is used:
You don't have to enter your constructs at the CLIPS command prompt and then save them. Just use a text editor (either a separate plain text editor or the one included with the CLIPS Windows and Mac OS IDEs). That makes it easier to create/copy/edit your constructs. You can then use the command prompt primarily for execution/debugging commands.
Here's a better approach for your problem: