⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chemfirm.clp

📁 NASA 开发使用的一个专家系统
💻 CLP
📖 第 1 页 / 共 4 页
字号:
; Causal Mapping Using an Expert System (CLIPS) Version 6.0
; Michael Suh, Thomas Janicki, William Acar, Gregory Madey
; Graduate School of Management, Kent State University, Kent, OH 44242
; msuh@bsa1.kent.edu
;
; DISCLAIMER
; The codes in this program that the authors present are for 
; EDUCATIONAL PURPOSES ONLY.  As this program is not for a 
; commercial application but for a personal use, the users must 
; observe the following warning:  THIS PROGRAM SHOULD NOT BE USED IN 
; ANY APPLICATION WHERE A SERIOUS RISK OF LOSS IS POSSIBLE.
; The authors make no guarantee as to bugs or defects.  
; Any user shall not hold the authors of the code as well as 
; Joseph Giarratano, Gary Riley, and PWS Publishing Company responsible 
; if the program does not work as claimed by the authors.    
;
; Purpose of the Program: This expert system computerizes and offers an
; expert's knowledge assistance in the strategic decision making process 
; of causal mapping that is an approach for helping managers to develop
; scenarios and potential strategies.
;  
(deftemplate username (multislot name))
(deftemplate cashflow (slot value))
(deftemplate link1 (slot multi) (slot time))
(deftemplate link2 (slot multi) (slot time))
(deftemplate link3 (slot multi) (slot time))
(deftemplate link4 (slot multi) (slot time))
(deftemplate link5 (slot multi) (slot time))
(deftemplate link6 (slot multi) (slot time))
(deftemplate link7 (slot multi) (slot time))
(deftemplate link8 (slot multi) (slot time))
(deftemplate link9 (slot multi) (slot time))
(deftemplate link10 (slot multi) (slot time))
(deftemplate link11 (slot multi) (slot time))
(deftemplate link12 (slot multi) (slot time))
(deftemplate link13 (slot multi) (slot time))
(deftemplate link14 (slot multi) (slot time))
(deftemplate link15 (slot multi) (slot time))
(deftemplate link16 (slot multi) (slot time))
(deftemplate link17 (slot multi) (slot time))
(deftemplate link18 (slot multi) (slot time))
(deftemplate link19 (slot multi) (slot time))
(deftemplate link20 (slot multi) (slot time))
(deftemplate link21 (slot multi) (slot time))
(deftemplate link22 (slot multi) (slot time))
(deftemplate link23 (slot multi) (slot time))
(deftemplate link24 (slot multi) (slot time))
(deftemplate link25 (slot multi) (slot time))
(deftemplate link26 (slot multi) (slot time))
(deftemplate link27 (slot multi) (slot time))
(deftemplate link28 (slot multi) (slot time))
(deftemplate link29 (slot multi) (slot time))
(deftemplate link30 (slot multi) (slot time))
(deftemplate link31 (slot multi) (slot time))
(deftemplate link32 (slot multi) (slot time))
(deftemplate link33 (slot multi) (slot time))
(deftemplate link34 (slot multi) (slot time))
(deftemplate link35 (slot multi) (slot time))
(deftemplate link36 (slot multi) (slot time))
(deftemplate link37 (slot multi) (slot time))
(deftemplate link38 (slot multi) (slot time))
(deftemplate link39 (slot multi) (slot time))
(deftemplate link40 (slot multi) (slot time))
(deftemplate link41 (slot multi) (slot time))
(deftemplate link42 (slot multi) (slot time))
(deftemplate link43 (slot multi) (slot time))
(deftemplate link44 (slot multi) (slot time))
(deftemplate link45 (slot multi) (slot time))
(deftemplate link46 (slot multi) (slot time))
(deftemplate link47 (slot multi) (slot time))
(deftemplate link48 (slot multi) (slot time))
(deftemplate link49 (slot multi) (slot time))
(deftemplate link50 (slot multi) (slot time))
(deftemplate link51 (slot multi) (slot time))
(deftemplate link52 (slot multi) (slot time))
(deftemplate link53 (slot multi) (slot time))
(deftemplate link54 (slot multi) (slot time))
(deftemplate link55 (slot multi) (slot time))
(deffacts links
   (cashflow (value 1))
   (link1 (multi 7.2) (time 0))
   (link2 (multi 0.15) (time 0))
   (link3 (multi 0.00044) (time 0))
   (link4 (multi 1) (time 0))
   (link5 (multi -0.019) (time 12))
   (link6 (multi 1.05) (time 0))
   (link7 (multi 1) (time 0))
   (link8 (multi -0.0034) (time 12))
   (link9 (multi 0.22) (time 0))
   (link10 (multi 0.15) (time 0))
   (link11 (multi 0.026) (time 0)) 
   (link12 (multi 0.029) (time 0))
   (link13 (multi 1.79) (time 0))
   (link14 (multi 9.34) (time 0))
   (link15 (multi 1) (time 0))
   (link16 (multi -0.5) (time 0))
   (link17 (multi -0.5) (time 0))
   (link18 (multi 0) (time 0))
   (link19 (multi 0) (time 0))
   (link20 (multi 0) (time 0))
   (link21 (multi 0) (time 0))
   (link22 (multi 0) (time 0))
   (link23 (multi 0) (time 0))
   (link24 (multi 0) (time 0))
   (link25 (multi 0) (time 0))
   (link26 (multi 0) (time 0))
   (link27 (multi 0) (time 0))
   (link28 (multi 0) (time 0))
   (link29 (multi 0) (time 0))
   (link30 (multi 0) (time 0))
   (link31 (multi 0) (time 0))
   (link32 (multi 0) (time 0))
   (link33 (multi 0) (time 12))
   (link34 (multi 0) (time 0))
   (link35 (multi 0) (time 12))
   (link36 (multi 0) (time 0))
   (link37 (multi 0) (time 12))
   (link38 (multi 0) (time 12))
   (link39 (multi 0) (time 12))
   (link40 (multi 0) (time 12))
   (link41 (multi 0) (time 0))
   (link42 (multi 0) (time 12))
   (link43 (multi 0) (time 12))
   (link44 (multi 0) (time 0))
   (link45 (multi 0) (time 0))
   (link46 (multi 0) (time 0))
   (link47 (multi 0) (time 0))
   (link48 (multi 0) (time 0))
   (link49 (multi 0) (time 0))
   (link50 (multi 0) (time 0))
   (link51 (multi 0) (time 0))
   (link52 (multi 0) (time 0))
   (link53 (multi 0) (time 0))
   (link54 (multi 0) (time 0))
   (link55 (multi 0) (time 0)))

