Discrete Optimization 2010 Lecture 8 Lagrangian Relaxation ...

32
Lagrangian TSP & 1-Trees P, NP, co-NP Discrete Optimization 2010 Lecture 8 Lagrangian Relaxation / P , NP and co-NP Marc Uetz University of Twente [email protected] Lecture 8: sheet 1 / 32 Marc Uetz Discrete Optimization

Transcript of Discrete Optimization 2010 Lecture 8 Lagrangian Relaxation ...

Lagrangian TSP & 1-Trees P, NP, co-NP

Discrete Optimization 2010Lecture 8

Lagrangian Relaxation / P , NP and co-NP

Marc UetzUniversity of Twente

[email protected]

Lecture 8: sheet 1 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Outline

1 Lagrangian Relaxation

2 TSP and the 1-Tree Relaxation

3 Decision Problems, P, NP, and co-NP

Lecture 8: sheet 2 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

LP and Lagrangian Relaxation

max ctx

s.t. Ax ≤ b (← complicating constraints)

Bx ≤ d (IP)

x integer

Lagrangian relaxation (λ ≥ 0)

L(λ) = maxx ctx − λt(Ax − b)

or L(λ) = λtb + maxx (ct − λtA)x

s.t. Bx ≤ d (LR(λ))

x integer

Idea: penalize violation of constraints instead of enforcing themExercise: L(λ) is an upper bound on optimum IP solution.

Lecture 8: sheet 3 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

LP and Lagrangian Relaxation

Best possible Lagrangian upper bound is Langragian Dual:

LD = minλ≥0L(λ) a

anote: λ is unrestricted in sign if we relax equality constraints Ax = b

LP upper bound:

LP = maxxctx | Ax ≤ b,Bx ≤ d

denote by ILP the optimum solution value of the integer program

Theorem (for maximization problems)

ILP ≤ LD ≤ LP

(i.e., best Lagrangian bound is never worse than the LP relaxation)

Lecture 8: sheet 4 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Proof (of 2nd inequality)

Use (strong) linear programming duality twice:

LD = minλ≥0btλ+ maxx(ct − λtA)x | Bx ≤ d , x integer

≤ minλ≥0btλ+ maxx(ct − λtA)x | Bx ≤ d

=︸︷︷︸LP duality

minλ≥0btλ+ minyd ty | Bty = (c − Atλ), y ≥ 0

= minλ,ybtλ+ d ty | Atλ+ Bty = c , y ≥ 0, λ ≥ 0

=︸︷︷︸LP duality

maxxctx | Ax ≤ b,Bx ≤ d = LP

Note: ‘=’ holds in 2nd step for example if B is totally unimodular

Lecture 8: sheet 5 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

An Example: TSP

TSP

Given (w.l.o.g. complete)undirected graph G = (V ,E ),|V | = n, edge lengths ce ≥ 0∀ e ∈ E , find shortestHamiltonian cycle T (= tour).

Example

a short but non-optimal tourfor all 15,112 cities in D

Lecture 8: sheet 6 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

IP Formulation for TSP I

variables xe = 1 if e ∈ T , 0 otherwise

min∑e∈E

cexe∑e∈δ(v)

xe = 2 v ∈ V

∑e∈S

xe ≤ |S | − 1 ∅ ⊂ S ⊂ V

x ∈ 0, 1n

Subtour elimination constraints (SEC), need to forbid solution:

Lecture 8: sheet 7 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

IP Formulation for TSP II

variables xe = 1 if e ∈ T , 0 otherwise

min∑e∈E

cexe

s.t.∑e∈E

xe = n∑e∈δ(S)

xe ≥ 2 ∅ ⊂ S ⊂ V

x ∈ 0, 1n

Lecture 8: sheet 8 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

IP Formulation for TSP III (why valid?)

variables xe = 1 if e ∈ T , 0 otherwise

min∑e∈E

cexe

s.t.∑e∈E

xe = n∑e∈δ(v1)

xe = 2,∑

e∈δ(v)

xe = 2 v ∈ V \ v1∑e∈S

xe ≤ |S | − 1 ∅ ⊂ S ⊂ V \ v1

x ∈ 0, 1n

[Held & Karp 1970] Lagrange-relax all but one of the constraints∑e∈δ(v) xe = 2 (all but for node v1)

Lecture 8: sheet 9 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

TSP & One-Tree Relaxation

Claim

Lagrange-relaxing the degree constraints yields a spanning tree onG \ v1 + two edges incident with v1

Proof.∑e∈E xe = n, so we have n − 2 edges on G \ v1 (with n − 1

nodes), and∑

