Menu
  • HOME
  • TAGS

Write farsi in CLIPS(expert system)

clips,expert-system

CLIPS 6.3 internally supports UTF-8 strings, however, the application embedding CLIPS must also support UTF-8 I/O. The CLIPS Windows IDE does not support UTF-8 I/O. It uses older Win32 APIs and was not designed with unicode support in mind. The Mac OS X IDE, however, does support UTF-8 I/O: CLIPS>...

How to get information from the fact in CLIPS? [closed]

clips,fact

CLIPS> (clear) CLIPS> (deftemplate person (slot name) (slot address)) CLIPS> (assert (person (name "Sam Jones") (address "123 Main Street"))) <Fact-1> CLIPS> (assert (person (name "Sue Smith") (address "456 Maple Drive"))) <Fact-2> CLIPS> (facts) f-0 (initial-fact) f-1 (person (name "Sam Jones") (address "123 Main Street")) f-2 (person (name "Sue Smith") (address...

how to can get values in facts in clips?

return-value,clips

CLIPS> (watch facts) CLIPS> (assert (rule1 (read))) 4 ==> f-1 (rule1 4) <Fact-1> CLIPS> (defrule double (rule1 ?v) => (printout t "Twice the value is " (* 2 ?v) crlf)) CLIPS> (agenda) 0 double: f-1 For a total of 1 activation. CLIPS> (run) Twice the value is 8 CLIPS> ...

Checking the input to match fact in Clips

input,clips

You've defined symptom as a multifield slot (a slot containing zero or more fields), but your patterns matching those slots will only match if the slot contains a single field. Use a multifield variable such as $?symptom1 instead of a single field variable such as ?symptom1 to retrieve multiple values....

Fuzzy facts in clips

fuzzy-logic,clips

By having overlapping ranges it kind of makes sense. But maybe overlapping isn't what you want to do. What about: (deftemplate fz-knowledge 0 100 ( (low (20 1) (40 0)) (high (60 0) (80 1)) (med NOT [ low OR high ] ) )) That way, you can clearly tell...

I have integrated CLIPS with VC++(MFC), why there are some function does't execute,such as “strcmp”

c++,mfc,integration,clips

It looks like you're using a beta version of CLIPS 6.30 rather than the release version (clips_windows_projects_630.zip from http://sourceforge.net/projects/clipsrules/files/CLIPS/6.30/). The DLL doesn't expose the router functionality, so it's unclear how you could get your code to compile if you're embedding CLIPS in the same manner as the WrappedDLLExample. The following...

how to fuzzify in fuzzyclips?

clips,fuzzy-logic

Your deftemplates have missing parentheses. The corrected code is (deftemplate calories 20 180 ((high (20 0) (40 .2) (60 .5) (100 .8) (180 1)))) (deftemplate fat 50 150 ((increase (50 0) (100 .4) (120 .8) (150 1)))) ...

CLIPS input taking and comparison

clips,expert-system

CLIPS> (clear) CLIPS> (deftemplate country-info (slot country) (multislot color)) CLIPS> (deffacts country (country-info (country USA) (color red white blue)) (country-info (country Belgium) (color black yellow red)) (country-info (country Poland) (color white red)) (country-info (country Monaco) (color white red)) (country-info (country Sweden) (color yellow blue)) (country-info (country Panama) (color white blue...

Generalization of set of facts in CLIPS (trying to find matching slot values in multislot slots)

expert-system,clips,inference-engine,generalization

You can do this with a single rule, but it's a bit gnarly: CLIPS> (deftemplate simplecause (multislot coraxinfo) (multislot changeinfo)) CLIPS> (deftemplate finalcause (multislot coraxinfo) (multislot changeinfo)) CLIPS> (deffacts start (simplecause (coraxinfo 1 2 3) (changeinfo a b c)) (simplecause (coraxinfo 7 8 2 3 9) (changeinfo d a b...

Can I compare existing fact values to random numbers on the RHS of a defrule?

clips,expert-system

You can use the fact query functions on the RHS to determine if a fact exists for a specific move: (defrule First_Three_Moves "Used for the first 3 moves of the game" ?f <-(turn_num ?t_num) (next_turn p) (or(turn_num 1) (turn_num 2) (turn_num 3)) => (bind ?move (random 1 24)) (while (any-factp...

JESS Userfunction writes “BS” instead of “/home” to a file

java,clips,jess

The unquoted text /home/ is being parsed as a regular expression; the printed value is somewhat unpredictable. You need to include double quotes in your built-up command so the path is seen as a quoted string.

How to use not condition in CLIPS programming language properly?

clips,expert-system

As written the not conditional element prevents the rule from executing if the fact (bird ostrich) is present. Since that fact is present once you perform a (reset), the rule does not execute. If you want the rule to execute for each bird fact where ?var is not ostrich, you...

CLIPS Validate Text Entry

validation,text,clips

This is how you'd do it using rules: CLIPS> (defrule test-response (response-in ?response&y|n) => (printout t ?response " is valid" crlf)) CLIPS> (defrule test-non-response ?response-address <- (response-in ?response&~y&~n) => (printout t ?response " not valid response" crlf) (retract ?response-address)) CLIPS> (assert (response-in xyz)) <Fact-1> CLIPS> (run) xyz not valid response...

How can other defmodules import defclass and deftemplate from MAIN

clips

This is the relevant passage from section 10.1 of the Basic Programming Guide: All of the predefined system classes (see section 9.2) belong to the MAIN module. However, it is not necessary to import or export the system classes; they are always in scope. Discounting the previous exception, the predefined...

CLIPS defrule checking if multiple sides of a box are taken

clips,expert-system

I would suggest explicitly representing each possible line as a fact and denote in the fact whether the line has been taken. Also do the pattern matching in the conditions of the rules rather than the actions. CLIPS> (deftemplate line (slot id) (slot taken (default no))) CLIPS> (defrule Player_Move_Top_Line ?take...

Count and average

clips

CLIPS> (deftemplate customer (slot name) (slot money)) CLIPS> (deffacts people (customer (name a) (money 20)) (customer (name b) (money 30)) (customer (name c) (money 40))) CLIPS> (reset) CLIPS> (defrule average (exists (customer)) => (bind ?count 0) (bind ?sum 0) (do-for-all-facts ((?f customer)) TRUE (bind ?count (+ ?count 1)) (bind ?sum...

Cant make 'not' and 'eq' work together

clips

You need to use the test CE to evaluate expressions in the conditions of a rule. For example, instead of (not (eq ?sp ?p2)) use (test (not (eq ?sp ?p2))) or (test (neq ?sp ?p2)) Your existing rules are attempting to match a fact with relation name eq rather than...

First CLIPS code doesnt work

system,clips,expert-system

Some suggest revisions: (defrule determine-closing-date (not (day-to-close ?)) (billing-size ?billing-size) (unpaid-invoices-number ?unpaid-invoices-number) => (if (or (< ?billing-size 1000000) (< ?unpaid-invoices-number 1000000)) then (assert (day-to-close MtTh)) else (assert (day-to-close friday)))) (defrule determine-billing-size "" (not (billing-size ?)) (not (day-to-close ?)) => ; What is the size of the billing? (printout t "¿Cuál...

CLIPS incrementing variable without endless loop

infinite-loop,clips,expert-system

If the sole purpose of the (input 1) fact is to increment the score and is no longer needed after the score is incremented, just retract that fact. (defrule children ?f <- (input 1) ?children <- (breed (children 1|2) (score ?score)) => (retract ?f) (bind ?sc (+ ?score 1)) (modify...

Taking all values of multislot slot using the fact-address in CLIPS

clips,expert-system,inference-engine

Per Gary's comment: The shorthand syntax for retrieving slot values can only be used in the fact-set query functions. Use "(fact-slot-value ?f changeinfo)" instead of ?f:changeinfo...

How do I have a program in CLIPS assert user input without having the user type assert(whatever))

user-input,clips

CLIPS> (deffacts start (get-next-input)) CLIPS> (defrule get-input ?f <- (get-next-input) => (printout t "Input (end to stop)? ") (bind ?input (readline)) (if (neq ?input "end") then (retract ?f) (assert (get-next-input)) (assert (user-input ?input)))) CLIPS> (reset) CLIPS> (run) Input (end to stop)? The plant is yellow in color Input (end to...

expected the beginning of a construct error

clips,expert-system

If you watch compilations, you can see the point at which the error occurs: CLIPS> (clear) CLIPS> (watch compilations) CLIPS> (load problem.clp) Defining deffunction: check-YNoptions-input Defining deffunction: output-exitmessage Defining deffunction: ask-question Defining defrule: UFP +j+j+j [CSTRCPSR1] Expected the beginning of a construct. Defining defrule: rule2 +j+j FALSE CLIPS> The issue...

Modifying the current fact that fires a rule

rule,clips

Here's a slightly less verbose version of the rule you came up with to solve your problem: CLIPS> (deftemplate student (slot name (type SYMBOL) (default ?NONE)) (slot grade (type SYMBOL) (default C) (allowed-symbols A B C D)) (slot graduated (type SYMBOL) (default no) (allowed-symbols yes no))) CLIPS> (deffacts insert-facts (student...

What types of files can CLIPS open

file-io,clips

You can use the open command to open a file for reading in either text or binary mode. If you opened a xlsx file in binary mode, you could use the get-char function to retrieve individual characters from the file. There's no built-in functionality for parsing a xlsx file, so...

CLIPS: forcing a rule to re-evaluate the value of a global variable?

clips

Don't attempt to use global variables or function calls in this manner. First, global variables are specifically designed to not trigger pattern matching. Second, it would take a bit of magic for CLIPS to know when a function call needs to be reevaluated as there are any number of changes...

When compile the CLIPS integration source code,the CLIPSStatic in the CLIPS Solution is failed

visual-studio-2012,integration,clips

You're using the wrong projects/solutions. Download the latest commit (r281). The solution folders in the microsoft_windows directory that you want to use are CLIPS_MVC_2010, CLIPS_MVC_2013, Examples_MVC_2010, and Examples_MVC_2013. Since you're using Visual Studio 2012, you'll probably want to use the 2010 directories. The instructions in the Advanced Programming Guide specifically...

Clips Check appropriate syntax for defrule

logic,artificial-intelligence,clips

Your syntax has several problems that must be corrected. The design could also be simplified (but I will not talk about that aspect). The following shows an equivalent version with corrections. homeless.clp (deftemplate Claimant (slot homeless (type SYMBOL) (allowed-values yes no)) (slot unemployed (type SYMBOL) (allowed-values yes no)) (slot nosavings...

how to force Clips to stay at the rule until is totally finished with the data without redundancy?

clips,expert-system

The exact behavior you want is not clear from your question, but here's one technique for querying the user, printing all the results, and then determining if another query should be performed. CLIPS> (clear) CLIPS> (deftemplate laptop (slot name) (slot price) (slot usagefor) (slot description)) CLIPS> (deftemplate find_laptops (slot price)...

return two values in clips function

clips

Use create$ to place multiple values within a multifield value. You can then use nth$ to retrieve individual values: CLIPS> (deffunction direction () (return (create$ 1 -1))) CLIPS> (direction) (1 -1) CLIPS> (nth$ 1 (direction)) 1 CLIPS> (nth$ 2 (direction)) -1 CLIPS> ...

How to change the match algorithms in CLIPS

real-time,clips

The architecture manual for CLIPS 5.1 is available here: http://clipsrules.sourceforge.net/documentation/other/arch5-1.pdf. It's not for the most recent version of the code, but a great deal of the information is still relevant, particularly for descriptions of the source code files. For constructing the rete network, the more important files are analysis.c, factbld.c,...

Find the maximum of the facts in the clips SATISFYING THE CONDITION

condition,clips

In your find-max deffunction where you had TRUE, you need to place your condition there instead. The test CE element, (test (eq ?oper 2)), you placed within the function only work within the conditions of a rule. (deffunction find-max (?template ?predicate) (bind ?max FALSE) (do-for-all-facts ((?f ?template)) (eq (fact-slot-value ?f...