Exercise 4
Exercise 4
6
Consider a scheduling problem, where there are five activities to be scheduled in four time slots.
Suppose we represent the activities by the variables A, B, C, D, and E, where the domain of each
variable is {1,2,3,4} and the constraints are A > D, D > E, C ̸= A, C > E, C ̸= D, B ≥ A, B ̸= C,
and C ̸= D + 1.
[Before you start this, try to find the legal schedule(s) using your own intuitions.]
(a) Show how backtracking solves this problem. To do this, you should draw the
search tree generated to find all answers. Indicate clearly the valid schedule(s). Make
sure you choose a reasonable variable ordering.
To indicate the search tree, write it in text form with each branch on one line. For example,
suppose we had variables X, Y, and Z with domains t, f and constraints X ̸= Y and Y ̸= Z. The
corresponding search tree is written as:
X=t Y=t Y=f
X=f Y=t Y=f
failure
Z=t solution Z=f failure Z=t failure Z=f solution failure
[Hint: It may be easier to write a program to generate such a tree for a particular
problem than to do it by hand.]
(b) Show how arc consistency solves this problem. To do this you must
draw the constraint graph;
show which elements of a domain are deleted at each step, and which arc is
responsible for removing the element;
show explicitly the constraint graph after arc consistency has stopped; and
show how splitting a domain can be used to solve this problem.
Below is the initial constraint graph.
Embed YOUR arc consistent constraint diagram here:
Write axioms in terms of definite clauses that let the system determine whether kettles
are heating. AILog code for the electrical environment is available from the book
website.
You must
• give the intended interpretation of all symbols used
• write the clauses so they can be loaded into AILog
• show that the resulting knowledge base runs in AILog.
Example ans (note \% are comments: