亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? wine.clp

?? 介紹ANTLR使用的JAVA程序例子
?? CLP
字號:

;;;======================================================
;;;   Wine Expert Sample Problem
;;;
;;;     WINEX: The WINe EXpert system.
;;;     This example selects an appropriate wine
;;;     to drink with a meal.
;;;
;;;     CLIPS Version 6.0 Example
;;;
;;;     To execute, merely load, reset and run.
;;;======================================================

(defmodule MAIN (export ?ALL))

;;****************
;;* DEFFUNCTIONS *
;;****************

(deffunction MAIN::ask-question (?question ?allowed-values)
   (printout t ?question)
   (bind ?answer (read))
   (if (lexemep ?answer) then (bind ?answer (lowcase ?answer)))
   (while (not (member ?answer ?allowed-values)) do
      (printout t ?question)
      (bind ?answer (read))
      (if (lexemep ?answer) then (bind ?answer (lowcase ?answer))))
   ?answer)

;;*****************
;;* INITIAL STATE *
;;*****************

(deftemplate MAIN::attribute
   (slot name)
   (slot value)
   (slot certainty (default 100.0)))

(defrule MAIN::start
  (declare (salience 10000))
  =>
  (set-fact-duplication TRUE)
  (focus QUESTIONS CHOOSE-QUALITIES WINES PRINT-RESULTS))

(defrule MAIN::combine-certainties ""
  (declare (salience 100)
           (auto-focus TRUE))
  ?rem1 <- (attribute (name ?rel) (value ?val) (certainty ?per1))
  ?rem2 <- (attribute (name ?rel) (value ?val) (certainty ?per2))
  (test (neq ?rem1 ?rem2))
  =>
  (retract ?rem1)
  (modify ?rem2 (certainty (/ (- (* 100 (+ ?per1 ?per2)) (* ?per1 ?per2)) 100))))
  
;;******************
;;* QUESTION RULES *
;;******************

(defmodule QUESTIONS (import MAIN ?ALL) (export ?ALL))

(deftemplate QUESTIONS::question
   (slot attribute (default ?NONE))
   (slot the-question (default ?NONE))
   (multislot valid-answers (default ?NONE))
   (slot already-asked (default FALSE))
   (multislot precursors (default ?DERIVE)))
   
(defrule QUESTIONS::ask-a-question
   ?f <- (question (already-asked FALSE)
                   (precursors)
                   (the-question ?the-question)
                   (attribute ?the-attribute)
                   (valid-answers $?valid-answers))
   =>
   (modify ?f (already-asked TRUE))
   (assert (attribute (name ?the-attribute)
                      (value (ask-question ?the-question ?valid-answers)))))

(defrule QUESTIONS::precursor-is-satisfied
   ?f <- (question (already-asked FALSE)
                   (precursors ?name is ?value $?rest))
         (attribute (name ?name) (value ?value))
   =>
   (if (eq (nth 1 ?rest) and) 
    then (modify ?f (precursors (rest$ ?rest)))
    else (modify ?f (precursors ?rest))))

(defrule QUESTIONS::precursor-is-not-satisfied
   ?f <- (question (already-asked FALSE)
                   (precursors ?name is-not ?value $?rest))
         (attribute (name ?name) (value ~?value))
   =>
   (if (eq (nth 1 ?rest) and) 
    then (modify ?f (precursors (rest$ ?rest)))
    else (modify ?f (precursors ?rest))))

;;*******************
;;* WINEX QUESTIONS *
;;*******************

(defmodule WINE-QUESTIONS (import QUESTIONS ?ALL))

(deffacts WINE-QUESTIONS::question-attributes
  (question (attribute main-component)
            (the-question "Is the main component of the meal meat, fish, or poultry? ")
            (valid-answers meat fish poultry unknown))
  (question (attribute has-turkey)
            (precursors main-component is turkey)
            (the-question "Does the meal have turkey in it? ")
            (valid-answers yes no unknown))
  (question (attribute has-sauce)
            (the-question "Does the meal have a sauce on it? ")
            (valid-answers yes no unknown))
  (question (attribute sauce)
            (precursors has-sauce is yes)
            (the-question "Is the sauce for the meal spicy, sweet, cream, or tomato? ")
            (valid-answers sauce spicy sweet cream tomato unknown))
  (question (attribute tastiness)
            (the-question "Is the flavor of the meal delicate, average, or strong? ")
            (valid-answers delicate average strong unknown))
  (question (attribute preferred-body)
            (the-question "Do you generally prefer light, medium, or full bodied wines? ")
            (valid-answers light medium full unknown))
  (question (attribute preferred-color)
            (the-question "Do you generally prefer red or white wines? ")
            (valid-answers red white unknown))
  (question (attribute preferred-sweetness)
            (the-question "Do you generally prefer dry, medium, or sweet wines? ")
            (valid-answers dry medium sweet unknown))) 
 
;;******************
;; The RULES module
;;******************

(defmodule RULES (import MAIN ?ALL) (export ?ALL))

(deftemplate RULES::rule
  (slot certainty (default 100.0))
  (multislot if)
  (multislot then))

(defrule RULES::throw-away-ands-in-antecedent
  ?f <- (rule (if and $?rest))
  =>
  (modify ?f (if ?rest)))

(defrule RULES::throw-away-ands-in-consequent
  ?f <- (rule (then and $?rest))
  =>
  (modify ?f (then ?rest)))

(defrule RULES::remove-is-condition-when-satisfied
  ?f <- (rule (certainty ?c1) 
              (if ?attribute is ?value $?rest))
  (attribute (name ?attribute) 
             (value ?value) 
             (certainty ?c2))
  =>
  (modify ?f (certainty (min ?c1 ?c2)) (if ?rest)))

(defrule RULES::remove-is-not-condition-when-satisfied
  ?f <- (rule (certainty ?c1) 
              (if ?attribute is-not ?value $?rest))
  (attribute (name ?attribute) (value ~?value) (certainty ?c2))
  =>
  (modify ?f (certainty (min ?c1 ?c2)) (if ?rest)))

(defrule RULES::perform-rule-consequent-with-certainty
  ?f <- (rule (certainty ?c1) 
              (if) 
              (then ?attribute is ?value with certainty ?c2 $?rest))
  =>
  (modify ?f (then ?rest))
  (assert (attribute (name ?attribute) 
                     (value ?value)
                     (certainty (/ (* ?c1 ?c2) 100)))))

(defrule RULES::perform-rule-consequent-without-certainty
  ?f <- (rule (certainty ?c1)
              (if)
              (then ?attribute is ?value $?rest))
  (test (or (eq (length$ ?rest) 0)
            (neq (nth 1 ?rest) with)))
  =>
  (modify ?f (then ?rest))
  (assert (attribute (name ?attribute) (value ?value) (certainty ?c1))))

;;*******************************
;;* CHOOSE WINE QUALITIES RULES *
;;*******************************

(defmodule CHOOSE-QUALITIES (import RULES ?ALL)
                            (import QUESTIONS ?ALL)
                            (import MAIN ?ALL))

(defrule CHOOSE-QUALITIES::startit => (focus RULES))

(deffacts the-wine-rules

  ; Rules for picking the best body

  (rule (if has-sauce is yes and 
            sauce is spicy)
        (then best-body is full))

  (rule (if tastiness is delicate)
        (then best-body is light))

  (rule (if tastiness is average)
        (then best-body is light with certainty 30 and
              best-body is medium with certainty 60 and
              best-body is full with certainty 30))

  (rule (if tastiness is strong)
        (then best-body is medium with certainty 40 and
              best-body is full with certainty 80))

  (rule (if has-sauce is yes and
            sauce is cream)
        (then best-body is medium with certainty 40 and
              best-body is full with certainty 60))

  (rule (if preferred-body is full)
        (then best-body is full with certainty 40))

  (rule (if preferred-body is medium)
        (then best-body is medium with certainty 40))

  (rule (if preferred-body is light) 
        (then best-body is light with certainty 40))

  (rule (if preferred-body is light and
            best-body is full)
        (then best-body is medium))

  (rule (if preferred-body is full and
            best-body is light)
        (then best-body is medium))

  (rule (if preferred-body is unknown) 
        (then best-body is light with certainty 20 and
              best-body is medium with certainty 20 and
              best-body is full with certainty 20))

  ; Rules for picking the best color

  (rule (if main-component is meat)
        (then best-color is red with certainty 90))

  (rule (if main-component is poultry and
            has-turkey is no)
        (then best-color is white with certainty 90 and
              best-color is red with certainty 30))

  (rule (if main-component is poultry and
            has-turkey is yes)
        (then best-color is red with certainty 80 and
              best-color is white with certainty 50))

  (rule (if main-component is fish)
        (then best-color is white))

  (rule (if main-component is-not fish and
            has-sauce is yes and
            sauce is tomato)
        (then best-color is red))

  (rule (if has-sauce is yes and
            sauce is cream)
        (then best-color is white with certainty 40))
                   
  (rule (if preferred-color is red)
        (then best-color is red with certainty 40))

  (rule (if preferred-color is white)
        (then best-color is white with certainty 40))

  (rule (if preferred-color is unknown)
        (then best-color is red with certainty 20 and
              best-color is white with certainty 20))
  
  ; Rules for picking the best sweetness

  (rule (if has-sauce is yes and
            sauce is sweet)
        (then best-sweetness is sweet with certainty 90 and
              best-sweetness is medium with certainty 40))

  (rule (if preferred-sweetness is dry)
        (then best-sweetness is dry with certainty 40))

  (rule (if preferred-sweetness is medium)
        (then best-sweetness is medium with certainty 40))

  (rule (if preferred-sweetness is sweet)
        (then best-sweetness is sweet with certainty 40))

  (rule (if best-sweetness is sweet and
            preferred-sweetness is dry)
        (then best-sweetness is medium))

  (rule (if best-sweetness is dry and
            preferred-sweetness is sweet) 
        (then best-sweetness is medium))

  (rule (if preferred-sweetness is unknown)
        (then best-sweetness is dry with certainty 20 and
              best-sweetness is medium with certainty 20 and
              best-sweetness is sweet with certainty 20))

)

;;************************
;;* WINE SELECTION RULES *
;;************************

(defmodule WINES (import MAIN ?ALL))

(deffacts any-attributes
  (attribute (name best-color) (value any))
  (attribute (name best-body) (value any))
  (attribute (name best-sweetness) (value any)))

(deftemplate WINES::wine
  (slot name (default ?NONE))
  (multislot color (default any))
  (multislot body (default any))
  (multislot sweetness (default any)))

(deffacts WINES::the-wine-list 
  (wine (name Gamay) (color red) (body medium) (sweetness medium sweet))
  (wine (name Chablis) (color white) (body light) (sweetness dry))
  (wine (name Sauvignon-Blanc) (color white) (body medium) (sweetness dry))
  (wine (name Chardonnay) (color white) (body medium full) (sweetness medium dry))
  (wine (name Soave) (color white) (body light) (sweetness medium dry))
  (wine (name Riesling) (color white) (body light medium) (sweetness medium sweet))
  (wine (name Geverztraminer) (color white) (body full))
  (wine (name Chenin-Blanc) (color white) (body light) (sweetness medium sweet))
  (wine (name Valpolicella) (color red) (body light))
  (wine (name Cabernet-Sauvignon) (color red) (sweetness dry medium))
  (wine (name Zinfandel) (color red) (sweetness dry medium))
  (wine (name Pinot-Noir) (color red) (body medium) (sweetness medium))
  (wine (name Burgundy) (color red) (body full))
  (wine (name Zinfandel) (color red) (sweetness dry medium)))
  
