Sie sind auf Seite 1von 7

UWO

1.

CS 3346: Artificial Intelligence I (Dr. Robert Mercer)

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.

Marks will be given for each of these elements of your answer.


(b) With the constraint graph preprocessed by AC-3 in part (a), show how backtracking search can be used to solve
this problem. To do this, you must draw the search tree generated to find all answers. Indicate (in a summary)
the valid schedule(s) that are found. Use the following variable ordering: , , , , and .

(a) The constraint graph with binary and bidirectional constraints is illustrate bellow:

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, 4 1, 2, 3, 4 1, 2, 3, 4 > , > , , , , , + 1, >


1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4
2, 3, 4

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

Student: Fernando Freitas Alves

> , > , , , , , + , > ,


>
> , , , , , + , > ,
> , >
, , , , + 1, > ,
> , > ,

ffreitas@uwo.ca

Nov 08, 2016 p. 1/7

UWO

CS 3346: Artificial Intelligence I (Dr. Robert Mercer)

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, > ,
> , > , , , ,

> ,
> , > , , , ,

> , > , , , ,

> , , , ,

, , ,

, ,

, , ,

, ,

The constraint graph with the algorithm result = 3, = 3, = 4, = 2, = 1 is illustrate bellow:

B 3

BC

C 4
C>E

CA

CD

BA

E 1

CD+1
D>E

A 3

Student: Fernando Freitas Alves

A>D

D 2

ffreitas@uwo.ca

Nov 08, 2016 p. 2/7

UWO

CS 3346: Artificial Intelligence I (Dr. Robert Mercer)

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

Student: Fernando Freitas Alves

ffreitas@uwo.ca

Nov 08, 2016 p. 3/7

UWO
2.

CS 3346: Artificial Intelligence I (Dr. Robert Mercer)

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

Red lines indicate the proof.

Student: Fernando Freitas Alves

ffreitas@uwo.ca

Nov 08, 2016 p. 4/7

UWO
3.

CS 3346: Artificial Intelligence I (Dr. Robert Mercer)

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

Drop universal quantifier

(b) ,
,

Skolemize

Drop universal quantifier

(c) ,
,

Eliminate implications

Move inwards

Skolemize

Drop universal quantifiers

Distribute over

Student: Fernando Freitas Alves

ffreitas@uwo.ca

Nov 08, 2016 p. 5/7

UWO
4.

CS 3346: Artificial Intelligence I (Dr. Robert Mercer)

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 .

Student: Fernando Freitas Alves

ffreitas@uwo.ca

Nov 08, 2016 p. 6/7

UWO
5.

CS 3346: Artificial Intelligence I (Dr. Robert Mercer)

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)

Negate goal and convert to CNF

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}

Student: Fernando Freitas Alves

ffreitas@uwo.ca

Nov 08, 2016 p. 7/7

Das könnte Ihnen auch gefallen