Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLIPS load and run program from file

Tags:

clips

I'm using CLIPS (http://clipsrules.sourceforge.net/) for a university project, but I cannot run program directly from files, in this case I don't want to use the prompt to insert FACTS and RULES.

right now I'm doing this.

  1. I open CLIPS ... CLIPS> appear on prompt
  2. Load the file (load "FILE_PATH")
  3. All FACTS, Rules and defFacts were inserted
  4. Type (run) to let the program run and applies rules
like image 521
Full-Stack Software Engineer Avatar asked Aug 08 '14 20:08

Full-Stack Software Engineer


1 Answers

Place the commands you want executed in a file. For example, the contents of run.bat is the following:

(load file1.clp)
(load file2.clp)
(reset)
(run)

If you're using a command line version, you can execute the contents of the batch file using one of the following two commands:

clips -f run.bat
clips -f2 run.bat

Using the -f option will echo the commands to the command prompt. Using the -f2 option will execute the commands without echoing the commands to the command prompt.

Alternately, you can also embed CLIPS within a C program as described within the Advanced Programming Guide, http://clipsrules.sourceforge.net/OnlineDocs.html.

like image 141
Gary Riley Avatar answered Sep 21 '22 16:09

Gary Riley