e∈δ(S) xe ≥ 1 for all ∅ ⊂ S ⊂ V \ v1, so thesolution on G \ v1 is a connected subgraph

But we know how to compute a minimum spanning tree inpolynomial time

Lecture 8: sheet 10 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

The One-Tree Relaxation (given λ)

min∑e∈E

cexe −∑v∈V

λv (∑

e∈δ(v)

xe − 2) (let λv1 = 0)

= min 2∑v∈V

λv +∑

e=u,v∈E

(ce − λv − λu)xe (let λv1 = 0)

s.t.∑e∈E

xe = n,∑

e∈δ(v1)

xe = 2,

∑e∈S

xe ≤ |S | − 1, ∅ ⊂ S ⊂ V \ v1

x ∈ 0, 1n

Solution

Pick the two cheapest edges leaving v1, and compute a minimumspanning tree (edge weights ce − λu − λv ) on the graph G \ v1.

Lecture 8: sheet 11 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Held & Karp Bound for TSP

To get a good lower bound for the TSP need values for λ. . .

Procedure for Computing λ

Start with λv = 0 ∀ v ∈ V in iteration 1

in iteration k , compute optimal one-tree x∗ and update λ:

if k :=∑

e∈δ(v) x∗e = 1, let λv = λv + ∆k(2− k)

[making edges incident with v cheaper, i.e., more ‘attractive’]if k :=

∑e∈δ(v) x∗e ≥ 3, let λv = λv + ∆k(2− k)

[making edges incident with v less ‘attractive’]

for some “step size” ∆k ≥ 0

iterate until improvement of bound becomes marginal

By “right”choice of step size ∆k (∆k ↓ 0,∑

k ∆k =∞) thisconverges to the optimal solution of the Lagrangian dual, LD.

Lecture 8: sheet 12 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Subgradient Optimization for LD

For the TSP (minimization problem) we have LD = maxλ L(λ)

L(λ) is linear in λ for given one-tree x∗

L(λ, x∗) =∑e∈E

cex∗e −

∑v∈V

λv (∑

e∈δ(v)

x∗e − 2)

hence L(λ) = minx L(λ, x) is a piecewise linear, concavefunction

regions where for varying λ, same x is optimal

λ

L(λ)

Lecture 8: sheet 13 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Subgradient Optimization for LD (cont’d)

Now for any given λ and the corresponding optimal one-tree x∗,consider

dv :=dL(λ, x∗)

dλv=

(2−

∑e∈δ(v)

x∗e

)Then dv coincides with our update step for λ, as we defined

λv = λv + ∆k

(2−

∑e∈δ(v)

x∗e

)= λv + ∆kdv

Exercise: vector d = dL(λ,x∗)dλ ∈ Rn is a subgradient of L( · ) at λ,

i.e., L(λ′) ≤ L(λ) + d t(λ′ − λ) ∀λ′ ∈ Rn

Note: Previous “intuitive” update of λs is just a special case ofwhat is known as subgradient optimization

Lecture 8: sheet 14 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

More Generally

Given λ, let x∗ be the optimal solution to a Lagrangian L(λ) with

L(λ) = minx

ctx − λt (Ax − b)

then b − Ax∗ is a subgradient of L( · ) at λ, that is,

L(λ′) ≤ L(λ) + (b − Ax∗)t(λ′ − λ) ∀λ′

Proof: Exercise

Remark: For any L : Rn → R concave, the set

dL(λ) := d ∈ Rn | L(λ′) ≤ L(λ) + d t(λ′ − λ) ∀λ′ is called

subdifferential of L at λ. If L is differentiable at λ, then

dL(λ) = ∇L(λ). If 0 ∈ dL(λ), L attains its minimum in λ

Lecture 8: sheet 15 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Remarks on the Held & Karp bound

Very strong lower bound in practical implementations

Reasonably fast to compute, so feasible within B & B

Gives same lower bound as the LP relaxation, LP = LD[fractional 1-tree relaxation always has integer optimalsolution, follows from a theorem by Edmonds 1971]

There are examples where LD = maxλ L(λ)< IP[to really solve TSP to optimality, can use Lagrangianrelaxation only as a lower bound, e.g. within B & B]

Lecture 8: sheet 16 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Example for Suboptimality of 1-Tree Bound

1

1

1 1

1

1

0

0

0Exercise: Optimal tour costs 4, but there is always a 1-tree withcost ≤ 3, no matter what the values of the λv ’s are

Lecture 8: sheet 17 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

One-Trees: Trees With a Cycle!

Lecture 8: sheet 18 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Outline

1 Lagrangian Relaxation

