CO_Ch1

Chapter 1. Problems and Algorithms
 1.1 Two Problems (representative problems)
 The Traveling Salesman Problem
47 drilling platforms off the coast of Nigeria.
Need to visit platforms by a helicopter to regulate the rates of flows.
Starting from the onshore base, what is the cheapest (shortest) route to visit
each platform once and return to the base?
Euclidean traveling salesman problem.
Input: a set V of points in the Euclidean plane.
Objective: Find a simple circuit passing through the points for which the sum of
the lengths of the edges is minimized.
Enumeration: (n-1)!/2 ways (For 23 platforms, takes 178 centuries if can check
one possibility in one nanosec.)
No efficient algorithm is known. (NP-hard)
Combinatorial Optimization 2016
1
 Heuristics?
nearest neighbor, nearest insertion, farthest insertion, cheapest insertion, 2-opt
and 3-opt, Lin-Kernighan (meta heuristic), …
Fig 1.1 shows nearest neighbor solution on 1173 node problem: cost 67,822
(opt sol is 56892).
Empirical tests showed nearest neighbor give solutions about 1.26 times
optimal. Lin-Kernighan: 1.01-1.02
 TSP site: http://www.math.uwaterloo.ca/tsp/ (largest problem solved optimally:
85,900 cities, 2006))
Combinatorial Optimization 2016
2
 Related problem: Hamiltonian cycle (circuit) (a closed simple path that visits
each node of a graph 𝐺 = (𝑉, 𝐸) exactly once)
Hamilton (1859): regular dodecahedron ( 12 pentagonal faces and 20 nodes,
visiting cities in the globe)
Combinatorial Optimization 2016
3
 There exist graphs for which Hamiltonian cycle doesn’t exist.
Petersen graph
Combinatorial Optimization 2016
4
 Q: Do there exist easily identifiable necessary and sufficient conditions to
determine whether an arbitrary graph 𝐺 is Hamiltonian?
Unlikely, the problem is NP-complete.
 Three types of problems in combinatorics
Existence problems
Enumeration problems
Optimization, construction problems
Combinatorial Optimization 2016
5
 The Matching Problem
Drawing a logic circuit using a plotter, assume graph is connected.
Total drawing time = pen-down + pen-up
minimize pen-up time
odd nodes
even nodes
Combinatorial Optimization 2016
6
 Seven bridges in Königsberg: Euler’s problem
Combinatorial Optimization 2016
7
 Graph 𝐺 = (𝑉, 𝐸). 𝑉: set of nodes, 𝐸: set of edges
 Def: Euler trail of a connected graph 𝐺: A trail (edge-simple path) that
traverses every edge of 𝐺.
 Def: Tour of 𝐺: closed walk(path in the text) that traverses each edge of G at
least once.
Euler tour: tour that traverses each edge exactly once (a closed Euler trail)
A graph is called eulerian if it contains an Euler tour.
Combinatorial Optimization 2016
8
 Thm: A nonempty and connected graph is eulerian if and only if it has no
nodes of odd degree.
Pf) ) clear
 ) Induction on 𝐸 .
True for 𝐸 = 0. Assume true for 𝑚 − 1 edges.
A connected graph with 𝑚 ≥ 1 edges and each node has even degree  ∃
edge-simple closed path 𝑃.
𝐺 ∖ 𝑃 gives a graph with one or more components and each component is
eulerian by induction hypothesis. Each component has a node in common with
𝑃.
Now splice 𝑃 and the Euler tours of the components.

 Note that an algorithm to find an Euler tour can be designed using the idea of
the proof.
Combinatorial Optimization 2016
9
 Cor: A connected graph has an Euler trail if and only if it has at most two
nodes of odd degree.
Pf) the number of nodes of odd degree is even ( 𝑣∈𝑉 𝑑 𝑣 = 2 𝐸 )
) clear
) If all nodes even degree, true from the theorem.
If two nodes of odd degree ( say 𝑢, 𝑣 ), add edge 𝑢, 𝑣 to 𝐺, get an eulerian
graph. Now delete 𝑢, 𝑣 in a Euler tour starting from 𝑢. 
Combinatorial Optimization 2016
10
 Back to circuit drawing
If the circuit diagram is eulerian, we can draw the diagram without lifting the
pen.
If the diagram is not eulerian, add some edges (pen-up movement) to make the
diagram eulerian. Which edges to add to minimize the pen-up movement?
 𝑡(𝑝, 𝑞) : time to move (up or down) from point 𝑝 to 𝑞.
Assume 𝑡 satisfies triangle inequality: for any points 𝑝, 𝑞, 𝑟, we have 𝑡 𝑝, 𝑟 ≤
𝑡 𝑝, 𝑞 + 𝑡(𝑞, 𝑟).
Then extra edges added only pair up the odd nodes
Combinatorial Optimization 2016
11
 Euclidean Matching Problem:
Input: A set 𝑉 of points in the Euclidean plane.
Objective: Find a set of lines, such that each point is an end of exactly one line
(perfect matching), and such that the sum of the lengths of the lines is
minimized.
Efficient algorithm exists. (Edmonds, 1965)
 TSP and Matching Problem: Similarities and differences
Select edges of a graph.
The number of feasible solutions is too large.
Heuristics do not perform very well.
TSP is NP-hard, but matching is easy to solve (polynomial time algorithm exists).
Combinatorial Optimization 2016
12
 A problem similar to the circuit drawing problem:
Chinese Postman Problem
Given a connected graph 𝐺 = (𝑉, 𝐸), edge cost 𝑐𝑒 ≥ 0, 𝑒 ∈ 𝐸.
Find a minimum cost closed path (walk) traversing every edge at least once.
approach) Duplicate an edge with the same cost if postman needs to traverse
the edge again
 make the graph eulerian by duplicating edges while the sum of costs of
additional edges is minimized.
 Note that we do not need to duplicate an edge more than once.
Combinatorial Optimization 2016
13
 Example:
 Note the difference between the circuit drawing and the chinese postman
problem.
 Other variations: directed graph (easy), mixed graph (NP-hard)
 More on this problem later when we study T-join.
Combinatorial Optimization 2016
14
 1.2 Measuring Running Times
Efficiency of an algorithm measured by giving upper bounds on the number of
steps required to solve a problem of a given size.
Size of a problem is the length of an encoding of the problem structure and the
numbers (data).
 Arithmetic model: each elementary operation has unit cost, regardless of the
length of the numbers
Bit model: numbers represented in binary notation and arithmetic operation is
carried out bit by bit.
 Def: 𝑓, 𝑔: 𝑍+ → 𝑅+
We say 𝑓 𝑛 = 𝑂(𝑔 𝑛 ) if ∃ 𝑐 > 0 and 𝑛0 such that 𝑓 𝑛 ≤ 𝑐 ∙ 𝑔 𝑛 ∀ 𝑛 ≥ 𝑛0 .
e.g.) 5𝑛2 + 3𝑛 is 𝑂(𝑛2 ), 35 ∙ 2𝑛 + 𝑛3 is 𝑂(2𝑛 ).
 Def: We say that an algorithm is a polynomial time algorithm if the running time
bound is 𝑂(𝑛𝑘 ) for some fixed 𝑘, where 𝑛 is the size of the problem (in
arithmetic or bit model) (considered desirable)
Combinatorial Optimization 2016
15
 If an algorithm is polynomial time in arithmetic model and the size of the
numbers appearing in the algorithm do not grow too fast ( i.e., if 𝑡 is the
number of bits to represent problem data, the length of encoding of numbers
occurring in the algorithm is 𝑂(𝑡 𝑘 ) for some fixed 𝑘), it is polynomial time
algorithm in bit model too. ( most cases)
 Nearest neighbor heuristic for TSP is polynomial time algorithm in both the
arithmetic and bit model (see text). True in most cases, but exceptions exist
(e.g., linear program).
 More in Chapter 9 NP and NP-completeness (not covered in class)
Combinatorial Optimization 2016
16