(defrule WINES::generate-wines
  (wine (name ?name)
        (color $? ?c $?)
        (body $? ?b $?)
        (sweetness $? ?s $?))
  (attribute (name best-color) (value ?c) (certainty ?certainty-1))
  (attribute (name best-body) (value ?b) (certainty ?certainty-2))
  (attribute (name best-sweetness) (value ?s) (certainty ?certainty-3))
  =>
  (assert (attribute (name wine) (value ?name)
                     (certainty (min ?certainty-1 ?certainty-2 ?certainty-3)))))

;;*****************************
;;* PRINT SELECTED WINE RULES *
;;*****************************

(defmodule PRINT-RESULTS (import MAIN ?ALL))

(defrule PRINT-RESULTS::header ""
   (declare (salience 10))
   =>
   (printout t t)
   (printout t "        SELECTED WINES" t t)
   (printout t " WINE                  CERTAINTY" t)
   (printout t " -------------------------------" t)
   (assert (phase print-wines)))

(defrule PRINT-RESULTS::print-wine ""
  ?rem <- (attribute (name wine) (value ?name) (certainty ?per))		  
  (not (attribute (name wine) (certainty ?per1&:(> ?per1 ?per))))
  =>
  (retract ?rem)
  (format t " %-24s %2d%%%n" ?name ?per))

(defrule PRINT-RESULTS::remove-poor-wine-choices ""
  ?rem <- (attribute (name wine) (certainty ?per&:(< ?per 20)))
  =>
  (retract ?rem))

(defrule PRINT-RESULTS::end-spaces ""
   (not (attribute (name wine)))
   =>
   (printout t t))




