You are on the bank of a river with a boat, a cabbage, a sheep, and a wolf.

Your task is to get everything to the other side.

Restrictions:

1. only you can handle the boat

2. when you're in the boat, there is only space for one more item

3. you can't leave the sheep alone with the wolf, nor with the cabbage (or something will be eaten)

Model the

A 1 means that the item is on this bank, a 0 means it's on the other bank.

Restriction 1 is in the state model: "you" are not modeled separate from the boat.

Restriction 2 determines the possible moves. All moves can be made in both directions. (This is special for this problem. Normally, moves are

Restriction 3 is in the shaded states: these are not allowed.

Find a path from the initial state to the final state. Since this is a toy problem, it's easy.

In a real problem

- constructing the tree and searching it is done at the same time.
*memory*use is often more of a problem than time (thus the number of bits representing a state is important).- parts of the tree that are "done" are thrown away. Sometimes
parts that are not "done" are also thrown away, and recreated later.

What if we replace the wolf by another cabbage? The problem stays the same, but maybe we would have made a smaller model.

A

A

Analogy with family trees (graphs):

S - the set of states

s

G - set of goal states - subset of S

F (flow) - transition function. There are some variations: F is a subset of

- S x S
- S x Name x S - each move has a name. A sequence of moves has a
sequence of names (
*word*).

The moves can be input (as in Luger, where Name is called I, for input) or output. - S x S x Cost - each move has a cost. Find not just any solution, but the cheapest solution.
- S x Name x S x Cost

A

A

The

- What are the
*states*? How are the states*represented*? - What are the
*moves*? How are the moves*represented*? - What
*search strategy*? (Coming 3 lectures.)

The

The

Since state space and search space can be very large, they are almost never created explicitly.

Usually only

You are on the beginning of a wobbly bridge with Mr. Wolf, Mr. sheep, and Mr. Cabbage.

It's dark, and the group has only one flashlight.Your task is to get everyone to the other side.

Restrictions:

1. at most two people can be on the bridge at the same time

2. people need the flashlight to cross the bridge

Cost:

You can cross the bridge in 1 minute, Mr. Wolf needs 2 minutes, Mr sheep needs 5 minutes, and Mr Cabbage needs 10 minutes.

If two people cross the bridge together, they need as much time as the slowest of them.

(similar problem - different values)

- representation of moves: record the moves of the hole

- only half the state space is reachable