110 likes | 207 Views
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 13, Monday, September 29. Example 3: Pitcher Pouring Puzzle. We are given three pitchers of water, of sizes 10 quarts, 7 quarts and 4 quarts. Initially, the 10-quart is full and the other two pitchers are empty.
E N D
MATH 310, FALL 2003(Combinatorial Problem Solving)Lecture 13, Monday, September 29
Example 3: Pitcher Pouring Puzzle • We are given three pitchers of water, of sizes 10 quarts, 7 quarts and 4 quarts. • Initially, the 10-quart is full and the other two pitchers are empty. • Is there a way to pour among pitchers to obtain exactly 2 quarts in one of the pitchers?
The State Space • The state space contains the following: • S – set of states • s0 – initial state • F – final or goal states (could be only one) • P - set of rules • D – Admissibility function D:P S {True,False} • U – Rule application: U:P S S.
Example 3: Pitcher Pouring Puzzle – Exercise 16(a) • We are given three pitchers of water, of sizes 8 quarts, 5 quarts and 3 quarts. • Initially, the 8-quart is full and the other two pitchers are empty. • Is there a way to pour among pitchers to obtain exactly 4 quarts in one of the pitchers?
Example 3: Pitcher Pouring Puzzle – Exercise 16(a) • We are given three pitchers of water, of sizes 8 quarts, 5 quarts and 3 quarts. • Initially, the 8-quart is full and the other two pitchers are empty. • Is there a way to pour among pitchers to obtain exactly 4 quarts in one of the pitchers?
State Space 800 • Here is a part of the state space for Exercise 16(a). • What is the initial state? • What are the final states? • What are the rules? • Are there any states missing? • Are there any edges missing? • Find DFS and BFS trees. 503 053 350 530 323 152 602 620 233 251 143 440 701 413 710
Example 4: Jealous Wives Puzzle. • Three jealous wives and three husbands come to a river. • The boat is for two people. • Find a sequence of boat trips that will get 6 people across the river without ever letting any husband to be without his wife in the presence of another wife. A,a,B,b,C,c
Example 4: Jealous Wives Puzzle. • Three jealous wives and three husbands come to a river. • The boat is for two people. • Find a sequence of boat trips that will get 6 people across the river without ever letting any husband to be without his wife in the presence of another wife. A,a,B,b,C,c
A Center of a Tree T • Let T be an arbitrary tree and let r be any of its vertices. Let Tr be the tree rooted at r. Vertex r is called a center if the correspondig rooted tree Tr has minimal height. Compare Exercise 18, p. 103. 7 3 2 4 8 1 6 5
4.1. Shortest Paths • Homework (MATH 310#5M): • Read 4.2. • Do Exercises 4.1: 1,2,4,6,8,10,12 • Volunteers: • ____________ • ____________ • Problem: 1. • No Section of Chapter 4 will be on Test 1.
a Labeled verticesb p q Unlabeled vertices a Dijkstra’s Algorithm • At each step of the algorithm the (green) edge e between a labeled vertex p and unlabeled vertex q is selected in such a way, that • d(p) + k(e) • is minimal.