1 / 15

Three jealous couples

Three jealous couples. Problem statement. Three couples (husband and wife) wish to cross a river. They have only one boat that can carry at most 2 people. The husbands are so jealous that none is willing to allow their wife to be with another man if they themselves are not present.

Download Presentation

Three jealous couples

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Three jealous couples

  2. Problem statement • Three couples (husband and wife) wish to cross a river. They have only one boat that can carry at most 2 people. The husbands are so jealous that none is willing to allow their wife to be with another man if they themselves are not present. • How can all 3 couples get across the river.

  3. Symmetries • There are a couple of symmetries that might help us solve the problem. • We could get each couple across individually. • We could get all the women across first. • We could get all the men across first.

  4. Notation • We use H, W, C to denote husband, wife and couple (H+W). • 2H means two husbands • 1C, 2H means one couple and two husbands. • 1H, 1W mean a husband and wife who are not a couple. • Note we do not name people e.g. Alice, Bob, Clare… as it is only the number that is relevant

  5. States • A state describes a situation where each person is on the left or right river bank. • 3H||3W means 3 husbands on left bank and 3 wives on right bank • 1C, 2H || 2W denotes one couple and two husbands on the left and two wives on the right.

  6. Action • An action is a state transition (verb) • An action is a person(s) being transported across the river. • 3H|2W|1W means two wives are crossing the river. • Not that this does not say if the boat is going left or right • Is this abiguous.

  7. Invalid States • This notation allows valid and invalid states to be identified easily. • 1C, 1W||1C, 1H is invalid, why? • 3H|3W| is invalid, why?

  8. Problem statement • Start state 3C|| • Final state ||3C • A solution is sequence of actions from the start state to the final state. • {3C||} • S? • {||3C}

  9. Sequence of actions • An action results in a state change. • If p and q denote states, and S is a sequence of actions • {p} • S • {q} • A sequence of actions S will take us from state p to state q.

  10. Sequence of actions e.g. • {2C, 1H||1W} //state • 3H|2W|1W //action • {3H||3W} //state

  11. Problem Decomposition • {3C||} S0 {||3C} //start • We can decompose this into the following. • {3C||} S1 {3H||3W}, • {3H||3W} S2 {3W||3H}, • {3W||3H}S3 {||3C} , • What do you notice about S1 and S3

  12. S1 • {3C||} • 1C, 2H | 2W| • {1C, 2H||2W} • 1C, 2H|W|W • {2C, 1H||1W} • 3H|2W|1W • {3H||3W}

  13. S2 • We can break S2 down into two parts • {3H||3W} • T1 • {1C|1C|1C} • T2 • {3W||3H} • What can we say about T1 and T2.

  14. T1 • {3H||3W} • 3H|1W|2W • {1C, 2H||2W} • 1C|2H|2W • {1C||2C} • And T2 is just the reverse.

More Related