Starting from:

$24.99

CSE341 Assignment 2 Solution

Grading: Each homework will be graded on the scale 100. Unless otherwise noted, the questions/parts will be weighed equal.

Part 1. [50pt] In this part of the homework, you are asked to write a simple expert system in Prolog for scheduling of classes. In your expert system, you will have rooms, courses, and people.
• A room has an ID, capacity (how many people it can hold), and operations hours given in one-hour increments from 8am until 5pm. Occupancy information for a room includes the hour and the name of the course taking that hour. A room can also have special equipment such as a projector, a smart board and access for the handicapped.
• A student has an ID, and list of courses she/he attends. A student can also be handicapped.
Your expert system should be able to add a new student, course, or a room to the system. It should respond to queries such as:
• Check whether there is any scheduling conflict.
• Check whether a student can be enrolled to a given class.
Part 2. In the graph below you see the possible flights between some of the cities in Turkey. Write the predicate “connection(X,Y,C) – a route between X and Y exists with cost C” that checks if there is a route between any given two cities.

Add at least two more connections to this graph and build your knowledge base accordingly as described below.
Your Prolog program should have all the facts and predicates/rules. See the following:
% knowledge base
… schedule(istanbul,izmir,2). % fact: Istanbul and Izmir has a flight with cost 2.

% rules … connection (X,Y,C) :- schedule(X,Y,C). % predicate indicating there exist a route
% between X and Y if there is flight between % X and Y with cost C.

A single query to complete your program should check if there is a direct route between two given cities. Alternatively, it can list all the connected cities for a given city. See the following:
?- connection(canakkale,X,C).
X = erzincan, C = 6 ;
X = antalya, C = 9 ;

More products