Last active
November 10, 2015 23:44
-
-
Save justcoding121/3943981 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; ----=========== General Information ===========----- | |
;;; | |
;;; Artificial Intelligence, Spring 2012 | |
;;; Project 2 - Computer Assistant Expert System | |
;;; Authors: Nikolai, | |
;;; Titanium | |
;;; | |
;;; ----=========== System's Description ===========----- | |
;;; | |
;;; This expert system is designed to assist customers | |
;;; who want to chose a computer. It helps them to | |
;;; decide what type (laptop, tablet, smartphone) and | |
;;; model will be better for them based on the customer's | |
;;; preferences and needs. In the end it suggests | |
;;; particular models of the devices, which fit into | |
;;; the customer's requirements. | |
;;; | |
;;; ----================ References ================----- | |
;;; | |
;;; All the information about the devices presented in | |
;;; the expert system was taken from BestBuy.com in | |
;;; April 2012. Functions ask-question and ask-yes-no | |
;;; were partially taken from auto.clp example provided | |
;;; with CLIPS 6.3. | |
;;; | |
;;; ----------------------------------------------------- | |
;;; ----==== Classes ====---- | |
;;; PERSON : A customer to assist. Slots of this class | |
;;; correspond to the customer's preferences | |
;;; and requirements. | |
(defclass PERSON | |
(is-a USER) | |
(role concrete) | |
(slot budget) ;;; low/high | |
(slot purpose) ;;; work/entertainment/communication | |
(slot size) ;;; small/large | |
(slot performance) ;;; low/high | |
(slot apple-fan) ;;; yes/no | |
) | |
;;; DEVICE : Abstract class that represents general | |
;;; characterictics of a device | |
(defclass DEVICE | |
(is-a USER) | |
(role concrete) | |
(slot manufacture) ;;; string | |
(slot model) ;;; string | |
(slot performance) ;;; low/high | |
(slot price) ;;; low/high | |
) | |
;;; LAPTOP : Inherits DEVICE. Represents specific | |
;;; features of a laptop. | |
(defclass LAPTOP | |
(is-a DEVICE) | |
(role concrete) | |
(slot screen-size) ;;; small/large | |
) | |
;;; TABLET : Inherits DEVICE. Represents specific | |
;;; features of a tablet computer. | |
(defclass TABLET | |
(is-a DEVICE) | |
(role concrete) | |
(slot mobile-net) ;;; yes/no | |
(slot battery-life) ;;; short/long | |
(slot screen-size) ;;; small/large | |
) | |
;;; SMARTPHONE :Inherits DEVICE. Represents specific | |
;;; features of a smartphone. | |
(defclass SMARTPHONE | |
(is-a DEVICE) | |
(role concrete) | |
(slot mobile-net) ;;; yes/no | |
(slot battery-life) ;;; short/long | |
) | |
;;; ----------------------------------------------------- | |
;;; ----==== Class Instances ====---- | |
(definstances PERSON-INSTANCES | |
(customer of PERSON) | |
) | |
(definstances LAPTOP-INSTANCES | |
(HP_Envy17 of LAPTOP (manufacture HP)(model Envy17)(performance high)(price high)(screen-size large)) | |
(HP_Envy15 of LAPTOP (manufacture HP)(model Envy15)(performance high)(price high)(screen-size small)) | |
(HP_Pavilion15 of LAPTOP (manufacture HP)(model Pavilion15)(performance low)(price low)(screen-size small)) | |
(HP_Pavilion17 of LAPTOP (manufacture HP)(model Pavilion17)(performance high)(price low)(screen-size large)) | |
(HP_Pavilion17_Grey of LAPTOP (manufacture HP)(model Pavilion17_Grey)(performance low)(price low)(screen-size large)) | |
(Acer_Aspire17 of LAPTOP (manufacture Acer)(model Aspire17)(performance high)(price high)(screen-size large)) | |
(Acer_TravelMate of LAPTOP (manufacture Acer)(model TravelMate)(performance low)(price high)(screen-size large)) | |
(Acer_Aspire of LAPTOP (manufacture Acer)(model Aspire)(performance low)(price low)(screen-size small)) | |
(Lenova_idea of LAPTOP (manufacture Lenova)(model idea)(performance low)(price low)(screen-size small)) | |
(Apple_Macbook_pro of LAPTOP (manufacture Apple)(model Macbook_pro)(performance high)(price high)(screen-size small)) | |
(Acer_Aspire_Netbook of LAPTOP (manufacture Acer)(model Aspire_Netbook)(performance low)(price low)(screen-size small)) | |
(Samsung_Chromebook of LAPTOP (manufacture Samsung)(model Chromebook)(performance high)(price low)(screen-size small)) | |
(Dell_Inspiron_Netbook_Mini of LAPTOP (manufacture Dell)(model Netbook_Mini)(performance high)(price low)(screen-size small)) | |
) | |
(definstances TABLET-INSTANCES | |
(Apple_iPad3_WiFi of TABLET (manufacture Apple)(model iPad3_WiFi)(performance high)(price high)(mobile-net Yes)(battery-life long)(screen-size large)) | |
(Apple_iPad2_WiFi of TABLET (manufacture Apple)(model iPad2_WiFi)(performance high)(price low)(mobile-net Yes)(battery-life long)(screen-size large)) | |
(Apple_iPad3 of TABLET (manufacture Apple)(model iPad3)(performance high)(price high)(mobile-net Yes)(battery-life long)(screen-size large)) | |
(Samsung_Galaxy_7.0 of TABLET (manufacture Samsung)(model Galaxy_7.0)(performance low)(mobile-net No)(battery-life short)(price low)(screen-size small)) | |
(Samsung_Galaxy_7.7 of TABLET (manufacture Samsung)(model Galaxy_7.7)(performance low)(price low)(mobile-net Yes)(battery-life long)(screen-size small)) | |
(Samsung_Galaxy_8.9 of TABLET (manufacture Samsung)(model Galaxy_8.9)(performance low)(price high)(mobile-net Yes)(battery-life long)(screen-size small)) | |
(Samsung_Galaxy_10.1 of TABLET (manufacture Samsung)(model Galaxy_10.1)(performance high)(price high)(mobile-net Yes)(battery-life long)(screen-size large)) | |
(Dell_Latitude of TABLET (manufacture Dell)(model Latitude)(performance high)(price high)(mobile-net Yes)(battery-life long)(screen-size large)) | |
(Panasonic_Toughbook of TABLET (manufacture Panasonic)(model Toughbook)(performance high)(price high)(mobile-net Yes)(battery-life short)(screen-size large)) | |
) | |
(definstances SMARTPHONE-INSTANCES | |
(Apple_iPhone4S of SMARTPHONE (manufacture Apple)(model iPhone4S)(performance high)(price high)(mobile-net Yes)(battery-life long)) | |
(Apple_iPhone4 of SMARTPHONE (manufacture Apple)(model iPhone4)(performance low)(price high)(mobile-net Yes)(battery-life long)) | |
(Samsung_GalaxyS2 of SMARTPHONE (manufacture Samsung)(model GalaxyS2)(performance low)(price high)(mobile-net Yes)(battery-life long)) | |
(Samsung_GalaxyNexus of SMARTPHONE (manufacture Samsung)(model GalaxyNexus)(performance high)(price high)(mobile-net Yes)(battery-life long)) | |
(HTC_Inspire of SMARTPHONE (manufacture HTC)(model Inspire)(performance high)(price high)(mobile-net Yes)(battery-life long)) | |
(HTC_Wildfire of SMARTPHONE (manufacture HTC)(model Wildfire)(performance low)(price low)(mobile-net Yes)(battery-life long)) | |
(LG_OptimusV of SMARTPHONE (manufacture LG)(model OptimusV)(performance low)(price low)(mobile-net Yes)(battery-life long)) | |
(LG_MarqueeLS855 of SMARTPHONE (manufacture LG)(model MarqueeLS855)(performance high)(price high)(mobile-net No)(battery-life long)) | |
(Motorola_DROIDRAZR4G of SMARTPHONE (manufacture Motorola)(model DROIDRAZR4G)(performance high)(price high)(mobile-net Yes)(battery-life long)) | |
(Motorola_Flipout of SMARTPHONE (manufacture Motorola)(model Flipout)(performance low)(price high)(mobile-net Yes)(battery-life long)) | |
) | |
;;; ----------------------------------------------------- | |
;;; ----==== Functions ====---- | |
;;; ask-question : Ask a question the requires string | |
;;; as an answer. | |
;;; | |
;;; --== Parameters: ==-- | |
;;; question : Question to ask | |
;;; allowed-answers : Possible answers | |
(deffunction ask-question (?question $?allowed-answers) | |
(printout t ?question) | |
(bind ?answer (read)) | |
(if (lexemep ?answer) | |
then (bind ?answer (lowcase ?answer))) | |
(while (not (member ?answer ?allowed-answers)) do | |
(printout t ?question) | |
(bind ?answer (read)) | |
(if (lexemep ?answer) | |
then (bind ?answer (lowcase ?answer)))) | |
?answer) | |
;;; ask-yes-no : Ask a question the can be answered | |
;;; only yes or no. | |
;;; | |
;;; --== Parameters: ==-- | |
;;; question : Question to ask | |
(deffunction ask-yes-no (?question) | |
(bind ?answer (ask-question ?question yes no y n)) | |
(if (or (eq ?answer yes) (eq ?answer y)) | |
then TRUE | |
else FALSE)) | |
;;; ----------------------------------------------------- | |
;;; ----==== Rules for Asking Questions ====---- | |
;;; input-budget : Ask how much money the customer is | |
;;; willing to spend on a computer. | |
;;; Ask are you an apple fan is your budget | |
;;; is high. | |
;;; | |
;;; --== Values: ==-- | |
;;; low : < 1000 | |
;;; high : > 1000 | |
;;; | |
;;; --== Rules: ==-- | |
;;; budget = low -> apple-fan = no | |
(defrule input-budget | |
=> | |
(printout t "----============== Welcome! ==============----" crlf) | |
(printout t "| |" crlf) | |
(printout t "| Welcome to Computer Assistant! |" crlf) | |
(printout t "| This expert system will help you to choose |" crlf) | |
(printout t "| a device (laptop, tablet or smartphone) |" crlf) | |
(printout t "| based on your preferences and needs. |" crlf) | |
(printout t "| |" crlf) | |
(printout t "----------------------------------------------" crlf crlf crlf) | |
(printout t "How much are you willing to spend on this purchase? : "); | |
(bind ?budget (read)) | |
(if (<= ?budget 1000) | |
then | |
(send [customer] put-budget low) | |
(send [customer] put-apple-fan no) | |
else | |
(send [customer] put-budget high) | |
(if (ask-yes-no "Are you an Apple fan (yes/no)? ") | |
then | |
(send [customer] put-apple-fan yes) | |
else | |
(send [customer] put-apple-fan no) | |
) ;; end if | |
) ;; end if | |
) | |
;;; input-purpose : Ask what is the main purpose for | |
;;; bying a device. Asks question about | |
;;; the preffered size and required performance | |
;;; based on your purpose. | |
;;; | |
;;; --== Values: ==-- | |
;;; work : | |
;;; entertainment : | |
;;; communication : | |
;;; other : | |
;;; | |
;;; --== Influence: ==-- | |
;;; work -> performance = high | |
;;; entertainment -> size = large | |
(defrule input-purpose | |
=> | |
(bind ?purpose | |
(ask-question "How do you plan to use this device? (work/entertainment/communication) : " work entertainment communication)) | |
(if (eq ?purpose work) | |
then | |
(send [customer] put-purpose work) | |
(send [customer] put-performance high) | |
(if (ask-yes-no "Do you want a compact device (yes/no)? ") | |
then | |
(send [customer] put-size small) | |
else | |
(send [customer] put-size large) | |
) ;; end if | |
) ;; end if | |
(if (eq ?purpose entertainment) | |
then | |
(send [customer] put-purpose entertainment) | |
(if (ask-yes-no "Are you OK with average or low performance of your device (yes/no)? ") | |
then | |
(send [customer] put-performance low) | |
else | |
(send [customer] put-performance high) | |
) ;; end if | |
(send [customer] put-size large) | |
) ;; end if | |
(if (eq ?purpose communication) | |
then | |
(send [customer] put-purpose communication) | |
(if (ask-yes-no "Are you OK with average or low performance of your device (yes/no)? ") | |
then | |
(send [customer] put-performance low) | |
else | |
(send [customer] put-performance high) | |
) ;; end if | |
(if (ask-yes-no "Do you want a compact device (yes/no)? ") | |
then | |
(send [customer] put-size small) | |
else | |
(send [customer] put-size large) | |
) ;; end if | |
) ;; end if | |
(if (eq ?purpose other) | |
then | |
(send [customer] put-purpose other) | |
(if (ask-yes-no "Are you OK with average or low performance of your device (yes/no)? ") | |
then | |
(send [customer] put-performance low) | |
else | |
(send [customer] put-performance high) | |
) ;; end if | |
(if (ask-yes-no "Do you want a compact device (yes/no)? ") | |
then | |
(send [customer] put-size small) | |
else | |
(send [customer] put-size large) | |
) ;; end if | |
) ;; end if | |
) | |
;;; ----------------------------------------------------- | |
;;; ----==== Rules for Defining Output ====---- | |
;;; | |
;;; There are 23 rules that determine what device better | |
;;; fits into the defined parameters. Rules section | |
;;; describes the knowledge we used. | |
;;; | |
;;; What parameters mean: | |
;;; | |
;;; High budget => does not care about money | |
;;; Low performance => does not care about performance | |
;;; Not an Apple fan => does not care about the manufacture | |
;;; | |
;;; --== Rules: ==-- | |
;;; | |
;;; How the type of device is determined: | |
;;; | |
;;; purpose : communication -> smartphone, tablet | |
;;; | |
;;; purpose : work -> laptop, tablet | |
;;; | |
;;; purpose : entertainment + | |
;;; performance : high -> laptop | |
;;; | |
;;; purpose : entertainment + | |
;;; performance : low -> laptop, tablet | |
;;; | |
;;; size : large -> tablet, laptop | |
;;; | |
;;; How the parameters are determined: | |
;;; | |
;;; purpose : work -> battery-life = long | |
;;; | |
;;; purpose : work -> performance = high | |
;;; | |
;;; purpose : entertainment -> size = large | |
;;; | |
;;; purpose : communication -> battery = long | |
;;; | |
;;; purpose : communication + | |
;;; budget : high -> mobile-net = yes | |
;;; | |
;;; apple-fan : yes -> manufacture = Apple | |
;;; | |
;;; Other facts are also used to determine the best suited | |
;;; device in perticular cases. Such usage of knowledge | |
;;; reduces the number of rules from 48 (every combination | |
;;; of parameters) to 23. | |
(defrule output-1 | |
?person <- (object (is-a PERSON) | |
(budget high) | |
(purpose work) | |
(size large) | |
(performance high) | |
(apple-fan no) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture $?laptop_manufacture) | |
(model $?laptop_model) | |
(performance high) | |
(price $?laptop_price) | |
(screen-size $?laptop_screen-size) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : " ?laptop_manufacture " " ?laptop_model) | |
(printout t crlf "Performance: High ") | |
(printout t crlf "Screen size: " ?laptop_screen-size) | |
(printout t crlf "Price : " ?laptop_price) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-2 | |
?person <- (object (is-a PERSON) | |
(purpose work) | |
(size small) | |
(apple-fan yes) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture Apple) | |
(model $?tablet_model) | |
(performance high) | |
(price $?tablet_price) | |
(mobile-net Yes) | |
(battery-life long) | |
(screen-size $?tablet_screen-size) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : Apple " ?tablet_model) | |
(printout t crlf "Performance : High ") | |
(printout t crlf "Price : " ?tablet_price) | |
(printout t crlf "Screen size : " ?tablet_screen-size) | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: Long") | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-3 | |
?person <- (object (is-a PERSON) | |
(purpose work) | |
(size large) | |
(apple-fan yes) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture Apple) | |
(model $?laptop_model) | |
(performance high) | |
(price $?laptop_price) | |
(screen-size $?laptop_screen-size) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : Apple " ?laptop_model) | |
(printout t crlf "Performance : High ") | |
(printout t crlf "Screen size : " ?laptop_screen-size) | |
(printout t crlf "Price : " ?laptop_price) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-4 | |
?person <- (object (is-a PERSON) | |
(purpose work) | |
(size small) | |
(budget low) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture $?laptop_manufacture) | |
(model $?laptop_model) | |
(performance high) | |
(price low) | |
(screen-size $?laptop_screen-size) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture $?tablet_manufacture) | |
(model $?tablet_model) | |
(performance high) | |
(price low) | |
(mobile-net Yes) | |
(battery-life long) | |
(screen-size $?tablet_screen-size) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : " ?laptop_manufacture " " ?laptop_model) | |
(printout t crlf "Performance: High ") | |
(printout t crlf "Screen size: " ?laptop_screen-size) | |
(printout t crlf "Price : Low") | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : " ?tablet_manufacture " " ?tablet_model) | |
(printout t crlf "Performance : High ") | |
(printout t crlf "Price : Low") | |
(printout t crlf "Screen size : " ?tablet_screen-size) | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: Long") | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-5 | |
?person <- (object (is-a PERSON) | |
(purpose work) | |
(size large) | |
(budget low) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture $?laptop_manufacture) | |
(model $?laptop_model) | |
(performance high) | |
(price low) | |
(screen-size $?laptop_screen-size) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : " ?laptop_manufacture " " ?laptop_model) | |
(printout t crlf "Performance : High ") | |
(printout t crlf "Screen size : " ?laptop_screen-size) | |
(printout t crlf "Price : Low") | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-6 | |
?person <- (object (is-a PERSON) | |
(purpose work) | |
(size small) | |
(budget high) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture $?laptop_manufacture) | |
(model $?laptop_model) | |
(performance high) | |
(price $?laptop_price) | |
(screen-size small) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture $?tablet_manufacture) | |
(model $?tablet_model) | |
(performance high) | |
(price $?tablet_price) | |
(mobile-net Yes) | |
(battery-life long) | |
(screen-size $?tablet_screen-size) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : " ?laptop_manufacture " " ?laptop_model) | |
(printout t crlf "Performance: High ") | |
(printout t crlf "Price : "?laptop_price) | |
(printout t crlf "Screen-size: Small") | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : " ?tablet_manufacture " " ?tablet_model) | |
(printout t crlf "Performance : High ") | |
(printout t crlf "Price : " ?tablet_price) | |
(printout t crlf "Screen size : " ?tablet_screen-size) | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: Long") | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-7 | |
?person <- (object (is-a PERSON) | |
(purpose work) | |
(size large) | |
(budget high) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture $?laptop_manufacture) | |
(model $?laptop_model) | |
(performance high) | |
(price $?laptop_price) | |
(screen-size $?laptop_screen-size) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : " ?laptop_manufacture " " ?laptop_model) | |
(printout t crlf "Performance : high ") | |
(printout t crlf "Price : " ?laptop_price) | |
(printout t crlf "Screen-size : " ?laptop_screen-size) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-8 | |
?person <- (object (is-a PERSON) | |
(purpose entertainment) | |
(apple-fan yes) | |
(performance high) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture Apple) | |
(model $?laptop_model) | |
(performance high) | |
(screen-size large) | |
(price $?laptop_price) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : Apple " ?laptop_model) | |
(printout t crlf "Performance : High") | |
(printout t crlf "Price : " ?laptop_price) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-9 | |
?person <- (object (is-a PERSON) | |
(purpose entertainment) | |
(apple-fan yes) | |
(performance low) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture Apple) | |
(model $?laptop_model) | |
(performance $?laptop_performance) | |
(price $?laptop_price) | |
(screen-size $?laptop_screen-size) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture Apple) | |
(model $?tablet_model) | |
(performance $?tablet_performance) | |
(price $?tablet_price) | |
(mobile-net $?tablet_mobile-net) | |
(battery-life $?tablet_battery-life) | |
(screen-size large) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : Apple " ?laptop_model) | |
(printout t crlf "Performance: " ?laptop_performance) | |
(printout t crlf "Price : " ?laptop_price) | |
(printout t crlf "Screen-size: " ?laptop_screen-size) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : Apple " ?tablet_model) | |
(printout t crlf "Performance : " ?tablet_performance) | |
(printout t crlf "Price : " ?tablet_price) | |
(printout t crlf "Screen size : Large") | |
(printout t crlf "Mobile net : " ?tablet_mobile-net) | |
(printout t crlf "Battery life: " ?tablet_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-10 | |
?person <- (object (is-a PERSON) | |
(purpose entertainment) | |
(apple-fan no) | |
(performance high) | |
(budget low) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture $?laptop_manufacture) | |
(model $?laptop_model) | |
(performance high) | |
(price $?laptop_price) | |
(screen-size $?laptop_screen-size) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : " ?laptop_manufacture " " ?laptop_model) | |
(printout t crlf "Performance: High") | |
(printout t crlf "Price : " ?laptop_price) | |
(printout t crlf "Screen-size: " ?laptop_screen-size) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-11 | |
?person <- (object (is-a PERSON) | |
(purpose entertainment) | |
(apple-fan no) | |
(performance high) | |
(budget high) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture $?laptop_manufacture) | |
(model $?laptop_model) | |
(performance high) | |
(price $?laptop_price) | |
(screen-size large) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : " ?laptop_manufacture " " ?laptop_model) | |
(printout t crlf "Performance: High") | |
(printout t crlf "Price : " ?laptop_price) | |
(printout t crlf "Screen-size: Large") | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-12 | |
?person <- (object (is-a PERSON) | |
(purpose entertainment) | |
(apple-fan no) | |
(performance low) | |
(budget low) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture $?laptop_manufacture) | |
(model $?laptop_model) | |
(performance $?laptop_performance) | |
(price low) | |
(screen-size $?laptop_screen-size) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture $?tablet_manufacture) | |
(model $?tablet_model) | |
(performance $?tablet_performance) | |
(price low) | |
(mobile-net $?tablet_mobile-net) | |
(battery-life $?tablet_battery-life) | |
(screen-size large) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : " ?laptop_manufacture " " ?laptop_model) | |
(printout t crlf "Performance: " ?laptop_performance) | |
(printout t crlf "Price : Low") | |
(printout t crlf "Screen-size: " ?laptop_screen-size) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : " ?tablet_manufacture " " ?tablet_model) | |
(printout t crlf "Performance : " ?tablet_performance) | |
(printout t crlf "Price : Low") | |
(printout t crlf "Screen size : Large") | |
(printout t crlf "Mobile net : " ?tablet_mobile-net) | |
(printout t crlf "Battery life: " ?tablet_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-13 | |
?person <- (object (is-a PERSON) | |
(purpose entertainment) | |
(apple-fan no) | |
(performance low) | |
(budget high) | |
) | |
?laptop <- (object (is-a LAPTOP) | |
(manufacture $?laptop_manufacture) | |
(model $?laptop_model) | |
(performance $?laptop_performance) | |
(price $?laptop_price) | |
(screen-size $?laptop_screen-size) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture $?tablet_manufacture) | |
(model $?tablet_model) | |
(performance $?tablet_performance) | |
(price $?tablet_price) | |
(mobile-net Yes) | |
(battery-life $?tablet_battery-life) | |
(screen-size large) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Laptop : " ?laptop_manufacture " " ?laptop_model) | |
(printout t crlf "Performance: " ?laptop_performance) | |
(printout t crlf "Price : " ?laptop_price) | |
(printout t crlf "Screen-size: " ?laptop_screen-size) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : " ?tablet_manufacture " " ?tablet_model) | |
(printout t crlf "Performance : " ?tablet_performance) | |
(printout t crlf "Price : " ?tablet_price) | |
(printout t crlf "Screen size : Large") | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: " ?tablet_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-14 | |
?person <- (object (is-a PERSON) | |
(purpose communication) | |
(size small) | |
(apple-fan yes) | |
) | |
?smartphone <- (object (is-a SMARTPHONE) | |
(manufacture Apple) | |
(model $?smartphone_model) | |
(performance $?smartphone_performance) | |
(price $?smartphone_price) | |
(mobile-net $?smartphone_mobile-net) | |
(battery-life $?smartphone_battery-life) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Smartphone : Apple " ?smartphone_model) | |
(printout t crlf "Performance : " ?smartphone_performance) | |
(printout t crlf "Price : " ?smartphone_price) | |
(printout t crlf "Mobile net : " ?smartphone_mobile-net) | |
(printout t crlf "Battery life: " ?smartphone_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-15 | |
?person <- (object (is-a PERSON) | |
(purpose communication) | |
(size large) | |
(apple-fan yes) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture Apple) | |
(model $?tablet_model) | |
(performance $?tablet_performance) | |
(price $?tablet_price) | |
(mobile-net Yes) | |
(battery-life $?tablet_battery-life) | |
(screen-size $?tablet_screen-size) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : Apple " ?tablet_model) | |
(printout t crlf "Performance : " ?tablet_performance) | |
(printout t crlf "Price : " ?tablet_price) | |
(printout t crlf "Screen size : " ?tablet_screen-size) | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: " ?tablet_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-16 | |
?person <- (object (is-a PERSON) | |
(purpose communication) | |
(size small) | |
(apple-fan no) | |
(performance high) | |
(budget low) | |
) | |
?smartphone <- (object (is-a SMARTPHONE) | |
(manufacture $?smartphone_manufacture) | |
(model $?smartphone_model) | |
(performance high) | |
(price low) | |
(mobile-net $?smartphone_mobile-net) | |
(battery-life $?smartphone_battery-life) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Smartphone : " ?smartphone_manufacture " "?smartphone_model) | |
(printout t crlf "Performance : High) | |
(printout t crlf "Price : Low) | |
(printout t crlf "Mobile net : " ?smartphone_mobile-net) | |
(printout t crlf "Battery life: " ?smartphone_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-17 | |
?person <- (object (is-a PERSON) | |
(purpose communication) | |
(size small) | |
(apple-fan no) | |
(performance high) | |
(budget high) | |
) | |
?smartphone <- (object (is-a SMARTPHONE) | |
(manufacture $?smartphone_manufacture) | |
(model $?smartphone_model) | |
(performance high) | |
(price $?smartphone_price) | |
(mobile-net Yes) | |
(battery-life $?smartphone_battery-life) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Smartphone : " ?smartphone_manufacture " " ?smartphone_model) | |
(printout t crlf "Performance : High") | |
(printout t crlf "Price : " ?smartphone_price) | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: " ?smartphone_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-18 | |
?person <- (object (is-a PERSON) | |
(purpose communication) | |
(size small) | |
(apple-fan no) | |
(performance low) | |
(budget low) | |
) | |
?smartphone <- (object (is-a SMARTPHONE) | |
(manufacture $?smartphone_manufacture) | |
(model $?smartphone_model) | |
(performance $?smartphone_performance) | |
(price low) | |
(mobile-net $?smartphone_mobile-net) | |
(battery-life $?smartphone_battery-life) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Smartphone : " ?smartphone_manufacture " " ?smartphone_model) | |
(printout t crlf "Performance : " ?smartphone_performance) | |
(printout t crlf "Price : Low") | |
(printout t crlf "Mobile net : " ?smartphone_mobile-net) | |
(printout t crlf "Battery life: " ?smartphone_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-19 | |
?person <- (object (is-a PERSON) | |
(purpose communication) | |
(size small) | |
(apple-fan no) | |
(performance low) | |
(budget high) | |
) | |
?smartphone <- (object (is-a SMARTPHONE) | |
(manufacture $?smartphone_manufacture) | |
(model $?smartphone_model) | |
(performance $?smartphone_performance) | |
(price $?smartphone_price) | |
(mobile-net Yes) | |
(battery-life $?smartphone_battery-life) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Smartphone : " ?smartphone_manufacture " " ?smartphone_model) | |
(printout t crlf "Performance : " ?smartphone_performance) | |
(printout t crlf "Price : " ?smartphone_price) | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: " ?smartphone_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-20 | |
?person <- (object (is-a PERSON) | |
(purpose communication) | |
(size large) | |
(apple-fan no) | |
(performance high) | |
(budget low) | |
) | |
?smartphone <- (object (is-a SMARTPHONE) | |
(manufacture $?smartphone_manufacture) | |
(model $?smartphone_model) | |
(performance high) | |
(price low) | |
(mobile-net $?smartphone_mobile-net) | |
(battery-life $?smartphone_battery-life) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture $?tablet_manufacture) | |
(model $?tablet_model) | |
(performance high) | |
(price low) | |
(mobile-net $?tablet_mobile-net) | |
(battery-life $?tablet_battery-life) | |
(screen-size small) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Smartphone : " ?smartphone_manufacture " " ?smartphone_model) | |
(printout t crlf "Performance : High") | |
(printout t crlf "Price : Low") | |
(printout t crlf "Mobile net : " ?smartphone_mobile-net) | |
(printout t crlf "Battery life: " ?smartphone_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : " ?tablet_manufacture " " ?tablet_model) | |
(printout t crlf "Performance : High") | |
(printout t crlf "Price : Low") | |
(printout t crlf "Screen size : Small") | |
(printout t crlf "Mobile net : " ?tablet_mobile-net) | |
(printout t crlf "Battery life: " ?tablet_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-21 | |
?person <- (object (is-a PERSON) | |
(purpose communication) | |
(size large) | |
(apple-fan no) | |
(performance high) | |
(budget high) | |
) | |
?smartphone <- (object (is-a SMARTPHONE) | |
(manufacture $?smartphone_manufacture) | |
(model $?smartphone_model) | |
(performance high) | |
(price $?smartphone_price) | |
(mobile-net Yes) | |
(battery-life $?smartphone_battery-life) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture $?tablet_manufacture) | |
(model $?tablet_model) | |
(performance high) | |
(price $?tablet_price) | |
(mobile-net Yes) | |
(battery-life $?tablet_battery-life) | |
(screen-size small) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Smartphone : " ?smartphone_manufacture " " ?smartphone_model) | |
(printout t crlf "Performance : High") | |
(printout t crlf "Price : " ?smartphone_price) | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: " ?smartphone_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : " ?tablet_manufacture " " ?tablet_model) | |
(printout t crlf "Performance : High") | |
(printout t crlf "Price : " ?tablet_price) | |
(printout t crlf "Screen size : Small") | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: " ?tablet_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-22 | |
?person <- (object (is-a PERSON) | |
(purpose communication) | |
(size large) | |
(apple-fan no) | |
(performance low) | |
(budget low) | |
) | |
?smartphone <- (object (is-a SMARTPHONE) | |
(manufacture $?smartphone_manufacture) | |
(model $?smartphone_model) | |
(performance $?smartphone_performance) | |
(price low) | |
(mobile-net $?smartphone_mobile-net) | |
(battery-life $?smartphone_battery-life) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture $?tablet_manufacture) | |
(model $?tablet_model) | |
(performance $?tablet_performance) | |
(price low) | |
(mobile-net $?tablet_mobile-net) | |
(battery-life $?tablet_battery-life) | |
(screen-size small) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Smartphone : " ?smartphone_manufacture " " ?smartphone_model) | |
(printout t crlf "Performance : " ?smartphone_performance) | |
(printout t crlf "Price : Low") | |
(printout t crlf "Mobile net : " ?smartphone_mobile-net) | |
(printout t crlf "Battery life: " ?smartphone_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : " ?tablet_manufacture " " ?tablet_model) | |
(printout t crlf "Performance : "?tablet_performance) | |
(printout t crlf "Price : Low") | |
(printout t crlf "Screen size : Small") | |
(printout t crlf "Mobile net : " ?tablet_mobile-net) | |
(printout t crlf "Battery life: " ?tablet_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) | |
(defrule output-23 | |
?person <- (object (is-a PERSON) | |
(purpose communication) | |
(size large) | |
(apple-fan no) | |
(performance low) | |
(budget high) | |
) | |
?smartphone <- (object (is-a SMARTPHONE) | |
(manufacture $?smartphone_manufacture) | |
(model $?smartphone_model) | |
(performance $?smartphone_performance) | |
(price $?smartphone_price) | |
(mobile-net Yes) | |
(battery-life $?smartphone_battery-life) | |
) | |
?tablet <- (object (is-a TABLET) | |
(manufacture $?tablet_manufacture) | |
(model $?tablet_model) | |
(performance $?tablet_performance) | |
(price $?tablet_price) | |
(mobile-net Yes) | |
(battery-life $?tablet_battery-life) | |
(screen-size small) | |
) | |
=> | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Smartphone : " ?smartphone_manufacture " " ?smartphone_model) | |
(printout t crlf "Performance : " ?smartphone_performance) | |
(printout t crlf "Price : " ?smartphone_price) | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: " ?smartphone_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
(printout t crlf "----============== Recommendation ==============----" ) | |
(printout t crlf) | |
(printout t crlf "You should consider buying:" ) | |
(printout t crlf "Tablet : " ?tablet_manufacture " " ?tablet_model) | |
(printout t crlf "Performance : " ?tablet_performance) | |
(printout t crlf "Price : " ?tablet_price) | |
(printout t crlf "Screen size : Small") | |
(printout t crlf "Mobile net : Yes") | |
(printout t crlf "Battery life: "?tablet_battery-life) | |
(printout t crlf) | |
(printout t crlf "----------------------------------------------------" crlf) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was wondering if there is a way I can get in touch with you on a few questions with your web proxy?