Assignment 5: Prolog and Predicate Logic
CSE 415: Introduction to Artificial Intelligence
The University of Washington, Seattle, Winter 2005
Write a Prolog program that answers queries about class and classroom scheduling, as described below.

Due Tuesday, February 22, at 11:30 AM. A paper submission is due on Wednesday, February 23 in class as well (see Part B).

Turn in your source code by 11:30 using the turnin server.
 

Prolog Queries (100 points)
Create a Prolog program that maintains information about classes, classroom facilities and scheduling. You are handling class and classroom scheduling for the University of Washington. Thankfully, it's a rather large task, so your task will be limited to handling a handful of CSE classes, which all occur at the same time. However, you also get to assign to professors the classes they will teach. There are six rooms you must concern yourself with:
  • EE1 005, an auditorium with huge capacity, a projector, and whiteboards
  • EE1 043, a classroom with large capacity, no projector, and whiteboards
  • EE1 003, a classroom with medium capacity, a projector, and whiteboards
  • MEB 243, a classroom with small capacity, no projector, and chalkboards
  • MGH 044, a computer lab with medium capacity
  • CSE 410, a computer lab with small capacity
Note that all computer labs have projectors and whiteboards as well. Each class needs a professor to teach it. Here are the professors available:
  • Prof. Harpo teaches with slides.
  • Prof. Zeppo doesn't teach with slides, but refuses to use chalkboards.
  • Prof. Groucho is shy and doesn't teach classes of more than small size. He is willing to teach with chalkboards.
  • Prof. Chico is claustrophobic and won't teach in small or medium-sized classrooms.
You will be concerned with the following six CSE classes.
  • Classes CSE 142 and 143 are huge.
  • Classes CSE 373 and 415 are medium-sized. CSE 415 requires a computer lab.
  • Class CSE 574 is small.
Note that no two classes can be assigned to the same room.

Part A. (50 points) Write a Prolog program that describes all of the constraints above as Horn clauses. Your program should have a well-designed structure and provide adequate representation of all the relevant entities and qualities mentioned. Call your program classes.pro.

Part B. (20 points) Write Prolog queries to answer the following questions, and save a transcript of the results in a file called class-queries. Print this file out and hand it in in class the Wednesday after the turnin is due.

  • What professors can teach CSE 415?
  • What classrooms can Prof. Chico teach in?
  • Can CSE 373 be taught in MGH 044?
  • If CSE 373 is taught in MGH 044, can CSE 415 be taught anywhere?
  • What classrooms can CSE 415 be taught in, if any?
  • Who can teach in MEB 243, if anyone?
  • Can CSE 574 be taught in a larger room than the room CSE 415 is taught in?
  • Which professors can teach a medium-sized class in a medium-sized classroom with slides?

Part C. (30 points) Add another course and another interesting/relevant constraint to the above scenario. Write this in another file, myclass.pro. Think of three queries whose results are somehow affected by the presence of this new course and constraint, and perform them as well. Transcribe the results and append them to the results file you created in Part B.

Questions and answers.:

Q: Can a small class be taught in a larger room?

A: Yes. The order of room sizes is small, medium, large, and huge. Classes of size X may be taught in rooms of size X or larger.