clips

Designing a unit-test framework for writing custom tests in CLIPS for CLIPS rules, using a multi-file setup

六眼飞鱼酱① 提交于 2021-01-29 10:14:34
问题 I'd like to make a unit-test like framework that allows me to write custom tests for individual rules. I'd like each test to be in it's own file, i.e. test_R1.clp would be the test file for rule R1 . Each test should be able to load it's own facts file. I've tried many variations of the following, including using a different defmodule for each file. Is what I'm trying to do even possible in CLIPS? If so, what else is needed to make this work? I'd like to run my tests via: $CLIPSDOS64.exe -f2

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语言学习(1)fact & rule

拜拜、爱过 提交于 2020-02-14 08:41:55
什么是专家系统? 专家系统(Expert System) 是一种在特定领域内具有专家水平解决问题能力的程序系统,属于人工智能的一个发展分支。它能够有效地运用专家多年积累的有效经验和专门知识,通过模拟专家的思维过程,解决需要专家才能解决的问题。 专家系统的基本结构如图所示,其中箭头方向为数据流动的方向。专家系统通常由人机交互界面、知识库、推理机、解释器、综合数据库、知识获取等6个部分构成。(来自:MBA智库) 什么是CLIPS? CLIPS是用于编写专家系统的一种编程语言,或称专家系统工具。CLIPS shell(shell表示该编程环境中代表分析、推理的部分)包含了fact-lists(事实列表)、knowledge-base(知识库)、inference engine(推理机)。 官方文档表示如下:(WPS开护眼,绿光闪耀宁的眼) 本人计划开发一个基于CLIPS的启发式推理的专家系统,数据处理和UI界面将在后期使用Python编写代码实现。在现阶段主要完成逻辑模块,选择CLIPS作为专家系统编程语言,配置相应的编码环境,学习CLIPS6.4的官方文档,并同步做记录于此。 编程环境:CLIPS IDE 害,说是IDE,其实就是界面好看一丢丢的CLIPSDOS,命令提示符为"CLIPS>"。编程过程中没有match快捷方式以及错误提示,不过这样“返璞归真”的编程方式

Sort a set of facts CLIPS

青春壹個敷衍的年華 提交于 2020-01-30 11:00:51
问题 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 "

Get slot value of an object

≡放荡痞女 提交于 2020-01-25 13:08:17
问题 I need to retrieve a slot value (passing a slot name) from an instance which may contain other instances. Example: (defclass MAINCONTROLLER (is-a USER) (slot uuid (type STRING)) (slot param (type INSTANCE)) (multislot zones (type INSTANCE)) (slot state (allowed-values a b c)) (slot pump (allowed-values on off))) (make-instance mainController of MAINCONTROLLER (uuid "myController123") (param [param-mainController]) (zones [zone1] [zone2]) (state a) (pump on)) Slot named "param" contains an

How to optimize pattern matching between different templated facts in CLIPS

╄→尐↘猪︶ㄣ 提交于 2020-01-25 08:22:47
问题 I have a rule similar to the following: (deftemplate person (slot name ( type INTEGER)) (slot surname ( type INTEGER)) ) (defrule surname_cant_be_a_name ?p1<-(person (name ?n1)) ?p2<-(person (surname ?n2&:(= ?n1 ?n2))) => (retract ?p2) ) Functionally, this works. But I run this on a huge fact-set, and the complexity gets through the roof fairly quickly. Because the rule is looking for two person objects, there's a nested for-loop kinda situation slowing the execution down. This setup goes

Installing PyCLIPS based on CLIPS 6.30 for Windows Python 2.7 32 bit

ε祈祈猫儿з 提交于 2020-01-23 17:19:48
问题 I learned that there is a version of PyCLIPS based on CLIPS version 6.30. The same (or similar) PyCLIPS version can also be installed via pip, see here. On Linux, both approaches work fine, i.e. installing via git clone + setup.py, or via pip. On Windows, it worked only with cygwin 64bit. pip install pyclips failed (I suppose due to the missing '-DWIN_MVC' flag, see step 7 below). However, I would like to have a PyCLIPS based on CLIPS 6.30 on a 'regular' Windows python, to be precise Python2

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

↘锁芯ラ 提交于 2020-01-16 18:35:33
问题 Is it possible to cause CLIPS to re-evaluate the value of a global variable in a defrule? I have this: (defrule encourage "Do we have a GPA higher than 3.7?" (test (> (gpa) 3.7)) => (printout t "Keep up the excellent work!" crlf)) gpa is function that calculates and returns a number based on two global variables (grade points and number of credits). I read somewhere that changes to global variables do not invoke pattern matching. How do I go about forcing this? I want to print that string