(defrule start-up
=> 
(printout t "WELCOME TO EXPERT SYSTEM PROGRAM for the ANALYSIS " crlf)
(printout t "of COMPREHENSIVE SITUATION MAPPING of CHEMFIRM!"crlf)
(printout t "The expert system program uses CLIPS version 6.0."crlf)

(printout t "To execute program, simply load, reset, and run."crlf)
(printout t "In all your response, please remember that CLIPS treats"crlf)
(printout t "the answer in a case-sensitive manner.  Hence, please"crlf)
(printout t "choose the answer as EXACT WORD or NUMBER as it appears"crlf)
(printout t "in the valid choice."crlf)

(printout t "A WORD of CAUTION: Many questions in this program"crlf)
(printout t "does not include error checking for invalid responses."crlf)
(printout t "An invalid choice entry can cause the program to return"crlf)
(printout t "to the beginning of the program."crlf)

(printout t "DISCLAIMER"crlf)
(printout t "The codes in this program that the authors present"crlf)
(printout t "are for EDUCATIONAL PURPOSES ONLY.  As this program"crlf)
(printout t "is not for a commercial application but for a personal use,"crlf)
(printout t "the users must observe the following warning:"crlf)
(printout t "THIS PROGRAM SHOULD NOT BE USED IN ANY APPLICATION"crlf)
(printout t "WHERE A SERIOUS RISK OF LOSS IS POSSIBLE."crlf)
(printout t "The authors make no guarantee as to bugs or defects."crlf)
(printout t "Any user shall not hold the authors of the code as well as"crlf)
(printout t "Joseph Giarratano, Gary Riley, and PWS Publishing Company"crlf)
(printout t "responsible if the program does not work as claimed by"crlf)
(printout t "the authors."crlf)    
 
(printout t "What is the user's (your) name?"crlf)
(bind ?user (explode$ (readline)))
(assert (username (name $?user)))
(assert (phase startchemfirm)))

;Phase start-chemfirm asks where the analysis should begin
(defrule start-chemfirm
?phase <- (phase startchemfirm)
=> (retract ?phase)
(printout t "Where has a change in environmental or internal"crlf)
(printout t "control occurred?"crlf)
(printout t "The valid choices are housing, pulp-paper, crudeoil, "crlf)
(printout t "chlor-new-capacity, na-new-capacity, other-mfg-cost" crlf)
(printout t "chlor-industry-demand, na-industry-demand."crlf)
(assert (response1 (read)))
(assert (phase1 testing)))

