
CS221 Section 3: Search Search Problems, UCS and A* David Lin, Jerry Qu Recap of A* Search ● We want to avoid wasted effort (to go from SF to LA, we probably don’t want to end up looking at roads to Seattle, for example). ● To do this, we can use a heuristic to estimate how far is left until we reach our goal. ● The heuristic must be optimistic. It must underestimate the true cost. Why? Relaxation A good way to come up with a reasonable heuristic is to solve an easier (less constrained) version of the problem For example, we can use geographic distance as a heuristic for distance if we have the positions of nodes. Note: The main point of relaxation is to attain a problem that can be solved more efficiently. First, let’s see what happens when we run UCS. Shortest Paths in Germany Hannover 0 110 85 90 Bremen ∞ Hamburg ∞ 155 120 200 270 Kiel ∞ Leipzig ∞ 320 255 Schwerin ∞ 365 185 Duesseldorf ∞ 240 140 410 Rostock ∞ Frankfurt ∞ 180 Dresden ∞ Berlin ∞ 410 200 435 Bonn ∞ Stuttgart ∞ Muenchen ∞ 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel ∞ Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock ∞ Frankfurt 365 180 Dresden ∞ Berlin ∞ 410 200 435 Bonn ∞ Stuttgart ∞ Muenchen ∞ 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel ∞ Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock ∞ Frankfurt 365 180 Dresden ∞ Berlin ∞ 410 200 435 Bonn ∞ Stuttgart ∞ Muenchen ∞ 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock ∞ Frankfurt 365 180 Dresden ∞ Berlin ∞ 410 200 435 Bonn ∞ Stuttgart ∞ Muenchen ∞ 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock ∞ Frankfurt 365 180 Dresden ∞ Berlin ∞ 410 200 435 Bonn ∞ Stuttgart ∞ Muenchen ∞ 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock ∞ Frankfurt 365 180 Dresden 395 Berlin 440 410 200 435 Bonn ∞ Stuttgart ∞ Muenchen 690 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock 360 Frankfurt 365 180 Dresden 395 Berlin 440 410 200 435 Bonn ∞ Stuttgart ∞ Muenchen 690 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock 360 Frankfurt 365 180 Dresden 395 Berlin 440 410 200 435 Bonn ∞ Stuttgart ∞ Muenchen 690 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock 360 Frankfurt 365 180 Dresden 395 Berlin 440 410 200 435 Bonn ∞ Stuttgart ∞ Muenchen 690 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock 360 Frankfurt 365 180 Dresden 395 Berlin 440 410 200 435 Bonn 545 Stuttgart 565 Muenchen 690 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock 360 Frankfurt 365 180 Dresden 395 Berlin 440 410 200 435 Bonn 545 Stuttgart 565 Muenchen 690 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock 360 Frankfurt 365 180 Dresden 395 Berlin 440 410 200 435 Bonn 545 Stuttgart 565 Muenchen 690 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock 360 Frankfurt 365 180 Dresden 395 Berlin 440 410 200 435 Bonn 545 Stuttgart 565 Muenchen 690 210 Example from CS 4700 at Cornell University Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock 360 Frankfurt 365 180 Dresden 395 Berlin 440 410 200 435 Bonn 545 Stuttgart 565 Muenchen 690 210 Example from CS 4700 at Cornell University We’re done! But we’ve explored every city on this map. Shortest Paths in Germany Hannover 0 85 110 90 Bremen 120 Hamburg 155 155 120 200 270 Kiel 240 Leipzig 255 320 255 Schwerin 270 365 185 Duesseldorf 320 240 140 410 Rostock 360 Frankfurt 365 180 Dresden 395 Berlin 440 410 200 435 Bonn 545 Stuttgart 565 Muenchen 690 210 Example from CS 4700 at Cornell University Now, define our heuristic to be the straight-line distance to Shortest Paths in Germany München. Let’s see how A* does. 750 740 110 85 720 90 720 680 155 120 200 270 610 590 320 255 540 365 185 410 240 140 410 380 400 180 480 410 200 435 180 210 Example from CS 4700 at Cornell University Shortest Paths in Germany 750 740 Hannover 0 + 610 = 610 110 85720 720 90 680 Bremen 120 + 720 = 840 Hamburg 155 + 720 = 875 155 120 200 270 590 Kiel ∞ + 750 = ∞ Leipzig 255 + 410 = 665 320 610 540 255 Schwerin 270 + 680 = 950 365 185 410 Duesseldorf 320 + 540 = 860 240 140 410 Rostock ∞ + 740 = ∞ 380 400 Frankfurt 365 + 380 = 745 180 480 Dresden ∞ + 400 = ∞ 410 200 Berlin ∞ + 590 = ∞ 435 180 Bonn ∞ + 480 = ∞ 210 Stuttgart ∞ + 180 = ∞ Muenchen ∞ + 0 = ∞ Example from CS 4700 at Cornell University Shortest Paths in Germany 750 740 Hannover 0 + 610 = 610 110 85720 720 90 680 Bremen 120 + 720 = 840 Hamburg 155 + 720 = 875 155 120 200 270 590 Kiel ∞ + 750 = ∞ Leipzig 255 + 410 = 665 320 610 540 255 Schwerin 270 + 680 = 950 365 185 410 Duesseldorf 320 + 540 = 860 240 140 410 Rostock ∞ + 740 = ∞ 380 400 Frankfurt 365 + 380 = 745 180 480 Dresden 395 + 400 = 795 410 200 Berlin 440 + 590 = 1030 435 180 Bonn ∞ + 480 = ∞ 210 Stuttgart ∞ + 180 = ∞ Muenchen 690 + 0 = 690 Example from CS 4700 at Cornell University Shortest Paths in Germany 750 740 Hannover 0 + 610 = 610 110 85720 720 90 680 Bremen 120 + 720 = 840 Hamburg 155 + 720 = 875 155 120 200 270 590 Kiel ∞ + 750 = ∞ Leipzig 255 + 410 = 665 320 610 540 255 Schwerin 270 + 680 = 950 365 185 410 Duesseldorf 320 + 540 = 860 240 140 410 Rostock ∞ + 740 = ∞ 380 400 Frankfurt 365 + 380 = 745 180 480 Dresden 395 + 400 = 795 410 200 Berlin 440 + 590 = 1030 435 180 Bonn ∞ + 480 = ∞ 210 Stuttgart ∞ + 180 = ∞ Muenchen 690 + 0 = 690 Example from CS 4700 at Cornell University Warm Up Which of the following algorithms can be used to find the minimum number of actions needed to reach an end state from the start state in an arbitrary search problem? Circle all that apply. a. depth-first search b. breadth-first search c. uniform cost search d. dynamic programming e. backtracking search Warm Up Which of the following algorithms can be used to find the minimum number of actions needed to reach an end state from the start state in an arbitrary search problem? Circle all that apply. a. depth-first search (fails because we just find a path that works, not necessarily shortest) b. breadth-first search Warm Up Which of the following algorithms can be used to find the minimum number of actions needed to reach an end state from the start state in an arbitrary search problem? Circle all that apply. a. depth-first search (fails because we just find a path that works, not necessarily shortest) b. breadth-first search - (Works: All we need is constant cost) c. uniform cost search Warm Up Which of the following algorithms can be used to find the minimum number of actions needed to reach an end state from the start state in an arbitrary search problem? Circle all that apply. a. depth-first search (fails because we just find a path that works, not necessarily shortest) b. breadth-first search - (Works: All we need is constant cost) c. uniform cost search - (Works: Set all costs to be nonnegative) d. dynamic programming Warm Up Which of the following algorithms can be used to find the minimum number of actions needed to reach an end state from the start state in an arbitrary search problem? Circle all that apply. a. depth-first search (fails because we just find a path that works, not necessarily shortest) b.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages54 Page
-
File Size-