You are on page 1of 5

YAGOUB Salah eddine S1 G3

 PROBLEM DEFINITION  :

- B : boy
- G : girl
- C : cat

{C G B} {}

{} {C G B}

Initial state Goal state


The woman, the boy, the girl, The woman, the boy, the girl, and

and the cat are all at home. the cat are all safely transported to the hospital.

Operators:
 Take(S , from , to) :
where s in { boy , girl , cat , none} , none means the mother is driving alone in
the car. And from , to means from the hospital to home or from home to
hospital.
Goal Test:
Check if all the mother, the boy, the girl, and cat have reached the hospital
without any killing happening.
YAGOUB Salah eddine S1 G3

2 –

A - Depth-First search :

{C G B}

{}

{G B} {C B} {C G}

{C} {G} {B}

{G B} {C} {B} {C G}
{C} {G B} {C G} {B}

{B} {G} {C G}
{C G} {C B} {B}

{}
…………………
{C G B}
YAGOUB Salah eddine S1 G3

- We have the first node is the initial state , so depth first search starts
searching and refuses the left most node of the first level because killing
occurs. The mother has to leave the boy and the girl alone to take the cat
to the hospital but he will kill the girl.
- Then it goes to the secon state of the first level and this one is accepted
because the boy is with the cat and not the girl , so there is no problems
with that.
- From this state we go to the first state of the second level which is
accepted because to swap between the cat and the girl the mother must
do two trips , the first trip she will take the cat to the hospital and the
boy stays alone,then she will be back with the girl to home , and here
there is no killing problems because she is present (the mother).
- The she can take the boy to the hospital and leave the girl alone at
home , and here there is no killing problems .
- Finnaly she can take the girl to the hospital and without any killing
problems and we arrive to the solution.
YAGOUB Salah eddine S1 G3

B - Depth-Limited Search to depth limit = 3 :

{C G B}

{}

{G B} {C B} {C G}

{C} {G} {B}

{G B} {C} {B} {C G}

{C} {G B} {C G} {B}

{B} {G} {C G} {C} {G} {G B}

{C G} {C B} {B} {G B} {C B} {C}

- Depth limited search works the same as depth first search , the only
diffrence is there is a depth limit , in this case is 3 . but i will not find any
solution as we see in the graph , so there is no solution with depth
limited search to depth limit = 3 .

c- A* search  :
YAGOUB Salah eddine S1 G3

You might also like