?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美私模裸体表演在线观看| 亚洲精品国产无天堂网2021| 精品久久久久久最新网址| 日本韩国欧美在线| 99re免费视频精品全部| 懂色av噜噜一区二区三区av| 国产精品99久| 国产精一区二区三区| 国内外成人在线视频| 国内精品写真在线观看 | 成人午夜视频在线| 国产在线精品视频| 国产精品亚洲视频| 成人高清免费观看| 色婷婷av一区| 欧美日韩一区二区三区免费看| 日本久久一区二区三区| 欧美体内she精高潮| 欧美日韩国产大片| 日韩一级欧美一级| 国产日韩v精品一区二区| 亚洲欧美中日韩| 亚洲国产另类av| 蜜臀av性久久久久蜜臀aⅴ | 91国模大尺度私拍在线视频| 色女孩综合影院| 欧美日韩日日夜夜| 日韩美女一区二区三区四区| 久久综合色一综合色88| 国产亚洲综合av| 亚洲日本丝袜连裤袜办公室| 亚洲国产欧美在线人成| 日本va欧美va精品发布| 国产一区二区不卡在线| 丁香激情综合五月| 日本道在线观看一区二区| 7777精品久久久大香线蕉| 久久久一区二区| 亚洲专区一二三| 美女任你摸久久| 成人综合日日夜夜| 欧美日精品一区视频| 久久综合九色综合久久久精品综合| 国产精品久久久久久久久动漫| 一区二区三区精品在线| 蜜臀av性久久久久蜜臀aⅴ流畅 | 欧美精品久久一区| www国产精品av| 亚洲一区在线观看免费观看电影高清| 日韩一区精品字幕| 93久久精品日日躁夜夜躁欧美| 欧美色电影在线| 久久久99精品免费观看| 一区二区三区高清| 狠狠色综合播放一区二区| 91日韩一区二区三区| 精品国产自在久精品国产| 亚洲色图视频免费播放| 久久se这里有精品| 欧美在线短视频| 国产精品丝袜在线| 日本不卡的三区四区五区| 99久久精品免费| 精品88久久久久88久久久| 一区二区三区不卡视频在线观看| 九九视频精品免费| 欧美私人免费视频| 亚洲欧洲美洲综合色网| 精品亚洲成a人| 精品视频一区 二区 三区| 国产精品免费aⅴ片在线观看| 日韩精品1区2区3区| 日本久久精品电影| 国产精品视频九色porn| 久久机这里只有精品| 欧亚洲嫩模精品一区三区| 亚洲国产高清在线观看视频| 美女一区二区三区在线观看| 欧美视频一区二区在线观看| 日本一区二区免费在线| 久久av资源站| 91精品国产免费久久综合| 一区二区高清免费观看影视大全| 成人美女视频在线观看18| 欧美www视频| 奇米四色…亚洲| 91精品国产入口| 午夜激情一区二区三区| 欧美在线高清视频| 亚洲乱码国产乱码精品精的特点| 国产成人高清视频| 久久精品一区四区| 国产美女一区二区三区| 精品日韩一区二区三区| 天涯成人国产亚洲精品一区av| 色综合久久综合| 最好看的中文字幕久久| av中文字幕亚洲| 成人免费视频在线观看| 成人av电影免费观看| 国产精品午夜电影| 国产不卡免费视频| 欧美激情一区二区在线| 成人av网站免费| 久久久99久久| 成人h精品动漫一区二区三区| 中文字幕国产一区二区| 99国产欧美久久久精品| 中文字幕一区二区在线播放| a在线欧美一区| 亚洲欧美日韩国产综合| 91美女片黄在线观看| 亚洲黄色在线视频| 欧美性猛交xxxxxx富婆| 日韩精品欧美精品| 欧美成人a视频| 国产在线视频不卡二| 国产日韩成人精品| proumb性欧美在线观看| 亚洲少妇最新在线视频| 欧美在线高清视频| 日本怡春院一区二区| 91精品国产福利| 国产在线国偷精品免费看| 欧美韩日一区二区三区| 91丨九色丨尤物| 亚洲福利视频一区二区| 欧美成人一区二区| 国产精品 日产精品 欧美精品| 国产精品久久久久久久久晋中| 色妞www精品视频| 蜜桃视频在线观看一区| 国产三区在线成人av| 91福利视频久久久久| 婷婷丁香久久五月婷婷| 久久久久久99精品| 在线一区二区三区| 男女男精品视频网| 国产精品卡一卡二卡三| 欧美三区在线视频| 国产一区二区毛片| 亚洲裸体在线观看| 欧美一级搡bbbb搡bbbb| 波多野结衣亚洲| 三级欧美韩日大片在线看| 久久久精品2019中文字幕之3| 99精品久久只有精品| 人妖欧美一区二区| 欧美激情在线观看视频免费| 欧美三级中文字| 国产成人在线观看| 午夜一区二区三区视频| 久久久精品国产免大香伊| 在线一区二区三区四区五区| 国产自产视频一区二区三区| 亚洲视频免费观看| 26uuuu精品一区二区| 欧美日韩你懂得| www.欧美日韩国产在线| 免费成人在线网站| 亚洲人成网站精品片在线观看| 日韩免费观看高清完整版在线观看| av在线不卡电影| 经典三级一区二区| 亚洲成人av电影在线| 久久久精品黄色| 91麻豆精品国产91久久久更新时间| 国产很黄免费观看久久| 午夜视频一区二区| 亚洲精品亚洲人成人网 | 日本成人在线视频网站| 国产精品麻豆一区二区| 日韩欧美国产wwwww| 91久久精品一区二区二区| 国产精品一卡二卡在线观看| 偷拍日韩校园综合在线| 亚洲免费高清视频在线| 日本一区二区在线不卡| 欧美zozo另类异族| 91精品国产欧美一区二区18| 欧美在线视频日韩| 91在线丨porny丨国产| 国产精品99久久久久久似苏梦涵| 免费高清成人在线| 天堂va蜜桃一区二区三区| 亚洲欧美成人一区二区三区| 欧美经典三级视频一区二区三区| 日韩午夜av一区| 欧美一区二区三区色| 在线观看日韩国产| 91视频免费播放| av一区二区久久| 成人激情视频网站| 从欧美一区二区三区| 激情av综合网| 国产精品资源网站| 狠狠色综合色综合网络| 国内精品伊人久久久久av影院 | 国产在线精品一区二区| 久久国内精品自在自线400部|