Artificial

Document Sample

```					                                             IT 327
Artificial Intelligence

Tutorial # 8

Q1 : Expert systems
Given the Knowledge Base (KB) and the Working Memory (WM) of an expert system as shown
below, we wish to deduce the fact W using Forward Chaining. Show clearly all cycles, and in
each cycle circle the rule that is being executed. Use rule order as implied priority when you
have more than one appropriate rule.

KB                                   Cycles

1- IF P and Z Then W

2- IF P Then Q

3- IF Q and P Then R

4- IF R and Q Then T

5- IF Q and T Then Z

6- IF P and R Then Y

WM
P

Q2: Prolog
Consider the following PROLOG database. For each flight we know duration of flight and
distance between airports. Our data is being stored in predicates flight(StartAirport,
DestinationAirport, Duration, Distance).

flight(lju,cdg,2,955).
flight(lju,fco,1,506).
flight(cdg,fco,3,1100).
flight(cdg,jfk,7,5830).
flight(cdg,lax,10,9096).
flight(cdg,sin,12,10712).
flight(jfk,lax,5,3971).
flight(jfk,nrt,6,5486).
flight(lax,nrt,7,6230).
flight(fco,jfk,8,6861).
flight(fco,sin,11,10039).
flight(sin,nrt,11,9857).

a. Define predicate connExists(Start,Destination) that checks whether there is
connection between two airports.
b. Write the query and answer the question: Is there a connection between Singapore (sin)
and Paris CDG (cdg)?
c. Which airports have connections to Singapore?

Q3: Prolog
Given the following PROLOG database:
likes(tasneem, nouf).
likes(tasneem,trains).
likes(Person1,Person2):-hobby(Person1,Hobby),hobby(Person2,Hobby).
hobby(tasneem,trainspotting).
hobby(said,sailing).
hobby(aisha,trainspotting).
hobby(hassan,trainspotting).
hobby(hassan,sailing).

Write and answer the following queries in PROLOG (in each case indicate the facts and rules
used):
a. Does Tasneem like trains?
b. Does Aisha like Tasneem?
c. Does Said like Aisha?
d. Who likes Hassan?
e. What are Nouf’s hobbies?

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 8 posted: 7/17/2012 language: English pages: 2
How are you planning on using Docstoc?