Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1.
Assignment 3
Consider a scheduling problem, where there are five activities to be scheduled in four time slots. Suppose we
represent the activities by the variables , , , , and , where the domain of each variable is 1,2,3,4 . The
constraints for the scheduling problem are: > , > , , , , , + 1, and > .
(a) Show how arc consistency (AC-3) can be used as a preprocessing first step. To do this you must:
(i)
draw the constraint graph (HINT: all of the constraints are binary and bidirectional);
(ii)
show an initial queue with the constraints in the order given above (the - constraint at the front of
the queue) and then show how the queue changes throughout the algorithm;
(iii)
and show a table that illustrates how the algorithm progresses the table consists of rows containing
the constraint being considered, the elements in the domains of the two variables connected by the
constraint after the arc is made consistent, and the arcs that are added to the queue by this step.
BC
C
C>E
CA
CD
BA
CD+1
D>E
A>D
The initial queue and its evolution during the algorithm progress is shown in the table below. The red-dashed
variables and constraints are those that are being removed from the domain/queue in the corresponding step
due to arc consistency algorithm. The bolded constrains are those that are being added to the queue. Repeated
constrains are not added again.
Constraints queue
1, 2, 3, 4 1, 2, 3, 4
1, 2, 3
1, 2, 3, 4
2, 3, 4
1, 2, 3, 4 1, 2, 3, 4
2, 3
1, 2
ffreitas@uwo.ca
UWO
Assignment 3
2, 3
2, 3, 4
1, 2, 3, 4
2, 3
1, 2
, , , + 1, > ,
> , > ,
2, 3
2, 3, 4
1, 2, 3, 4
2, 3
1, 2
, , + 1, > ,
> , > ,
2, 3
2, 3, 4
1, 2, 3, 4
2, 3
1, 2
, + 1, > ,
> , > ,
2, 3
2, 3, 4
1, 2, 3, 4
2, 3
1, 2
+ 1, > ,
> , > ,
2, 3
2, 3, 4
1, 2, 3, 4
2, 3
1, 2
> ,
> , > , , , , , + , >
2, 3
2, 3, 4
2, 3, 4
2, 3
1, 2
2, 3, 4
2, 3, 4
1, 2
> , , , , , + 1, > ,
> , >
2, 3, 4
2, 3, 4
, , , , + 1, > ,
> , > ,
3, 4
2, 3, 4
, , , + 1, > ,
> , > ,
3, 4
2, 3, 4
, , + , > ,
> , > , , ,
3, 4
2, 4
, + , > ,
> , > , , , ,
3, 4
3, 4
3, 4
3, 4
3, 4
3, 4
3, 4
+ 1, > ,
> , > , , , ,
> ,
> , > , , , ,
> , > , , , ,
> , , , ,
, , ,
, ,
, , ,
, ,
B 3
BC
C 4
C>E
CA
CD
BA
E 1
CD+1
D>E
A 3
A>D
D 2
ffreitas@uwo.ca
UWO
Assignment 3
(b) The backtracking search algorithm applied to this problem resolves the constraints satisfaction problem as
follows in the graph above, giving two solutions highlighted in red:
= 3, = 3, = 4, = 2, = 1
= 4, = 4, = 2, = 3, = 1 .
and
The valid partial schedules are highlighted in white while the schedules that does not satisfy the constraints
are highlighted in gray.
A=2
A=2
D=2
A=2
D=1
E=2
A=2
D=1
A=2
D=1
E=1
A=2
D=3
A=2
D=1
E=3
A=1
A=2
D=4
A=2
D=1
E=4
A=1
D=2
A=1
D=1
A=3
A=1
D=3
A=1
D=4
A=3
D=2
A=3
D=2
E=2
A=3
D=2
E=1
A=3
D=2
E=3
A=3
D=2
E=4
A=3
D=2
E=1
C=2
A=3
D=2
E=1
C=1
A=3
D=2
E=1
C=3
A=3
D=2
E=1
C=4
A=3
D=2
E=1
C=4
B=2
A=3
D=2
E=1
C=4
B=1
A=3
D=1
E=2
A=3
D=2
E=1
C=4
B=3
A=4
A=3
D=1
A=3
D=3
A=3
D=4
A=3
D=1
E=1
A=3
D=1
E=3
A=3
D=1
E=4
A=4
D=2
A=4
D=2
E=2
A=4
D=2
E=1
C=2
A=4
D=2
E=1
A=4
D=2
E=1
C=1
A=4
D=2
E=3
A=4
D=2
E=1
C=3
A=3
D=2
E=1
C=4
B=4
A=4
D=1
A=4
D=2
E=4
A=4
D=2
E=1
C=4
A=4
D=1
E=2
A=4
D=1
E=1
A=4
D=1
E=3
A=4
D=1
E=4
A=4
D=3
E=2
A=4
D=3
E=2
C=2
A=4
D=3
E=2
C=1
A=4
D=3
E=2
C=3
A=4
D=3
E=2
C=4
A=4
D=3
E=1
C=2
B=2
A=4
D=3
E=1
C=2
A=4
D=3
E=1
C=2
B=1
A=4
D=3
A=4
D=4
A=4
D=3
E=1
A=4
D=3
E=3
A=4
D=3
E=4
A=4
D=3
E=1
C=1
A=4
D=3
E=1
C=3
A=4
D=3
E=1
C=4
A=4
D=3
E=1
C=2
B=3
A=4
D=3
E=1
C=2
B=4
ffreitas@uwo.ca
UWO
2.
Assignment 3
You are given a Knowledge Base consisting of the following definite clauses:
Give a top-down derivation for .
The top-down derivation for the query , where the rightmost atom is always selected to be resolved first, is
given above:
yes A
yes B C
yes B
yes D
yes E
yes H
yes
ffreitas@uwo.ca
UWO
3.
Assignment 3
Convert the following FOL sentences into clauses. Show all intermediate conversion steps. Include steps that are
required to incorporate the clauses into an empty Knowledge Base.
(a) ,
(b) ,
(c) ,
(a) ,
,
Skolemize
(b) ,
,
Skolemize
(c) ,
,
Eliminate implications
Move inwards
Skolemize
Distribute over
ffreitas@uwo.ca
UWO
4.
Assignment 3
Give a most general unifier for the following pairs of expressions (if one doesn't exist, state the reason why):
(a) , , , and , , ,
(b) , , , and , , ,
(c) ,
and ,
(d) , , and , ,
(e) , , and ,
(a) , , , and , , ,
mgu: , , ,
(b) , , , and , , ,
No unifier because cannot bind to both and .
(c) ,
and ,
mgu: ,
(d) , , and , ,
No unifier because the occurs-check prevents unification of with .
(e) , , and ,
No unifier because cannot bind to both , and .
ffreitas@uwo.ca
UWO
5.
Assignment 3
You are given the following Knowledge Base (already converted to clause form):
,
Using resolution, prove . Provide a diagram as shown in the book/slides. Be certain to show any unifiers
that are required in the resolution proof.
x B(x)
B(x) C(x)
B(z)
unifier: {x/z}
C(K) D(L)
C(z)
unifier: {z/K}
D(w) E(y)
D(L)
unifier: {w/L}
C(M) E(N)
E(y)
unifier: {y/N}
C(v)
C(M)
unifier: {v/M}
ffreitas@uwo.ca