Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CMPT 317

Winter 20223

Introduction to Artificial Intelligence

Assignment 4

Constraint Satisfaction Problems

Date Due: Thursday February 16, 5:00pm

Total Marks: 10

General Instructions

This assignment is individual work. You may discuss questions and problems with anyone, but the work you hand in for this assignment must be your own work.

•  If you intend to use resources not supplied by the instructor, please request permission prior to starting. You should not use any resource that substantially evades the learning objectives for this assignment. You must provide an attribution for any external resource (library, API, etc) you use. If there’s any doubt, ask! No harm can come from asking, even if the answer is no.

•  Each question indicates what the learning objective is, what to hand in, and how you’ll be evalu- ated.

Do not submit folders, or zip files, even if you think it will help.

• Assignments must be submitted to Canvas.

The Robot University problem

The Robot Insitute of Technology (RIT) has recently begun accepting robot students, and the evil robot mas- ters from the Mega Man series have signed up to upgrade their skills. To accommodate the new students, RIT needs to update its final exam schedule.

The exam schedule is spread out over a given number of days. RIT has enough rooms that any number of exams can be on the same day. However, no student is allowed to have two exams on the same day. The goal is to schedule a day for each exam such that no student has more than one exam on each day.

Data Files

You will be given a series of data files representing Robot University problems. Each file represents a single problem. The following is an example of such a file:

2

DrLight Magnetman Shadowman Sparkman

DrWily Metalman Bubbleman Airman Heatman

DrCossack Metalman Quickman Snakeman

The 2 on line 1 specifies the number of days in the exam period.  Each subsequent line specifies the class roster for a single class. The first name on the roster is always the name of the instructor, and for simplicity, we may assume that each instructor is only teaching one class.

Question 1 (5 points):

Purpose: To formalize a problem description a CSP

AIMA Chapter(s): 6.1

By hand, without using any program, formalize the instance of the Robot University problem that is found in term1 .txt. This means that you must describe all of the following:

1.  List all Variables in the problem

2.  List the Domains of each variable

3. Give an example of assigning a value to a variable using your specification and explain what that assignment would mean with regard to the problem

4.  List all constraints for the problem, using the explicit tuple format

•  i.e. for each constraint:

•  List which variables are involved in the constraint

• Show the set-of-tuples of allowed values for those variables

Since the constraints in this problem are quite simple and can be summarized using a well-known math- ematical operator, listing the set of allowed tuples will likely seem quite tedious. Too bad. Do it anyway.

What to Hand In

• Your CSP specification for term1 .txt in a file called a4q1 .pdf (or .txt)

Evaluation

• 1 mark for listing variables

• 1 mark for describing domains

• 1 mark for a variable assignment example

• 2 marks for describing and fully enumerating the constraints

Question 2 (5 points):

Purpose: To automate the formalization of CSPs

AIMA Chapter(s): 6.1                                                                                                                                        Describing a CSP by hand, especially when using the fully general explicit tuple format for the constraints, can be a bit tedious.

Thus, your task for this question is to write a program that can read a Robot University problems from file, and automatically output the matching CSP formalization.  Essentially, this is simply automating the process that you did by hand for the previous question.

Run your program on all of the provided Robot University problems to make sure it works. But you do not need to hand in any of this output.

What to Hand In

• Your code for reading problems from file and outputting the formalization in a single code file called a4q2.py

Evaluation

• 5 marks for your program that automates the CSP formalization