1 / 35

CS 312: Algorithm Analysis

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License . CS 312: Algorithm Analysis. Lecture #35: Branch and Bound Design Options - State Spaces. Slides by: Eric Ringger, with contributions from Mike Jones, Eric Mercer, and Sean Warnick. Announcements.

khuong
Download Presentation

CS 312: Algorithm Analysis

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. This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. CS 312: Algorithm Analysis Lecture #35: Branch and Bound Design Options - State Spaces Slides by: Eric Ringger, with contributions from Mike Jones, Eric Mercer, and Sean Warnick

  2. Announcements • Homework #25 due now • Homework #26 optional • Project #7: TSP • We continue discussing ideas today • Early: Wednesday • Due: next Friday

  3. Objectives • Consider an alternate way to structure the state space. • i.e., an alternate way to generate successor states • Provide more options to complete the project.

  4. Review the Ingredients of B&B

  5. Review: Branch and Bound functionBandB(v) BSSF  quick-solution(v) // BSSF.cost holds cost Agenda.clear() v.b  bound(v) Agenda.add(v, v.b) while !Agenda.empty() and time remains and BSSF.cost != v.bdo u  Agenda.first() Agenda.remove_first() children = generate_children_ascending(u) for each w in childrendo • if ! time remains then break w.b  bound(w) if(w.b < BSSF.cost) then if criterion(w) then BSSF  w • Agenda.prune(BSSF.cost) else ifpartial_criterion(w) then Agenda.add(w, w.b) return BSSF Compute bound when constructing staterather than as separate step.

  6. Review: Branch and Bound functionBandB(v) BSSF  quick-solution(v) // BSSF.cost holds cost Agenda.clear() Agenda.add(v, v.b) while !Agenda.empty() and time remains and BSSF.cost != v.bdo u  Agenda.first() Agenda.remove_first() children = generate_children_ascending(u) for each w in childrendo • if ! time remains then break if(w.b < BSSF.cost) then if criterion(w) then BSSF  w • Agenda.prune(BSSF.cost) else ifpartial_criterion(w) then Agenda.add(w, w.b) return BSSF Compute bound when constructing state rather than as separate step.

  7. Review: Branch and Bound functionBandB(v) BSSF  quick-solution(v) // BSSF.cost holds cost Agenda.clear() Agenda.add(v, v.b) while !Agenda.empty() and time remains and BSSF.cost != v.bdo u  Agenda.first() Agenda.remove_first() children = generate_children_ascending(u) for each w in childrendo • if ! time remains then break if(w.b < BSSF.cost) then if criterion(w) then BSSF  w • Agenda.prune(BSSF.cost) else ifpartial_criterion(w) then Agenda.add(w, w.b) return BSSF Apply partial_criterion() when generating children.

  8. Simplify: Branch and Bound functionBandB(v) BSSF  quick-solution(v) // BSSF.cost holds cost Agenda.clear() Agenda.add(v, v.b) while !Agenda.empty() and time remains and BSSF.cost != v.bdo u  Agenda.first() Agenda.remove_first() children = generate_children_ascending(u) for each w in childrendo • if ! time remains thenbreak if(w.bound< BSSF.cost) then if criterion(w) then BSSF  w • Agenda.prune(BSSF.cost) else Agenda.add(w, w.b) return BSSF Apply partial_criterion() when generating children.

  9. Simplify: Branch and Bound functionBandB(v) BSSF  quick-solution(v) // BSSF.cost holds cost Agenda.clear() Agenda.add(v, v.b) while !Agenda.empty() and time remains and BSSF.cost != v.bdo u  Agenda.first() Agenda.remove_first() children = generate_children_ascending(u) for each w in childrendo • if ! time remains thenbreak if(w.bound< BSSF.cost) then if criterion(w) then BSSF  w • Agenda.prune(BSSF.cost) else Agenda.add(w, w.b) return BSSF Use init_state() function.Compute bound as partof initial state.

  10. Simplify: Branch and Bound functionBandB() s  init_state() BSSF  quick-solution(s) // BSSF.cost holds cost Agenda.clear() Agenda.add(s, s.bound) while !Agenda.empty() and time remains and BSSF.cost != s.bounddo u  Agenda.first() Agenda.remove_first() children = generate_children_ascending(u) for each w in childrendo • if ! time remains thenbreak if(w.bound< BSSF.cost) then if criterion(w) then BSSF  w • Agenda.prune(BSSF.cost) else Agenda.add(w, w.b) return BSSF Use init_state() function.Compute bound as partof initial state. Requirement for Proj. #7:Use B&B pseudo-code.

  11. 9 1 1 8 2 2 5 10 6 3 4 12 7 3 4 4 Review: A Bound on TSP Tour

  12. 1 0 1 0 0 2 5 9 0 0 2 6 1 3 4 1 Reduce Rows

  13. 1 0 1 0 0 2 5 9 0 0 2 6 0 3 4 1 2. Reduce Columns

  14. Review: Pruning • Under what conditions can a search state be pruned? • Lower bound for state  BSSF (least upper bound) • Could be true when the state is created • Could happen when the BSSF is updated and the agenda is pruned • The state is not feasible • Where feasibility may include any test you might think of: • Already occupied • Cycle among sub-set of cities • No options remaining • …

  15. Focus on State Space functionBandB() s  init_state() BSSF  quick-solution(s) // BSSF.cost holds cost Agenda.clear() Agenda.add(s, s.bound) while !Agenda.empty() and time remains and BSSF.cost != s.bounddo u  Agenda.first() Agenda.remove_first() children = generate_children_ascending(u) for each w in childrendo • if ! time remains thenbreak if(w.bound< BSSF.cost) then if criterion(w) then BSSF  w • Agenda.prune(BSSF.cost) else Agenda.add(w, w.b) return BSSF

  16. Structure of State Space • Recall the structure of the state space from last time?

  17. Review: State Space #1 • Generate all children one step away • each child state is generated by including one of the edges leaving city j, where j is the destination of the last edge in the parent state • Pro: Does not include premature cycles. Why not? • Pro: Simple algorithm: pick all neighbors that remain from vertex j, (leave the starting vertex for the end) • Con: On many instances, while searching with B&B, will result in excessively deep agendas. Why? • Can B&B in this state space be optimal? (i,j) Include edge (j,1) … (j,N) (j,2) (j,3)

  18. Structure of State Space • Could we structure the space another way? • How else could we generate children states?

  19. State Space #2 Use the same method for representing states computing bounds. New method for generating children: Include edge (i,j) Exclude edge (i,j) Why can branch and bound in this state space be optimal?

  20. 1 0 1 0 0 2 5 9 0 2 0 6 0 3 4 1 Excluding an Edge What happens to a state’s cost matrix when an edge is excluded? Exclude 4  2

  21. State Space: Strategy #2

  22. Which edge to select? • What strategies for edge selection can you think of? • Idea: try to reduce the size of the part of the state-space you actually need to explore!

  23. 1 1 2 2 5 5 3 3 4 4 Try #1: Consider edge (3,2) Parent: bound = 21 include (3,2) exclude (3,2) bound = 21 bound = 22 0 1 0 0 0 0 0 9 9 1 0 0 1 0 6 0 Both children similarlycompetetive. 6 0 1

  24. 1 1 2 2 5 5 3 3 4 4 Try #2: Consider edge (2,3) Parent: bound = 21 include (2,3) exclude (2,3) bound = 28 bound = 21 1 0 1 0 0 0 0 9 0 9 0 1 0 Left child more likely tobe pruned. 1 0 6 0 6 1 1

  25. 1 1 2 2 5 5 3 3 4 4 Try #3: Consider edge (5,1) Parent: bound = 21 include (5,1) exclude (5,1) bound = 21 bound = 30 1 0 1 0 0 0 0 0 Right child more likelyto be pruned. 9 0 0 1 0 1 0 6 6 0 0 1 1

  26. State Space so far bound = 21 include (5,1) exclude (5,1) bound = 21 bound = 30

  27. 1 1 2 2 5 5 3 3 4 4 Consider edge (2,5) Parent: bound = 21 include (2,5) exclude (2,5) bound = 21 bound = 28 1 1 0 0 0 0 Again, right child morelikely to be pruned. 0 0 1 0 0 6 0 0 1 1

  28. Search Space so far 21 include (5,1) exclude (5,1) 21 30 include (2,5) exclude (2,5) 21 28

  29. 1 1 2 2 5 5 3 3 4 4 Consider edge (3,2) Parent: bound = 21 include (3,2) exclude (3,2) bound = 21 bound = 22 1 0 0 0 0 0 0 0 0

  30. Search Space so far 21 include (5,1) exclude (5,1) 21 30 include (2,5) exclude (2,5) 21 28 include (3,2) exclude (3,2) 21 22

  31. 1 2 5 3 4 Search Space so far 21 include (5,1) exclude (5,1) 21 30 include (2,5) exclude (2,5) 21 28 include (3,2) exclude (3,2) 0 21 22 include (4,3),(1,4) ... 0 21

  32. Summarize: State Space #2 • Pick an edge e = (i,j) and generate two children: • Include edge e • Exclude edge e • One might pick an edge by: • maximizing the difference between the included edge child and the excluded edge child • maximizing the bound on the excluded edge child • minimizing the bound on the included edge child • One must be careful not to create a cycle prematurely • How to prevent? Include edge (i,j) Exclude edge (i,j)

  33. Conclusions • You have options! • Having some control without sacrificing optimality is important. • You may be able to prune more aggressively without sacrificing optimality.

  34. Assignment • HW #26: Optional • Include-exclude state-space generation • Kill two birds with one stone: • Read the project instructions and lecture notes • Do HW #26 on whiteboard with a partner • Have your “whiteboard experience” for Project #7 • Consider your options • Design a B&B algorithm • Work and talk through an example • Read the assigned selection from Russell & Norvig • Use your homework key credentials • Happy General Conference weekend!

More Related