Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 31

Traveling Salesman Problem

dan
Metode Heuristics
Komarudin
komarudin74@ui.ac.id
What is TSP?
• Design the shortest, or minimal cost, route for a
salesman who wants to travel EVERY cities ONLY
ONCE and ,lastly, backs to home city.
• In graph, we need to find a tour that starts at a
node, visits every other node exactly once, and
returns to the starting node.
What is TSP
• Definition: Find a path through a weighted graph which
starts and ends at the same vertex, includes every other
vertex exactly once, and minimizes the total cost of edges.
(NIST)
• TSP is classified as an NP-complete problem, that means no
polynomial algorithm can guarantee to come with the
shortest tour (unless P = NP).
• Solution space?
TSP
Search space for TSP
• Permutation of cities
• for n cities -> permutations
• precisely
Search space for TSP
• a 10-city TSP has about 181 000 possible solutions
• a 20-city TSP has about 10 000 000 000 000 000 possible
solutions
• a 50-city TSP has about 100 000 000 000 000 000 000 000
000 000 000 000 000 000 000 000 000 000 000 000 000
possible solutions
• There are only 1 000 000 000 000 000 000 000 liters of
water on the planet
More Real-Life Applications
• It’s not likely anyone would want to plan a sales trip to 34
cities
• But the solution of several important “real world” problems
is the same as finding a tour of a large number of cities
• transportation: school bus routes,
service calls, delivering meals, ...
• manufacturing: an industrial robot
that drills holes in printed circuit
boards
• VLSI (microchip) layout
• communication: planning new
telecommunication networks
For many of these
problems n (the number
of “cities”) can be 1,000
or more
Printed Circuit Board 2392 cities 1987 Padberg and Rinaldi

8
USA Towns of 500 or more population 13509 cities 1998
Applegate, Bixby, Chvátal and Cook

9
Towns in Germany 15112 Cities 2001Applegate, Bixby,
Chvátal and Cook

10
Sweden 24978 Cities 2004 Applegate, Bixby, Chvátal, Cook and Helsgaun

11
Model Integer
Clique packing constraint
MTZ constraints
Extension of TSP: VRP

• TSP: Travelling Salesman Problem


• One vehicle can deliver all orders.

• VRP: Vehicle Routing Problem


• More than one vehicle is required to serve all orders.

VRP
TSP

depot
depot
Building a new tour from scratch
Nearest Neighbor heuristic
(greedy, order dependent,
some neighbors not so near)
A different greedy, multi-fragments heuristic
Savings heuristic (Clarke-Wright 1964): Details in
http://www.cs.uu.nl/docs/vakken/amc/lecture03-2.pdf
Heuristics
• Mean distance to the optimum
• Savings: 11%
• Multi-fragments: 12%
• Nearest Neighbor: 26%
Improving the tour
Insert Mutation for permutations
• Pick two cities at random
• Move the second to follow the first, shifting the
rest along to accommodate
• Note that this preserves most of the order and the
adjacency information
Swap mutation for permutations
• Pick two cities at random and swap their positions
• Preserves most of adjacency information (4 links
broken), disrupts order more
2-opt
• Take two edges (v,w) and (x,y) and replace them by
(v,x) and (w,y) OR (v,y) and (w,x) to get a tour again.
• Costly: part of tour should be turned around

A&N: TSP 26
27
Local Search

A technique for those who do not know


how to solve the problem!
Local Search Algorithms
General Idea:
• Start with a solution (Saving, Nearest
neighbour, etc.)
• Repeatedly try to perform modifications to
the current solution to improve it
• Swap, Insert, 2-opt
Does Greedy Local Search Lead
Eventually To Optimal Tour?

No.
TERIMA KASIH

You might also like