This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: COMP 424 Assignment 1 Sample Solutions 1. Uninformed search This question requires you to take a problem and create a implementable formulation in terms of initial state, goal test, successor function and cost function. (a) (Russel and Norvig 3.7a) You have to color a planar map using only four colors, in such a way that no two adjacent regions have the same color. Solution: • Initial state: { c 1 , c 2 , c 3 , c 4 ...c n } , where c i is a set which will contain a legal color for region i . and n is the total number of regions. Initially, c i = ∅ , ∀ i . • Goal state: each c i should have one element. • Operator: pick a set c i and assign it color Col i , if Col i has not already been assigned to one of c i ’s neighbors • In this case, we are looking for any valid assignment, so we do not really need to assign a path cost. (b) (Russel and Norvig 3.7d) 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. Solution: • The states of the problem are represented as triples of three numbers, { c 1 , c 2 , c 3 } , such that c 1 ∈ [0 , 12], c 2 ∈ [0 , 8] and c 3 ∈ [0 . 3], where c i represents the amount of water in the i th jug. Let us denote by C i the max capacity of the i th jug (hence C 1 = 12, C 2 = 8 and C 3 = 3). • Initial state: S = { c 1 = 0 , c 2 = 0 , c 3 = 0 } • Goal state: c i = 1 for some i ∈ { 1 , 2 , 3 } . • Operators: – If c i > 0, c i ← 0 (this is equivalent to dumping a jug) – If c i < C i , c i ← C i (this is the operator which fills up a jug). – If c i ≤ ( C j c j ), then c j ← c j + c i and c i ← 0 (this transfers the content of jug i to jug j ). • Path cost: 1 for each step 1 2. (Russell and Norvig, Problem 4.6). Invent a heuristic function for the 8puzzle that sometimes overestimates, and show how it can lead to a suboptimal solution on a particular problem....
View
Full Document
 Spring '09
 A.Mori
 Artificial Intelligence, Admissible heuristic, goal state

Click to edit the document details