### Table of Contents

## Lab 5: Formulating Search Problems

In this lab we will look at some real world problems and formulate them as **Search Problems**.

### Group work

We will start by splitting the class into several groups. Each group should formulate the following problems (all) as **search problems** by giving:

- An
**Initial State**; - The
**Goal Test**; - Available
**Actions**; - The
**Transition Model**(or**Successor**function); - The
**Cost**function.

You don't need to write any code, but describe these things precisely enough so that they could be implemented. You will have **15-20 minutes** (total) to discuss all the problems and formulate them. After this time, each group will present their solution to one problem (picked randomly) and discuss it with the class.

These are the problem descriptions:

- An agricultural robot needs to plant 100 trees in a valley. The trees should be at least 1 m apart and should generally stand in a flat area if possible. The robot carries all the trees in a large container on its back;
- A space probe has to find some place outside of earth for humanity to colonize. It reports that humans want to be able to choose from at least 3 habitable places. The humans have also set the condition that they do not want to travel longer than absolutely necessary;
- You start with a sequence ABABAECCEC, or in general any sequence made from A, B, C and E. You can transform this sequence using the following equalities: AC = E, AB = BC, BB = E and E
*x*=*x*for any*x*. For example, ABBC can be transformed into AEC, and then AC, then E. Your goal is to produce the sequence E. - You have three jugs, measuring 12 gallons, 8 gallons, and 3 gallons, and a water faucet. You can fill the jugs up or empty them out from one to another or onto the ground. You need to measure out exactly one gallon.

### Extra Discussion

If we have time, we'll also look at the **missionaries** and **cannibals** problem:

Three missionaries and three cannibals are on one side of a river, along with a boat that can hold one or two people. The task is to find a way to transport everyone to the other side, without ever leaving a group of missionaries in one place outnumbered by cannibals in that place, because then the missionaries will be eaten.

- Formulate the problem precisely, making only those distinctions necessary to ensure a valid solution. Draw a diagram of the complete state space.
- Why do you think people have a hard time solving this puzzle, given that the state space is so simple?

To play with this problem and get a feeling of it, take a look at an interactive version online: http://www.learn4good.com/games/puzzle/boat.htm