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

📄 acqclips.clp

📁 NASA 开发使用的一个专家系统
💻 CLP
📖 第 1 页 / 共 4 页
字号:
    (printout t "purpose is evaluated to be " ?sumfin "."crlf)    (printout t "The actual score of financial factors questions is "crlf)    (printout t ?totalfin ".  " crlf)    (printout t "The financial factors score is evaluated as follows:"crlf)    (printout t "excellent 55-50"crlf)    (printout t "good 49-35"crlf)    (printout t "fair 34-19"crlf)    (printout t "poor 18-0."crlf)    (printout t "Would you like to see a detailed report of your response"crlf)    (printout t "to 13 financial factors questions?"crlf)    (printout t "yes or no? Please enter yes or no."crlf)    (bind ?answer (read))    (if (eq ?answer yes)     then (assert (report finresponse1)))    (if (eq ?answer no)     then (assert (phase finalreport))))(defrule finreponse1   (report finresponse1)   (af1 ?af1)   (af2 ?af2)   (af3 ?af3)   (af4 ?af4)   (af5 ?af5)   (af6 ?af6)   (af7 ?af7)   (af8 ?af8)   (af9 ?af9)   (af11 ?af11)   (af13 ?af13)   (af15 ?af15)   (af17 ?af17)    =>    (printout t "Your responses to financial factor questions"crlf)   (printout t "are as follows.  The response is shown exactly as you"crlf)   (printout t "entered along with possible answer choices."crlf)   (printout t " size, total assets? " ?af1 " among 0 3 6."crlf)   (printout t " market to book value? " ?af2 " among 0 1 2 3."crlf)   (printout t " market to book value trend? " ?af3 " among 0 1 3 5."crlf)   (printout t " price to earnings ratio? " ?af4 " among 0 1 2 3."crlf)   (printout t " price to earnings ratio trend? " ?af5 " among 0 1 3 5."crlf)   (printout t " average excess return(absolute)? " ?af6 " among 0 1 2 3."crlf)   (printout t " average excess return trend? " ?af7 " among 0 1 3 4."crlf)   (printout t " trading volume trend? " ?af8 " among 0 1 2 3."crlf)   (printout t " bid-ask spread trend? " ?af9 " among 0 1 2 3."crlf)   (printout t " current ratio? " ?af11 " among 0 1 3 6."crlf)   (printout t " quick ratio? " ?af13 " among 0 1 3 4."crlf)   (printout t " return on total assets? " ?af15 " among 0 1 3 5."crlf)   (printout t " return on equity? " ?af17 " among 0 1 3 5."crlf)   (assert (phase finalreport)));; This final phase returns an overall acquisition suitability value;; of the target firm on a 10 point scale from -2 to 7 (best).(defrule finalreport ?phase <- (phase finalreport) => (retract ?phase)   (printout t "The expert system will now return an overall acquisition"crlf)   (printout t "suitability value of the target firm on a 10 point"crlf)   (printout t "scale from -2 to 7 (best) after the following 2 questions."crlf)   (assert (get user)))(defrule getuser   (get user)   =>   (printout t "What is the user's (your) name?"crlf)   (bind ?user (explode$ (readline)))   (assert (username (name $?user)))   (assert (ask target)))(defrule asktarget   (ask target)   =>   (printout t "What is the name of the target firm?"crlf)   (bind ?target (explode$ (readline)))   (assert (targetname (name $?target)))   (assert (getrule1 ok)))(defrule seven   (or (and (sume e) (summ e) (sumf e))       (and (sume e) (summ g) (sumf e))       (and (sume g) (summ e) (sumf e)))   (getrule1 ok)    =>    (assert (finalvalue (value 7)))   (assert (phase printfinal)))(defrule six   (or (and (sume e) (summ e) (sumf g))       (and (sume e) (summ f) (sumf e))       (and (sume g) (summ g) (sumf e))       (and (sume g) (summ f) (sumf e))       (and (sume f) (summ e) (sumf e)))   (getrule1 ok)   =>   (assert (finalvalue (value 6)))   (assert (phase printfinal)))(defrule five   (or (and (sume e) (summ g) (sumf g))       (and (sume g) (summ e) (sumf g))       (and (sume g) (summ p) (sumf e))       (and (sume f) (summ g) (sumf e))       (and (sume f) (summ f) (sumf e))       (and (sume f) (summ p) (sumf e)))   (getrule1 ok)   =>   (assert (finalvalue (value 5)))   (assert (phase printfinal)))(defrule four   (or (and (sume e) (summ e) (sumf f))       (and (sume e) (summ g) (sumf f))       (and (sume e) (summ f) (sumf g))       (and (sume g) (summ g) (sumf g))       (and (sume g) (summ f) (sumf g))       (and (sume f) (summ e) (sumf g))       (and (sume f) (summ g) (sumf g))       (and (sume f) (summ f) (sumf g)))   (getrule1 ok)   =>   (assert (finalvalue (value 4)))   (assert (phase printfinal)))(defrule three  (or (and (sume e) (summ f) (sumf f))      (and (sume e) (summ p) (sumf e))      (and (sume e) (summ p) (sumf g))      (and (sume g) (summ e) (sumf f))      (and (sume g) (summ g) (sumf f))      (and (sume f) (summ e) (sumf f))      (and (sume f) (summ g) (sumf f))      (and (sume f) (summ f) (sumf f))      (and (sume f) (summ p) (sumf g)))   (getrule1 ok)   =>   (assert (finalvalue (value 3)))   (assert (phase printfinal)))(defrule two   (or (and (sume g) (summ p) (sumf g))       (and (sume p) (summ e) (sumf e))       (and (sume p) (summ e) (sumf g))       (and (sume p) (summ g) (sumf e))       (and (sume p) (summ g) (sumf g))       (and (sume p) (summ f) (sumf e)))   (getrule1 ok)   =>   (assert (finalvalue (value 2)))   (assert (phase printfinal)))(defrule one   (or (and (sume e) (summ p) (sumf f))       (and (sume g) (summ f) (sumf f))       (and (sume g) (summ p) (sumf f))       (and (sume f) (summ p) (sumf f))       (and (sume p) (summ e) (sumf f))       (and (sume p) (summ f) (sumf g)))   (getrule1 ok)   =>   (assert (finalvalue (value 1)))   (assert (phase printfinal)))(defrule zero   (or (and (sume p) (summ f) (sumf f))       (and (sume p) (summ p) (sumf e))       (and (sume g) (summ e) (sumf p))       (and (sume e) (summ e) (sumf p))       (and (sume e) (summ g) (sumf p))       (and (sume p) (summ g) (sumf f)))   (getrule1 ok)   =>   (assert (finalvalue (value 0)))   (assert (phase printfinal)))(defrule minusone   (or (and (sume e) (summ f) (sumf p))       (and (sume f) (summ e) (sumf p))       (and (sume e) (summ p) (sumf p))       (and (sume g) (summ g) (sumf p))       (and (sume g) (summ f) (sumf p))       (and (sume f) (summ g) (sumf p))       (and (sume f) (summ f) (sumf p))       (and (sume p) (summ e) (sumf p))       (and (sume p) (summ p) (sumf g)))   (getrule1 ok)   =>   (assert (finalvalue (value -1)))   (assert (phase printfinal)))(defrule minustwo   (or (and (sume g) (summ p) (sumf p))       (and (sume f) (summ p) (sumf p))       (and (sume p) (summ g) (sumf p))       (and (sume p) (summ f) (sumf p))       (and (sume p) (summ p) (sumf f))       (and (sume p) (summ p) (sumf p)))   (getrule1 ok)   =>   (assert (finalvalue (value -2)))   (assert (phase printfinal)))             ;; This last phase of this expert system returns one overall value;; of suitability of the target firm for acquisition based on all;; user inputs.  Each of the user's response belongs to one of three;; factor groups, environmental, managerial, and financial.  In order;; circumvent having to write close to 10,000 rules and to summarize;; the responses in a more manageable chunk of information, only;; the overall values of each of three factor groups were evaluated;; for final overall recommendation based on 10 point scale as ;; decribed before.  Those 10 point scale are repeated as follows.  ;; -2(not suitable at all), -1(feasible but not acceptable), ;; 0(indifferent), 1(feasible but not so attractive), ;; 2(weakly attractive), 3(can be a good target), 4(good target),;; 5(very good target), 6(excellent target), 7(a "dream" target).(defrule printfinal   (phase printfinal)   (finalvalue (value ?finalvalue))   (username (name $?user))   (targetname (name $?target))   =>     (printout t "This last phase of this expert system returns one overall value"crlf)   (printout t "of suitability of the target firm for acquisition based on all"crlf)   (printout t "user inputs.  Each of the user's response belongs to one of three"crlf)   (printout t "factor groups, environmental, managerial, and financial. In order"crlf)   (printout t "circumvent having to write close to 10,000 rules and to summarize"crlf)   (printout t "the responses in a more manageable chunk of information, only"crlf)   (printout t "the overall values of each of three factor groups were evaluated"crlf)   (printout t "for final overall recommendation based on 10 point scale as"crlf)    (printout t "decribed before.  Those 10 point scale are repeated as follows;"crlf)     (printout t "-2(not suitable at all), -1(feasible but not acceptable),"crlf)    (printout t "0(indifferent), 1(feasible but not so attractive),"crlf)    (printout t "2(weakly attractive), 3(can be a good target), 4(good target),"crlf)   (printout t "5(very good target), 6(excellent target), 7(a "dream" target)."crlf)   (printout t "Based on input from the user " $?user "," crlf)   (printout t "the target firm's " $?target " acquisition suitability is"crlf)   (printout t "evaluated by this expert system as "crlf)    (printout t ?finalvalue " on 10 point scale from -2 to 7 (best)."crlf)   (printout t "Would you like to see a detailed explanation"crlf)   (printout t "of the point scale again?"crlf)   (printout t "yes or no? Please enter yes or no."crlf)   (bind ?answer (read))   (if (eq ?answer yes)    then (assert (sayreport explanation)))   (if (eq ?answer no)    then (printout t "You " $?user " have successfully completed"crlf)         (printout t "the evaluation of acquisition suitability of the target firm " $?target "." crlf)         (assert (continue yes-or-no))));; The following rule prints out the explanation of 10 point scale;; again if the user chose to see it again.(defrule reportevaluation   (sayreport explanation)   (username (name $?user))   (targetname (name $?target))   =>   (printout t "-2(not suitable at all), -1(feasible but not acceptable),"crlf)    (printout t "0(indifferent), 1(feasible but not so attractive),"crlf)    (printout t "2(weakly attractive), 3(can be a good target), 4(good target),"crlf)   (printout t "5(very good target), 6(excellent target), 7(a "dream" target)."crlf)   (printout t "You " $?user " have successfully completed"crlf)   (printout t "the evaluation of acquisition suitability of the target firm " $?target "." crlf)   (assert (continue yes-or-no))); The following four rules ask the user to continue assessing the acquisition ; suitability of another target firm and checks for valid response.(defrule ask-continue  (continue yes-or-no)    =>    (printout t "Do you wish to evaluate another target firm?"crlf)    (printout t "The valid choice is yes or no."crlf)    (assert (response (read))));good yes reponse(defrule good-yes-response ?continue <- (continue yes-or-no) ?yesresponse <- (response ?yes&yes)    => (retract ?continue ?yesresponse)       (reset)       (run));good no response(defrule good-no-response ?continue <- (continue yes-or-no) ?noresponse <- (response ?no&no)    => (retract ?continue ?noresponse)    (printout t "You have chosen to end the acquisition suitability evaluation."crlf)    (printout t "Have a nice day." crlf));bad or invalid response to the question to continue the acquisition evaluation."crlf) (defrule bad-response ?continue <- (continue yes-or-no) ?badresponse <- (response ?bad&~yes&~no)    => (retract ?continue ?badresponse)       (printout t "Choose yes or no.  Remember case-sensitivity of clips 6.0."crlf)       (assert (continue yes-or-no)))

⌨️ 快捷键说明

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