2 TSP and the 1-Tree Relaxation

3 Decision Problems, P, NP, and co-NP

Lecture 8: sheet 19 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Decision Problems

Definition

A decision (recognition) problem P is a set of instances I that canbe partitioned into ‘Yes’ and ‘No’ instances IY , IN , such that

I = IY ∪ IN

IY ∩ IN = ∅

Examples

All graphs G = (V ,E ) with edge lengths ce , and k ∈ N.Graphs with TSP tour of length ≤ k, and those without.

All graphs G = (V ,E ), and k ∈ N. Graphs with a matchingM ⊆ E of cardinality ≥ k , and those without.

Lecture 8: sheet 20 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Optimization and Decision Problems

Optimization (OPT)

Given an instance I = (S , f ) of discrete optimization problem P,find a solution s∗ ∈ S minimizing / maximizing f (s).

Decision (DEC)

Given an instance I = (S , f ) of discrete optimization problem P,and integer k , decide if ∃ solution s with f (s) ≤ / ≥ k.

Clearly, if we can solve OPT, we can also solve DEC.

What about the other direction?

Lecture 8: sheet 21 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Decision Problems are often General Enough

Proposition

(For quite many discrete optimization problems) if we can solveDEC in poly-time, we can also solve OPT in poly-time.

There may be cases where OPT is provably more difficult (an openresearch question), but in many cases it isn’t.

How to solve OPT using an algorithm for DEC?

1 First compute optimal solution value ξ for OPT, by binarysearch on possible optimal values

2 Given ξ, construct a corresponding optimal solution

Lecture 8: sheet 22 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Example: Maximum Matching

Given G = (V ,E ), find a matching of maximal cardinality.

Assume algorithm A(k) that correctly tells us:Is there a matching of size ≥ k in a graph G?

1 Binary Search for optimal value ξ (note, ξ ∈ [0,m], integer)

Let [a, b] = [0,m]While (b > a)

k = a + d b−a2e

If A(k) = ‘Yes’ on G , then a = kOtherwise b = k − 1

return ξ := a(= b) O( log m ) × A(k)

2 Finding the solutionFor all edges (e ∈ E )

if A(ξ) = ‘Yes’ on graph (G − e) then delete e from G

return remaining edges E (G ) O( m ) × A(k)

Lecture 8: sheet 23 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Problem class P : Deterministic Polynomial Time

Given: Decision problem P, |I | encoding length of instance I ∈ P

Definition

Algorithm A is a deterministic polynomial time algorithm for P ifthere exists a polynomial p such that,

A(I ) =‘Yes’ ⇔ I is ‘Yes’ instance

tA(I ) ≤ p(|I |) ∀ instances I of P (A is a poly-time algorithm)

Definition

Problem P ∈ P :⇔ P has deterministic poly-time algorithm

Examples: decision problems for MST, ShortestPath, MaxFlow,MinCostFlow, Matching ∈ P

Lecture 8: sheet 24 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Certificates

Given: TSP instance, a complete undirected graph with integeredge lengths ce ≥ 0, e ∈ E , integer k : ∃ tour ≤ k?

Can we give a short certificate, that is, a short proof that I is a‘Yes’ instance?

This is simple: The tour T ⊆ E itself (n edges, |T | ∈ O( n ))

!"#$%&'(")*(+,$-."

!"#$%&'&()*+ ,$-./%"0".%&"%10'%-$2&!&3&45676896&"%0$/$,&:;&

<'%&=$&/"#$&'&1>.,0&?,..@&&1>.,0&?,..@&&0>'0&"0&"1&'&AB7)C "%10'%-$D

“Easy”: !?,..@2 0.E,&(&"01$F@

!?,..@&#$,"@"-'0".%2

(&"1&"%8$$8&'&0.E,&! 84(9&! :&!

G.0$2&H"%8"%/H"%8"%/ 0>$&?,..@&40>$&0.E,9&I'J&K$&LE"0$&>',86&

KE0&#$,"@"-'0".%#$,"@"-'0".% .@&0>$&?,..@&"1&$'1J&4?.FJ%.I"'F&0"I$9&

Verifying the certificate

check that T is indeed a tour

check its length∑

e∈T ce ≤ k?

Possible in polynomial time, O( n2 )

Note: Finding the certificate maybe hard, but verifying itscorrectness is easy (in polynomial time)

Lecture 8: sheet 25 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Problem class NP : Nondeterministic Polynomial Time

Given: Decision problem P, |I | encoding length of instance I ∈ P

Definition

Algorithm A is nondeterministic polynomial time algorithm for P if

For all ‘Yes’ instances I , ∃ poly-length certificate z(I ) (i.e.,|z(I )| ≤ p(|I |) for some polyn. p), and A(I , z(I )) =‘Yes’

For all ‘No’ instances I , and any poly-length input z (‘fakecertificate’), A(I , z) =‘No’

A(I , z) is a poly-time algorithm for any poly-length z

Definition

P ∈ NP :⇔ P has nondeterministic poly-time algorithm⇔ ‘Yes’ instances of P have a polynomial certificate

that can be verified in polynomial time

Example: We have just argued that TSP∈ NPLecture 8: sheet 26 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Why ‘nondeterministic’?

Definition uses existence of a polynomial length certificate z(I ),but not how to obtain it!

We can interpret this equivalently as:

Consider all possible certificates z of polynomial length,

If the instance I =‘Yes’, at least one yields the algorithm toterminate with ‘Yes’

Could we ‘guess’ the right certificate z(I ) for any given ‘Yes’instance I , we could solve the problem

↑guessing = nondeterminism

Lecture 8: sheet 27 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

What about ‘No’ Instances

Given: TSP instance I , so a complete undirected graph withinteger edge lengths ce ≥ 0, e ∈ E , integer k .

Can we give a short certificate that I is a ‘No’ instance?

???All proofs seem to require exponential length. . .

!"#$%&'()*+,-.&/ 01&2$+#"

!"#$%&'&()*+ ,$-./%"0".%&"%10'%-$2&!&3&45676896&"%0$/$,&:;&

<'%&=$&/"#$&'&1>.,0&?,..@&&1>.,0&?,..@&&0>'0&"0&"1&'&ABCD "%10'%-$E

?).F$>.=6&'GG&?,..@1&1$$F&0.&,$HI",$&$J?.%$%0"'G&G$%/0>$J?.%$%0"'G&G$%/0>KK

LGG&>'#$&G$%/0>&! :MN&check all (n−1)!2 tours, see they all have length ≥ k + 1

Lecture 8: sheet 28 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

‘No’ Instances with Certificates

Given: An integer matrix A ∈ Zm×n: is A totally unimodular?

Short certificate for ‘No’ instances: square submatrix B of A

encoding length |B| ≤ |A|, so certainly polynomial

verifying the certificate: verify that det(B) 6∈ 0,±1

Is certificate verification possible in polynomial time?

Laplace formula det(B) =∑k

j=1 bij(−1)i+jdet(B−i ,−j)requires Ω(n!) time

but O( n3 ) is possible, computing LU decomposition of B(B = LU, with L = lower triangular, U = upper triangular)

Lecture 8: sheet 29 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Problem class co-NP : Complement-NPGiven: Decision problem P, |I | encoding length of instance I ∈ P

Definition

Algorithm A is nondeterministic polynomial time algorithm for thecomplement of P if

For all ‘No’ instances I , ∃ poly-length certificate z(I ) (i.e.,|z(I )| ≤ p(|I |) for some polyn. p), and A(I , z(I )) =‘Yes’

For all ‘Yes’ instances I , and any poly-length input z (‘fakecertificate’), A(I , z) =‘No’

A(I , z) is a poly-time algorithm for any poly-length z

Definition

P ∈ co-NP:⇔ complement of P has nondet. poly-time algorithm⇔ ‘No’ instances of P have a polynomial certificate

that can be verified in polynomial time

Lecture 8: sheet 30 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

P , NP , and co-NP

Theorem

P ⊆ NP and P ⊆ co-NP

PNP co-NP

TSP TUM

MST

Open conjectures

P 6= NP, worth 1.000.000$ claymath.org/millennium/P vs NP/

P = NP∩co-NP, worth world-fame and recognition as scientist

Lecture 8: sheet 31 / 32 Marc Uetz Discrete Optimization

Lagrangian TSP & 1-Trees P, NP, co-NP

Proof P ⊆ NP ,co-NP

Given Problem Q ∈ P.

To show: Q ∈ NP i.e., for all ‘Yes’ instances I ∈ Q existspolynomial length certificate z(I ), and an algorithm A that verifiesthe certificate in poly-time, so A(I , z(I )) = ‘Yes’⇔ I = ‘Yes’.

Proof: We know Q ∈ P, so Q has a poly-time algorithm AQ withAQ(I ) =‘Yes’ ⇔ I =‘Yes’

Now use z(I ) = ∅, and define A(I , ∅) := AQ(I )

To see P ⊆co-NP, replace all underlined ‘Yes’ by ‘No’, and letA(I , ∅) := ¬AQ(I )

Lecture 8: sheet 32 / 32 Marc Uetz Discrete Optimization