+ All Categories
Home > Documents > Lecture 25 BB TSP

Lecture 25 BB TSP

Date post: 18-Jan-2016
Category:
Upload: sasha-rodge
View: 12 times
Download: 0 times
Share this document with a friend
Description:
Travelinh sales person
26
EECS 281 Lecture 24 Branch & Bound, Traveling Salesperson Problem
Transcript
Page 1: Lecture 25 BB TSP

EECS 281 Lecture 24

Branch & Bound,

Traveling Salesperson Problem

Page 2: Lecture 25 BB TSP

Recall: Types of Problems

• Constraint Satisfaction problems– Can we satisfy all given constraints?

– If yes, how do we satisfy them?(need a specific solution)

– May have more than one solution

– Examples: sorting, mazes, spanning tree

• Optimization problems– Must satisfy all constraints (can we?) and

– Must minimize an objective functionsubject to those constraints

– Examples: giving change,Minimum Spanning Tree

Page 3: Lecture 25 BB TSP

Recall: Types of Problems

• Constraint Satisfaction problems

– Stop when found a satisfying solution

• Optimization problems

– Can’t stop early

– Must develop set of possible solutions

• Called feasibility or promising set

– Then, must pick ‘best’ solution

Page 4: Lecture 25 BB TSP

Recall: Types of Problems

• Constraint Satisfaction problems

– are to Backtracking, as

• Optimization problems

– are to Branch and Bound

Page 5: Lecture 25 BB TSP

Outline

• We will discuss branch & bound through

the lens of the Traveling Salesperson

Problem

Page 6: Lecture 25 BB TSP

Hamiltonian Cycle

Definition: Given a graph G= (V,E),

find a cycle that traverses each node

exactly once

Note: No vertex (except the first/last)

may appear twice

Page 7: Lecture 25 BB TSP

Traveling Salesperson Problem

Definition: Hamiltonian cycle

with least weight

Page 8: Lecture 25 BB TSP

Types of Algorithm Problems

• Constraint Satisfaction problems

– e.g., Hamiltonian Cycle

– are to Backtracking, as

• Optimization problems

– e.g., Traveling Salesperson

– are to Branch and Bound

Page 9: Lecture 25 BB TSP

Recall: Backtracking

• Branch on every possibility

• Maintain one or more “partial solutions”

• Check every partial solution for validity

– If a partial solution violates some constraint, it

makes no sense to extend it (so drop it), i.e.,

backtrack

Page 10: Lecture 25 BB TSP

Branch-and-bound, a.k.a. B&B

• The idea of backtracking extendedto optimization problems

• You are minimizing a function with this useful property:

– Cost of a partial solution is pruned if it is cost of current, best complete solution

– e.g., the length of a path or tour

• If the cost of a partial solution is too big

drop this partial solution

Page 11: Lecture 25 BB TSP

Bounding in B&B

• The efficiency of B&B is based on

“bounding away” (aka “pruning”)

unpromising partial solutions

• The earlier you know a solution is not

promising, the less time you spend on it

• The more accurately you can compute

partial costs, the earlier you can bound

• Sometimes it’s worth spending extra

effort to compute better bounds

Page 12: Lecture 25 BB TSP

• Find tour of minimum length starting and

ending in same city and visiting every city

exactly once

Example: TSP

Page 13: Lecture 25 BB TSP

• Find tour of minimum length starting and

ending in same city and visiting every city

exactly once

Example: TSP

Page 14: Lecture 25 BB TSP

TSP: (NP) hard problem!

1954:

n=49

2004:

n=24978

Page 15: Lecture 25 BB TSP

TSP with Backtracking

Dead end in the graph (adjacent

vertices are already visited) =

unpromising partial solution

Page 16: Lecture 25 BB TSP

Key to B&B is Bound

• Start with an “infinity” bound

• Find first complete solution – use its

cost as a bound to prune the rest of

the search

• If another complete solution yields a

lower cost – that will be the new bound

• When search is done, the current

bound will be min

Page 17: Lecture 25 BB TSP

Advantage of TSP with B&B

Dead end

Min cost if we complete a cycle from

this partial solution.

If > 27 unpromising partial solution

Best

solution

so far

Note: usually you don’t have

these min-cost values and

thus need to design a function

to calculate a bound given a

partial solution.

Page 18: Lecture 25 BB TSP

Bounding Function

• Consider adjacency matrix of the graph

• Possible function:

– Min of rows/cols from/to not yet visited,

i.e., calculate the minimum over all the

edges that connect two unvisited vertices

– AND expand most promising

(lowest estimate) first

Yes, this function considers solutions

that violate constraints, but it’s a bound

so its ok

Page 19: Lecture 25 BB TSP

TSP with B&B0 9 0 0 3 5

9 0 5 0 0 4

0 5 0 2 0 8

0 0 2 0 1 7

3 0 0 1 0 5

5 4 8 7 5 0

Lower bound for [A] = 3 + 4 + 2 + 1 + 1 + 4 = 15

Leave every vertex once

Pick minimum weight edges out

Lower bound for [A,B] = 9 + 4 + 2 + 1 + 1 + 5 = 22

Edge from A to B (cost 9)

Edges from B to any node except A

Edges from C,…,F to any node except B

Page 20: Lecture 25 BB TSP

Exercise

• Give the lower bounds for each partial

solution at each level

Page 21: Lecture 25 BB TSP

TSP with B&B

0 9 0 0 3 5

9 0 5 0 0 4

0 5 0 2 0 8

0 0 2 0 1 7

3 0 0 1 0 5

5 4 8 7 5 0

Keep track of best solution found so far, called

currBest

At each stage, pick branch with most promising (smallest) lower bound estimate

If new complete solution is found that is better than currBest, then update currBest

If currBest is lower than any lower bound estimates, then prune branch

Page 22: Lecture 25 BB TSP

General Form: Branch & Bound

type checknode (node v, type currBest)

node u

if (promising(v))

if (solution(v)) then

update(currBest)

else

for each child u of v

checknode(u, currBest)

return currBest

Page 23: Lecture 25 BB TSP

General Form: Branch & Bound

solution()

• Check ‘depth’ of solution (Constraint satisfaction)

update()

• If new solution better than current solution, then update

(Optimization)

checknode()

• Called only if promising and not solution

Page 24: Lecture 25 BB TSP

General Form: Branch & Bound

promising()

• Different for each application, but now must prune

(additionally) if lowerbound(v) ≥ currBest

lowerbound()

• Estimate of solution based upon

– Cost so far, plus

– Under estimate of cost remaining (aka bound)

Page 25: Lecture 25 BB TSP

Key to B&B is Bound

We can get smarter and smarter on the

bound

However, calculation of the bound may

become prohibitive

Page 26: Lecture 25 BB TSP

Summary Branch and Bound

• Method to prune search space for

optimization problems

• Need to keep current best solution

• Need to have lower bound estimate

of alternative paths

• If lower bound estimate is greater than

current best, then prune


Recommended