You are on page 1of 2

Computer Science Division Level 4- Autumn semester

Department of Mathematics Course: COMP 401


Faculty of Science October 2022

Sheet 1
Problem formalization and Searching techniques

1) Give a complete problem formalization for each of the following:


a. You have 3 jugs, measuring 12-liter, 8-liter, and 3-liter, and a water faucet. You can fill
the jugs up or empty them out from one to another or onto the ground. The goal is to
measure out exactly one liter.
b. Given a 5-liter jug full of water, and an empty 2-liter jug. The jugs have no marking or
level indicator. The goal is to fill 2-litre jug with exactly one liter of water.
The following are some examples of moves: 𝑝5,2 (pour 5-liter into 2-liter jug), 𝑒2
(empty 2-liter jug), etc.
c. Adam has two jugs: one holds exactly 3-liter and one exactly 4-liter, but they have no
subdivision marking. A recipe calls for exactly 5-liter. He has a source of water but no
other jug. It is desired to get exactly 5-liter (into the recipe) that wastes the least amount of
water.
d. Using 4 colors, you have to color a planer map in such a way that no 2 adjacent regions
have the same color.
e. A 3-foot-tall monkey is in a room where some bananas are suspended from the 8-foot
ceiling. He would like to get the bananas. The room contains 2 stackable, movable,
climbable 3-foot-high crates.
2) The missionaries and cannibals problem is usually stated as follows. Three missionaries (m1,
m2, m3) and three cannibals (c1, c2, c3) are on one side of a river, along with a boat that can
hold one or two people. Suggest a solution to get everyone to the other side, without ever
leaving a group of missionaries in one place outnumbered by the cannibals in that place.
Formulate the solution for the problem, draw the graph, and demonstrate the goal search
through BFS.
3) A farmer (F) wants to move himself, a fox (X), a goose (G), and some grains (R), across a
river. His boat can take only one of his possessions across on any trip. An unattended fox
will eat a goose, and an unattended goose will eat grains. Therefore, the farmer must not
leave the fox alone with the goose nor the goose alone with the grains. Draw a complete state
space diagram for this problem.
4) Consider the following initial and goal states of the 8-puzzle:

1 2 3 1 2 3
8 5 4 5 6
4 7 6 7 8

Initial state Goal State

Use the Manhattan distance heuristic function to draw the search tree for this problem
using the move of the blank tile: left, right, up, and down. Then show the shortest path to
the goal.

You might also like