www.ShoppingPodder.com

Leading Computer Shopping,
News and information


Part of the Identityscape.com network...

getxfactor.com jmoodmusic.com smartbusinesschoices.com mintdepot.com lowfaresalways.com evangelicalview.com shoppingpodder.com soproudlywehail.com webnews.ws currenthumor.com

 

 

Need Help
   Shopping Podder - the Best of Computer Postings! Forum Index -> Computer Artificial Intelligence - Shells  
View previous topic :: View next topic  
Author Message
Guest







PostPosted: Tue Apr 08, 2008 8:49 pm    Post subject: Need Help Reply with quote

Here is my Task
American International (AI) is a small airline that currently offers
the
following international flights:

Flight# AI-110 from New York to Rome, stop-over London
Flight# AI-111 from Washington D.C. to Madrid, stop-over none
Flight# AI-112 from New York to Madrid, stop-over London
Flight# AI-113 from New York to Rome, stop-over none
Flight# AI-114 from Chicago to Paris, stop-over none
Flight# AI-115 from New York to Tokyo, stop-over Hong Kong
Flight# AI-116 from Los Angeles to Rome, stop-over New York
Flight# AI-117 from Los Angeles to Hong Kong, stop-over none
Flight# AI-118 from New York to Rome, stop-over Paris
Flight# AI-119 from Seattle to Beijing, stop-over none


(A) Please use Notepad to perform the following tasks:

1. Define a record structure for the flights by writing a
defftemplate.
2. Write the flight information given above using the deffacts
construct.
3. Write necessary rules (defrules) to display Flight# of flights
from New York to Rome that are either non-stop (have no stop-over) or
have a stop-over in Paris. For example:

Flight number ... is a nonstop flight from New York to Rome
Flight number ... is a flight from New York to Rome with
stopover in Paris

(The ellipses in the above example will be replaced with actual
flight numbers when the program is run.)

This is what I did:

; ***** The CLIPS program *****

; American International flight schedule to European destination

; ***** DEFTEMPLATE *****

(deftemplate flight-number (slot flight-number-AI-110)
(slot flight-number-AI-111)
(slot flight-number-AI-112)
(slot flight-number-AI-113)
(slot flight-number-AI-114)
(slot flight-number-AI-115)
(slot flight-number-AI-116)
(slot flight-number-AI-117)
(slot flight-number-AI-118)
(slot flight-number-AI-119))

;; *****DEFFACTS*****

(deffacts flight-number

(flight (number "AI-110") (new york to rome) (stop-over london))
(flight (number "AI-111") (washinton d.c. to madrid) (nonstop))
(flight (number "AI-112") (new york to madrid) (stop-over london))
(flight (number "AI-113") (new york to rome) (nonstop))
(flight (number "AI-114") (chicago to paris) (nonstop))
(flight (number "AI-115") (new york to tokyo) (stop-over hong kong))
(flight (number "AI-116") (los angeles to rome) (stop-over new york))
(flight (number "AI-117") (los angeles to hong kong) (nonstop))
(flight (number "AI-118") (new york to rome) (stop-over paris))
(flight (number "AI-119") (seattle to beijing) (nonstop))

;; *****DEFRULE *****

(defrule flight-number-nonstop
(flight (number ?x) (new york to rome) (nonstop))
=>
(printout t ?x "has the flight number" crlf))
(defrule flight-number-stop-over-paris
(flight (number ?y) (new york to rome) (stop-over paris))
=>
(printout t ?y "has the flight number" crlf))

; *****END OF PROGRAM *****

When I load the above text file into CLIPS, it give me an error, see
the error below and help me to fix this, thansk.
CLIPS Resutl:
CLIPS (V6.22 06/15/04)
CLIPS> (load "C:/Documents and Settings/Rizwan Baig/Desktop/baig.clp")
Defining deftemplate: flight-number
Defining deffacts: Myflightschedule

[EXPRNPSR3] Missing function declaration for number.

ERROR:
(deffacts MAIN::Myflightschedule
(flight (number
Defining defrule: flight-number-nonstop
[PRNTUTIL2] Syntax Error: Check appropriate syntax for defrule.

ERROR:
(defrule MAIN::flight-number-nonstop
(flight (
Defining defrule: flight-number-stop-over-paris
[PRNTUTIL2] Syntax Error: Check appropriate syntax for defrule.

ERROR:
(defrule MAIN::flight-number-stop-over-paris
(flight (
FALSE
CLIPS>
Back to top
Display posts from previous:   
   Shopping Podder - the Best of Computer Postings! Forum Index -> Computer Artificial Intelligence - Shells  
Page 1 of 1
All times are GMT

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum