clips

how to combine these two rules with CLIPS?

时光毁灭记忆、已成空白 提交于 2019-12-06 15:35:02
I have two rules in CLIPS which I want to combine if they're both true...not sure how to do it though. I have an attribute which is called grant-eligible ....I was thinking if I set it to TRUE then I could read the next rule, and then set the 'grant-eligible' to FALSE ....but it seems that my code is getting into an infinite loop when I do this... So here are my rules: (defrule complete "rule for app completeness" ?f <- (application (transcript-received Yes) (app-complete FALSE) (gpa ?v_gpa&:( > ?v_gpa 0))) => (modify ?f (app-complete TRUE))) (defrule denied "rule for admission - DENIED" ?f <-

How to get response from .clp(CLIPS) file?

回眸只為那壹抹淺笑 提交于 2019-12-06 00:58:45
I am trying to load .clp file in my iPhone application. For that I am using below code NSString *filePath = [[NSBundle mainBundle] pathForResource:@"autodemo" ofType:@"clp"]; environment = CreateEnvironment(); char *clipsFileChar = (char *)[filePath cStringUsingEncoding:NSASCIIStringEncoding]; Load(clipsFileChar); Reset(); Run(-1); NSString *evalS = [NSString stringWithFormat:@"(find-all-facts ((?f state-list)) TRUE)"]; char * evalStr = (char *)evalS; DATA_OBJECT obj;// = {0,-1}; // obj.type = STRING; // obj.value = evalStr; int i = Eval(evalStr, &obj); NSLog(@"%d",i); now when I run this code

Using Python Functions From the Clips Expert System

时间秒杀一切 提交于 2019-12-04 13:28:03
问题 Using PyClips, I'm trying to build rules in Clips that dynamically retrieve data from the Python interpreter. To do this, I register an external function as outlined in the manual. The code below is a toy example of the problem. I'm doing this because I have an application with a large corpus of data, in the form of a SQL database, which I want to reason with using Clips. However, I don't want to waste time converting all this data into Clips assertions, if I can simply "plug" Clips directly

CLIPS “Expected the beginning of a construct”

时光总嘲笑我的痴心妄想 提交于 2019-12-04 03:42:06
问题 I have this homework(I'm a student), in CLIPS, however I can't make any progress, despite searching on google, and spending some time on it. (clear) (deftemplate book (multislot surname)(slot name)(multislot title) ) (book (surname J.P.)(name Dubreuil)(title History of francmasons)) (book (surname T.)(name Eker)(title Secrets of millionaire mind)) (defrule find_title ?book<-(book(name Eker)) => (printout t ?book crlf) ) What I eventually get is this error: "Expected the beginning of a

Using Python Functions From the Clips Expert System

吃可爱长大的小学妹 提交于 2019-12-03 08:27:26
Using PyClips, I'm trying to build rules in Clips that dynamically retrieve data from the Python interpreter. To do this, I register an external function as outlined in the manual . The code below is a toy example of the problem. I'm doing this because I have an application with a large corpus of data, in the form of a SQL database, which I want to reason with using Clips. However, I don't want to waste time converting all this data into Clips assertions, if I can simply "plug" Clips directly into Python's namespace. However, when I try to create the rule, I get an error. What am I doing wrong

UITextView lineHeightMultiple Clips Top, first line, of Text

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In iOS 8, I have a vanilla UITextView that clips the top of the 1st line when a lineHeightMultiple is applied to it's NSMutableParagraphStyle , see image below: It appears as though lineHeightMultiple affects the 1st line of text in addition to subsequent lines. Setting clipsToBounds = false on the UITextView will at least enable the clipped part to show, but you can see from the image below that now the top part of the text is obviously above it's frame: I can fix this by just setting the top constraint on the offending UITextView to

leetcode 1024. 视频拼接

人走茶凉 提交于 2019-12-02 16:49:31
题意: 你将会获得一系列视频片段,这些片段来自于一项持续时长为 T 秒的体育赛事。这些片段可能有所重叠,也可能长度不一。 视频片段 clips[i] 都用区间进行表示:开始于 clips[i][0] 并于 clips[i][1] 结束。我们甚至可以对这些片段自由地再剪辑,例如片段 [0, 7] 可以剪切成 [0, 1] + [1, 3] + [3, 7] 三部分。 我们需要将这些片段进行再剪辑,并将剪辑后的内容拼接成覆盖整个运动过程的片段([0, T])。返回所需片段的最小数目,如果无法完成该任务,则返回 -1 。 示例: 输入:clips = [[0,2],[4,6],[8,10],[1,9],[1,5],[5,9]], T = 10 输出:3 解释: 我们选中 [0,2], [8,10], [1,9] 这三个片段。 然后,按下面的方案重制比赛片段: 将 [1,9] 再剪辑为 [1,2] + [2,8] + [8,9] 。 现在我们手上有 [0,2] + [2,8] + [8,10],而这些涵盖了整场比赛 [0, 10]。 提示: 1 <= clips.length <= 100 0 <= clips[i][0], clips[i][1] <= 100 0 <= T <= 100 思路: 本题使用dp,先对区间从小到大排序,我想到的一个状态转移方程为:f[end] = min(f

Conditional or selective rule using Clips

若如初见. 提交于 2019-12-02 14:24:56
问题 I hope you are doing very well? I am a beginner in regards to CLIPS. I have a graph of several nodes (start nodes (input) and of end nodes (output). I want to create a rule in the case where I have the number of input is equal to output, the rule must help me choose between several combinations (start and end nodes) the shortest path for each combination. Another rule can be added with the same rule before, if I have the number of input is greater than the number of output or the opposite.

Number equality test fails in CLIPS pattern matching?

六眼飞鱼酱① 提交于 2019-12-02 12:32:44
问题 I have this following rule in my CLIPS file: (defrule check-final (declare (salience 12)) ?scnt <- (set-count (value ?v) (class ?c)) (test (= ?v ?*total*)) => (printout T ?*total* " == " ?v crlf) ) And I get the following strange output: CLIPS>(run) 14 == 9 5 == 2 How is this possible ???? 回答1: Pattern matching for this rule occurs whenever the fact set-count is asserted or modified. The rule is fired some time afterwards, during the call to run . These two processes can be widely separated

Sort a set of facts CLIPS

半城伤御伤魂 提交于 2019-12-02 09:36:58
I am trying to order a collection of facts in CLIPS according to a comparator based on two fields ... Unfortunately I cannot understand why the comparator (apparently right) prints 2 if two facts are passed in which the first field is the same. MY COMPARATOR: (deffunction MAIN::rating-sort (?f1 ?f2) (printout t ?f1 crlf) (printout t ?f2 crlf) (printout t "f1-SC " (fact-slot-value ?f1 sum-certainties) crlf) (printout t "f2-SC " (fact-slot-value ?f2 sum-certainties) crlf) (printout t "f1-TP " (fact-slot-value ?f1 total-price) crlf) (printout t "f2-TP " (fact-slot-value ?f2 total-price) crlf) (if