# MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 13, Monday, September 29.

## Presentation on theme: "MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 13, Monday, September 29."— Presentation transcript:

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 s 0 – 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 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. 800 503350 530 053 323 233 251 701 710 413 440 620 602152 143

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 T r be the tree rooted at r. Vertex r is called a center if the correspondig rooted tree T r has minimal height. Compare Exercise 18, p. 103. 7 5 48 1 6 23 root12345678 height34344342

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. No Section of Chapter 4 will be on Test 1.

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. a Labeled verticesb Unlabeled vertices p q a

Similar presentations