0% found this document useful (0 votes)
3 views4 pages

Week04 - Branch and Bound

The document discusses data structures and algorithms, focusing on the branch and bound method for solving combinatorial optimization problems, particularly the traveling salesman problem. It outlines the general diagram of branch and bound, the process of evaluating lower bounds, and the algorithm for finding the optimal itinerary with the smallest total cost. The document provides a detailed explanation of the Try function and its implementation to navigate through possible itineraries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Week04 - Branch and Bound

The document discusses data structures and algorithms, focusing on the branch and bound method for solving combinatorial optimization problems, particularly the traveling salesman problem. It outlines the general diagram of branch and bound, the process of evaluating lower bounds, and the algorithm for finding the optimal itinerary with the smallest total cost. The document provides a detailed explanation of the Try function and its implementation to navigate through possible itineraries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

DATA

STRUCTURES AND
ALGORITHMS

CONTENT

• General diagram of branch and bound

• The traveling salesman problem

DATA STRUCTURES AND


ALGORITHMS
WEEK 4: BRANCH AND BOUND

3 4
GENERAL DIAGRAM GENERAL DIAGRAM

• Branch and Bound: One of the methods to solve combinatorial optimization problems • Consider the problem of finding the
minimum of the objective function in
• Use the backtracking technique to list all options, thereby retaining the best option
which the solution is represented by a set
• Use bound evaluation (upper bound for the problem of finding max and lower bound for the
of variables X = (X1, X2, . . ., Xn).
problem of finding min) to cut down the search space during the listing process.
• The Try(k) function is used to try the
value for variable Xk during the listing
process Evaluate a lower bound
of the objective
function of the solution
• Symbol f*: objective function, the value evolving from this point

of the best solution found


Skip

5 6

GENERAL DIAGRAM THE TRAVELING SALESMAN PROBLEM

• After assigning the value v to Xk, we  Problem statement:

evaluate the lower bound g of the  A tourist wants to visit n cities 1, 2, . . ., n

objective function of the development  A itinerary (journey) is a way to start from city 1, go through all the remaining
cities, each city exactly once, and then return to starting city 1.
options continuing from point 13.
 Know that c(i, j) is the cost of traveling from city i to city j (i, j = 1, 2,..., n)
• If g is greater than or equal to f*, do not
 Find the itinerary with the smallest total cost.
continue developing the solution from
Some comments:
point 13 Evaluate a lower bound
of the objective • The number of traveler's itineraries is (n-1)!
function of the solution Sir William Rowan Hamilton [1]
developing from this • We have a one-to-one correspondence between a tourist's itinerary: (1805 – 1865)
point
• 1 ->x[2] -> x[3] ->...-> x[n]-> 1 with a permutation x = (x[2], x[3],..., x[n]) of n -1
Skip
natural number 2, 3,..., n.
• Journey cost: f(x) = c(1, x[2]) + c(x[2], x[3]) +... + c(x[n-1],x[n] ) + c(x[n] ,1)

7 8
THE TRAVELING SALESMAN PROBLEM THE TRAVELING SALESMAN PROBLEM

 Solve using searching in the whole space: Init: Solve using branch and bound
• f* = +∞; f = 0; x[1] = 1;
 Itinerary : x = (1, x[2], x[3],..., x[n], 1) • for (int v = 2; v<=n; v++) visited[v]=0; Calculate bound:
• Let cmin = min { c(i, j) , i, j = 1, 2, ..., n, i  j } be the minimum traveling cost between cites
void Try(int k) {
try(k){//try values assignable to x[k]
for (int v = 2; v<=n; v++) { • Need to estimate the itinerary cost for the current branch corresponding to the part (1, u2, . . .,
for v in candidates(k) do { if (!visited[v]) {
x[k] = v; uk) passing through: 1  u2  . . .  uk-1  uk
if (check(v,k)) then {
visited[v] = 1;
x[k] = v; f = f + c(x[k-1],x[k]); • If the lower bound g(1, u2, . . ., uk) ≥ f* then skip (1, u2, . . ., uk)
Determine:
if (k == n) { //Update record
[Update the data structure D] 1) candidates(k)
ftemp = f + c(x[n],x[1]);
2) check(v, k)
if (k == n) then solution(); if (ftemp < f*) f∗ = ftemp;
}
else try(k+1); else Try(k + 1);
[Recover the data structure D] f = f − c(x[k-1],x[k]);
visited[v] = 0;
} }
} }
}
}

9 10

THE TRAVELING SALESMAN PROBLEM THE TRAVELING SALESMAN PROBLEM

• Need to estimate the itinerary cost for the current branch corresponding to the part (1, u2, . . ., • Function Try(k) finds the optimal solution to
uk) passing through: 1  u2  . . .  uk-1  uk the tourist problem using branch and bound Try(k) {
for v = 2 to n do {
• The cost for the partial itinerary (1, u2, ..., uk) is: techniques if not visited[v] {
x[k] = v;
 = c(1,u2) + c(u2, u3) + ... + c(uk-1, uk) visited[v] = true;
f = f + c(x[k-1],x[k]);
• For a full itinerary: if k = n then { //Update record
ftemp = f + c(x[n],x[1]);
1  u2  . . .  uk-1  uk  uk+1  uk+2  …..  un  1 if (ftemp < f*) f∗ = ftemp;
}
• We need n-k+1 more stages, each stage has a cost at least cmin, hence the minimum cost for else {
g = f + (n−k+1)∗cmin;
the remaining itinerary : (n-k+1) cmin Main(){ if g < f∗ then Try(k+1);
//Init: }
• If the partial itinerary is (1, u2, ..., uk) then the full itinerary has the cost at least g(1, u2, ..., uk) =  f* = +∞; f = 0; x[1] = 1; f = f − c(x[k-1],x[k]);
for v = 2 to n do visited[v] = false; visited[v] = false;
+ (n-k+1) cmin Try(2); }
print(f*); }
} }

11 12
THANK YOU !

13

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy