This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: HW 1 Answer Key Answers are in blue (and comic font to keep the answer key funny). Underlined answers are what we expected you to say. Non-underlined parts are additional information we’re giving you. Note: If you think any of the following are trick questions, explain why you believe they are trick questions and what information is necessary to make them fair questions. The presence of this statement should have set off warning bells. They wouldn’t to a computer but you guys are smarter than silly old computers, so you knew when you saw this that there would be trick questions in the homework and therefore should have been on the lookout for questions that didn’t make sense. Because you’re cool like that. 1. There are Four Bottles of Root Beer on the Wall... This is a trivially simple version of the classic water jug problem. You make great root beer, which you keep in a giant barrel in the basement. You're packing drinks for your four kids who are heading off to four different schools. You have four bottles, one for each kid. You want to give them all the same amount to drink because otherwise one of them is going to drive you nuts all day. Unfortunately, all of your bottles are different sizes - one is one liter, the others 2, 3 and 4 liters. All of the bottles are currently empty. There are three things you can do: Fill (fill a bottle all the way to the top from the barrel), Transfer (pour the entire contents of one bottle into another, or as much as you can without overflowing the bottle) and Empty (dump the entire contents of a bottle back into the barrel). weight: 1 a. Describe a state representation. My representation is an array of the four bottles in ascending size. [1Liter, 2Liter, 3Liter, 4Liter] Numbers indicate amount in each bottle. In class we did the missionaries and cannibals problem and used the representation [ML, CL, B, MR, CR] for missionaries on the left, cannibals on the left, which bank the boat was on, missionaries on right, cannibals on right. In a separate lecture we discussed how state representations are written. We said that there was no formal standard, you just needed to show something concrete, specific, detailed enough that anyone who read it, even a really dumb person, would know how to implement it in code. An array like above is one simple way but any other way that met the criteria was acceptable. b. Write the initial and goal states using your state representation. Although the goal state could be A=B=C=D, it's OK to just say that every bottle has one liter in it. Initial: [0, 0, 0, 0] Goal: [1, 1, 1, 1] c. What should the cost function be? As in, if we say solution X is better than solution Y because it costs less, what does cost mean for this problem?...
View Full Document
- Spring '10