expert-system

CLIPS rule dont match

六月ゝ 毕业季﹏ 提交于 2020-08-09 09:16:52
问题 I have a problem with a rule match in Clips, in particular i can't understand why this rule doesn't actives. (deffunction get-unknow-col (?col) (bind ?facts (length (find-all-facts ((?a a-cell)) (and (eq ?a:y ?col) (eq ?a:content unk))))) (return ?facts) ) (deffunction get-boat-pieces-col (?col) (bind ?facts (length (find-all-facts ((?a a-cell)) (and (eq ?a:y ?col) (and (neq ?a:content unk) (neq ?a:content water)))))) (return ?facts) ) (defrule mark-remaining-unk-cells-col (declare (salience

CLIPS accessing a property of a property

二次信任 提交于 2020-01-07 00:56:09
问题 I read in this SO answer that it is better to explicitly retrieve the slot value by matching it rather than using the slot accessor as this will cause the condition to be reevaluated whenever the slot value changes What if I want to access the property of a property? For example, given two instances a and b of classes A and B , respectively. a has a property called ref_to_b which is a reference to b . b has a property called some_prop_of_b . How do I match the following: a with ref_to_b equal

CLIPS Error:Template xxx does not exist for assert

半腔热情 提交于 2020-01-06 05:46:09
问题 CLIPS version: 6.31 language: c++ clips C API Why am I getting this error? How should I fix this error? [FACTRHS1] Template be-contact-model.riskLevel does not exist for assert. Function load-facts encountered an error The process is as follows: Firstly, I create a CLIPS environment from the full clips rule code using the ClipsEnvLoadFromString function, I will get a normal result in this CLIPS environment using the EnvLoadFactsFromString function.Next I want to copy more than one CLIPS

expected the beginning of a construct error

匆匆过客 提交于 2019-12-25 16:57:49
问题 When I run system, it shows error "expected the beginning of a construct" .. how can I correct this mistake my rules look like this (defrule UFP (not (repair ?)) ?f <- (rule1) => (retract ?f) (printout t "Finish UFP (y/n) yes> go to rule 10 - Advise : Select your major No> go to rule 2 - Advise : please finish all the levels of UFP to enter your major q>Exit system" crlf) (bind ?response (check-YNoptions-input)) (if (eq ?response y) then (assert (rule10)) ) (if (or(eq ?response q) (eq

CLIPS: Unable to proceed after inputting choice

孤街醉人 提交于 2019-12-25 07:39:42
问题 I'm trying to create a diagnosis expert system. I have managed to create the menu and submenu but after inputting my choice(e.g 1). The question that supposed to be asked after the submenu does not appear. Hence not being able to continue. I would like to ask whether is there anything wrong with what I did? If there is, what is the proper way to do it? Here's a part of the code for reference: CLIPS> ;; MainMenu (defrule Menu (not (iffoundChoice ?)) => (printout t crlf crlf crlf "Choose one of

CLIPS constant compiler directive

≯℡__Kan透↙ 提交于 2019-12-25 00:37:52
问题 Similar to the compiler directive for constants in C, is there a way I can do the following in CLIPS? #define INFINITY 1000000000 (deftemplate foo (slot num (type INTEGER) (default INFINITY)) ) ... (defrule bar (foo (num INFINITY)) => ... ) 回答1: You can define a global variable and treat it as a constant: CLIPS> (defglobal ?*INFINITY* = 1000000000) CLIPS> (deftemplate foo (slot num (type INTEGER) (default ?*INFINITY*))) CLIPS> (defrule bar (foo (num ?num&:(eq ?num ?*INFINITY*))) =>) CLIPS>

Output of JESS in Java

十年热恋 提交于 2019-12-19 09:44:46
问题 I want to send a "fact" to a JESS file within java and get the results back. I basicly batch the JESS file and then send my data (structure in here) into the engine by .add(). I tried to get the JESS results, which should be a string, into a "Value". Rete engine = new Rete(); engine.batch("file.clp"); Value = AAAnull; try{ engine.add(structure) AAA = engine.eval("(run)"); } catch ... System.out.println(AAA); The result is always a number, although the result should be a string. I have worked

Increment or change variable each time Jess rule fires

北城以北 提交于 2019-12-13 03:32:06
问题 Is there a way to increment or change value of some variable each time rule fires? I need that for every time rule fires introduce new value of the slot, since I will use this value for connectivity in the following example: I have an electric circuit and rule that transforms delta to star. For every transform product is additional node. For simple network I have named it T, but for more complicated network I end up with network that is full of T nodes, since every time rule is triggered for

Add numeric values to a variable in ActionListener, to show variable result

扶醉桌前 提交于 2019-12-11 21:43:17
问题 What I need to make: Its a basic, ask user questions and then supply result in the end application. I've made questions on different JPanels, when user clicks on a choice, I want to record his choice and also move to the next question. A final JPanel will display result as per user choices. How I'm doing it: Initiate a variable. int R=0; Inside ActionListener of a button, I use set.Visible(); to move to next question (JPanel), and R=R+numeric value. After selecting different choices,

CLIPS input taking and comparison

亡梦爱人 提交于 2019-12-11 12:56:56
问题 I need to take in input from the user which color and then output the flags that contain that color. I have this so far. I am pretty sure that the setup of my templates is correct. I just seem to be having issues with the input and the comparison and output part. Any help would be appreciated. I looked at a couple of other posts and used what I could be it still is not working. Thank you. (deftemplate country-info (slot country) (multislot color) ) ; setting the template for flags taking the