Instructor: Dr. Gautam Das notes by Walter Wilson

7
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – March 12, 2009 ILP – Integer Linear Programming Approximate algorithm for ILP Instructor: Dr. Gautam Das notes by Walter Wilson

description

CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – March 12, 2009 ILP – Integer Linear Programming Approximate algorithm for ILP. Instructor: Dr. Gautam Das notes by Walter Wilson. ILP – Integer Linear Programming set of integer variables linear constraints - PowerPoint PPT Presentation

Transcript of Instructor: Dr. Gautam Das notes by Walter Wilson

Page 1: Instructor: Dr. Gautam Das notes by Walter Wilson

CSE 6311 – Spring 2009ADVANCED COMPUTATIONAL MODELS

AND ALGORITHMS

Lecture Notes – March 12, 2009

ILP – Integer Linear ProgrammingApproximate algorithm for ILP

Instructor: Dr. Gautam Das

notes by Walter Wilson

Page 2: Instructor: Dr. Gautam Das notes by Walter Wilson

ILP – Integer Linear Programming

set of integer variables

linear constraints

linear goal function

(same as LP except vars are integers)

Page 3: Instructor: Dr. Gautam Das notes by Walter Wilson

Integer Linear Programming Example

Factory product material profit

Product1 w1 grams metal per unit p1 dollars per unit

Product2 w2 " p2 "

Constraints:

total # of products per day <= P

total amount of material per day <= W

Unknowns:

x1 - # of units of Product1

x2 - " Product2

Goal function:

maximize profit: x1 p1 + x2 p2

Constraint equations:

x1 + x2 <= P

x1 w1 + x2 w2 <= W

x1 >= 0, x2 >= 0, x1,x2 integers!

Page 4: Instructor: Dr. Gautam Das notes by Walter Wilson

ILP Example 2 – Shortest PathsGiven weighted directed graph and start, end nodes s & f,

find weight of shortest path from start to end.Let wj >= 0 be integer weight for each edge j

ui >= 0 be weight of shortest path from s to node uiConsider shortest path from s to node v:

s

u1

u2

w1

w2v

u1

u2

Shortest path to v in terms of path to preceding node uk:

v <= uk + wk (edge (uk,v) has weight wk)

v >= 0

Goal: minimize f (shortest path to f)

Page 5: Instructor: Dr. Gautam Das notes by Walter Wilson

ILP Decision ProblemIs there a var asnmt s.t. goal <= C

Proof that ILP (decision problem) is NP-Complete –Reduction from Vertex Cover:Given unweighted graph G and k does there exist a vertex cover of size <= k?for each node vi, make constraints xi>=0, xi<=1 for each edge (vi,vj) make constraint xi + xj >= 1goal: minimize sum of xi

-- xi == 1 means xi selected for vertex cover-- goal <= k means V.C. <= k

Page 6: Instructor: Dr. Gautam Das notes by Walter Wilson

Approximation Algorithm for ILP Vertex Cover• Algorithm:

– Treat as LP problem• Will get values 0.0 to 1.0 for vertices (VChypoth)

– VChypoth <= VCopt – LP solution more optimal than ILP

• One possible algorithm: take vertices in decreasing order

– Stop when cover achieved

• Simpler: round to 0 or 1 (.5 rounds up)– Is this a vertex cover?

» Yes since sum of values for each edge >= 1– Approximation bound:

» VChypoth = sum of x's < .5 + sum of x's >= .5» (left vars round to 0, right round to 1)» VCapprox = sum of rounded vars <= 2 * unrounded» Thus: VCapprox <= 2 * VChypoth» Thus: VCapprox <= 2 * VCopt

Page 7: Instructor: Dr. Gautam Das notes by Walter Wilson

Weighted Vertex Cover

• Graph with weighted nodes

• Find vertex cover that touches all edges but minimizes the sum of the weights

• ILP problem– Goal: sum i=1..n xi wi– How to do rounding? -- do same way– How to prove approximation ratio?

• VCapprox <= 2 VCopt