(defrule phase1-testing
?phase1 <- (phase1 testing)
=> (retract ?phase1) 
(printout t "Please answer only one choice at a time EXACTLY " crlf)
(printout t "as it appears in the valid choices." crlf)
(printout t "Please remember the case-sensitivity of CLIPS 6.0" crlf)
(assert (phase startchemfirm)))

(defrule bad-response
?phase1 <- (phase1 testing)
?badresponse1 <- (response1 ?bad&~housing&~pulp-paper&~crudeoil
                &~chlor-new-chemfirm-capacity&~na-new-chemfirm-capacity&~other-mfg-cost
                &~chlor-industry-demand&~na-industry-demand)
=> (retract ?phase1 ?badresponse1)
(printout t "Choose one of the valid choices and remember the"crlf)
(printout t "case-sensitivity of CLIPS 6.0." crlf)
(assert (response1 (read)))
(assert (phase1 testing)))
;deleted reset and run command above the assert statement

(defrule good-response
?phase1 <- (phase1 testing)
?goodresponse1 <- (response1 ?good&housing|pulp-paper|crudeoil|chlor-new-capacity|na-new-capacity|other-mfg-cost|chlor-industry-demand|na-industry-demand)
(response1 ?response1)
=> (retract ?phase1 ?goodresponse1) 
(if (eq ?response1 housing)
  then (assert (start housing)))
(if (eq ?response1 pulp-paper)
  then (assert (start pulp-paper)))
(if (eq ?response1 crudeoil)
  then (assert (start crudeoil)))
(if (eq ?response1 chlor-new-capacity)
  then (assert (start chlor-new-capacity)))
(if (eq ?response1 na-new-capacity)
  then (assert (start na-new-capacity)))
(if (eq ?response1 other-mfg-cost)
  then (assert (start other-mfg-cost)))
(if (eq ?response1 chlor-industry-demand)
  then (assert (start chlor-industry-demand)))
(if (eq ?response1 na-industry-demand)
  then (assert (start na-industry-demand))))

(defrule start-housing
?start <- (start housing)
?link1 <-  (link1 (multi ?multi1) (time ?time1))
   (link2 (multi ?multi2) (time ?time2))
   (link3 (multi ?multi3) (time ?time3))
   (link4 (multi ?multi4) (time ?time4))
   (link5 (multi ?multi5) (time ?time5))
   (link6 (multi ?multi6) (time ?time6))
   (link7 (multi ?multi7) (time ?time7))
   (link8 (multi ?multi8) (time ?time8))
   (link9 (multi ?multi9) (time ?time9))
   (link10 (multi ?multi10) (time ?time10))
   (link11 (multi ?multi11) (time ?time11)) 
   (link12 (multi ?multi12) (time ?time12))
   (link13 (multi ?multi13) (time ?time13))
   (link14 (multi ?multi14) (time ?time14))
   (link15 (multi ?multi15) (time ?time15))
   (link16 (multi ?multi16) (time ?time16))
   (link17 (multi ?multi17) (time ?time17))
?link18 <- (link18 (multi ?multi18) (time ?time18))
?link19 <- (link19 (multi ?multi19) (time ?time19))
?link20 <- (link20 (multi ?multi20) (time ?time20))
?link21 <- (link21 (multi ?multi21) (time ?time21))
?link22 <- (link22 (multi ?multi22) (time ?time22))
   (link23 (multi ?multi23) (time ?time23))
   (link24 (multi ?multi24) (time ?time24))
   (link25 (multi ?multi25) (time ?time25))
   (link26 (multi ?multi26) (time ?time26))
   (link27 (multi ?multi27) (time ?time27))
   (link28 (multi ?multi28) (time ?time28))
   (link29 (multi ?multi29) (time ?time29))
   (link30 (multi ?multi30) (time ?time30))
   (link31 (multi ?multi31) (time ?time31))
   (link32 (multi ?multi32) (time ?time32))
   (link33 (multi ?multi33) (time ?time33))
   (link34 (multi ?multi34) (time ?time34))
   (link35 (multi ?multi35) (time ?time35))
   (link36 (multi ?multi36) (time ?time36))
   (link37 (multi ?multi37) (time ?time37))
   (link38 (multi ?multi38) (time ?time38))
   (link39 (multi ?multi39) (time ?time39))
   (link40 (multi ?multi40) (time ?time40))
   (link41 (multi ?multi41) (time ?time41))
   (link42 (multi ?multi42) (time ?time42))
   (link43 (multi ?multi43) (time ?time43))
   (link44 (multi ?multi44) (time ?time44))
   (link45 (multi ?multi45) (time ?time45))
   (link46 (multi ?multi46) (time ?time46))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -