{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw1soln - 15-381 Spring 2007 Assignment 1 Solutions Out...

This preview shows pages 1–3. Sign up to view the full content.

15-381 Spring 2007 Assignment 1 Solutions Out: January 23rd, 2007 Due: February 6th, 1:30pm Tuesday Many people lost 5 points for failing to put their andrew ID on their assignments. This was clearly listed in the instructions for the homework. Many people lost 5 points for failing to follow the collaboration policy. This was clearly listed in the instructions for the homework. 1. The missionaries and cannibals problem is as follows. Three missionaries and three cannibals are on one side of a river, along with a boat. The boat can hold one or two people (and obviously cannot be paddled to the other side of the river with zero people in it). The goal is to get everyone to the other side, without ever leaving a group of missionaries outnumbered by cannibals. Your task is to formulate this as a search problem. (a) Define a state representation. (2 points) There are many possibilities. One example is: Represent the missionaries by M and the cannibals by C . Let the boat be B . Each state can be represented by the items on each side, e.g. Side 1 { M, M, C, C } , Side 2 { M, C, B } . (b) Give the initial and goal states in this representation. (1 point) Initial state: Side 1 { M, M, M, C, C, C, B } , Side 2 {} Goal state: Side 1 {} , Side 2 { M, M, M, C, C, C, B } (c) Define the successor function in this representation. (2 points) A set of missionaries and/or cannibals (call them Move ) can be moved from Side a to Side b if: The boat is on Side a . The set Move consists of 1 or 2 people that are on Side a . The number of missionaries in the set formed by subtracting Move from Side a is 0 or it is greater than or equal to the number of cannibals. The number of missionaries in the set formed by adding Move to Side b is 0 or it is greater than or equal to the number of cannibals. (d) What is the cost function in your successor fuction? (1 point) Each move has unit cost. (e) What is the total number of reachable states? (2 points) 16: Side 1 { M, M, M, C, C, C, B } , Side 2 {} Side 1 {} , Side 2 { M, M, M, C, C, C, B } Side 1 { M, M, M, C, C, B } , Side 2 { C } Side 1 { M, M, M, C, C } , Side 2 { C, B } Side 1 { M, M, M, C, B } , Side 2 { C, C } Side 1 { M, M, M, C } , Side 2 { C, C, B } Side 1 { M, M, C, C, B } , Side 2 { M, C } Side 1 { M, M, C, C } , Side 2 { M, C, B } Side 1 { M, C, B } , Side 2 { M, M, C, C } 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Side 1 { M, C } , Side 2 { M, M, C, C, B } Side 1 { C, C, C, B } , Side 2 { M, M, M } Side 1 { C } , Side 2 { M, M, M, C, C, B } Side 1 { C, C, B } , Side 2 { M, M, M, C } Side 1 { C, C, B } , Side 2 { M, M, M, C } Side 1 { M, M, M } , Side 2 { C, C, C, B } Side 1 { C, B } , Side 2 { M, M, M, C, C } The last one is only reachable through the goal state, but it is still technically reachable (e.g. if you are just exploring the state space instead of searching for a goal).
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern