graph theory and optimization introduction on linear

44
Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex... Graph Theory and Optimization Introduction on Linear Programming Nicolas Nisse Université Côte d’Azur, Inria, CNRS, I3S, France October 2018 Thank you to F. Giroire for his slides N. Nisse Graph Theory and applications 1/31

Upload: others

Post on 18-Mar-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Graph Theory and OptimizationIntroduction on Linear Programming

Nicolas Nisse

Université Côte d’Azur, Inria, CNRS, I3S, France

October 2018

Thank you to F. Giroire for his slides

N. Nisse Graph Theory and applications 1/31

Page 2: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Outline

1 Motivations

2 Linear Programmes

3 First examples

4 Solving Methods: Graphical method, simplex...

N. Nisse Graph Theory and applications 2/31

Page 3: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Motivation

Why linear programming is a very important tool?

• A lot of problems can be formulated as linear programmes, and

• There exist efficient methods to solve them

• or at least give good approximations.

• Solve difficult problems: e.g. original example given by Dantzig(1947). Best assignment of 70 people to 70 tasks.

→ Magic algorithmic box.

N. Nisse Graph Theory and applications 3/31

Page 4: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Outline

1 Motivations

2 Linear Programmes

3 First examples

4 Solving Methods: Graphical method, simplex...

N. Nisse Graph Theory and applications 4/31

Page 5: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

What is a linear programme?

• Optimization problem consisting in• maximizing (or minimizing) a linear objective function• of n decision variables• subject to a set of constraints expressed by linear equations or

inequalities.

• Originally, military context: "programme"="resource planning".Now "programme"="problem"

• Terminology due to George B. Dantzig, inventor of the SimplexAlgorithm (1947)

N. Nisse Graph Theory and applications 5/31

Page 6: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Terminology

x1,x2

max 350x1 +300x2

subject tox1 + x2 ≤ 200

9x1 +6x2 ≤ 156612x1 +16x2 ≤ 2880

x1,x2 ≥ 0

Decision variables (generally: ∈ R)

Objective function (linear!!)

Constraints (linear!!)

N. Nisse Graph Theory and applications 6/31

Page 7: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Terminology

x1,x2

max 350x1 +300x2

subject tox1 + x2 ≤ 200

9x1 +6x2 ≤ 156612x1 +16x2 ≤ 2880

x1,x2 ≥ 0

Decision variables

Objective function

Constraints

In linear programme: objective function + constraints are all linear

Typically (not always): variables are non-negative

If variables are integer: system called Integer Programme (IP)

N. Nisse Graph Theory and applications 7/31

Page 8: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Terminology

Linear programmes can be written under the standard form:

Maximizen

∑j=1

cjxj

Subject to:n

∑j=1

aijxj ≤ bi for all 1≤ i ≤m

xj ≥ 0 for all 1≤ j ≤ n.

• the problem is a maximization;

• all constraints are inequalities (and not equations);

• all variables are non-negative.

N. Nisse Graph Theory and applications 8/31

Page 9: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Outline

1 Motivations

2 Linear Programmes

3 First examples

4 Solving Methods: Graphical method, simplex...

N. Nisse Graph Theory and applications 9/31

Page 10: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 1: a resource allocation problem

A company produces copper cable of 5 and 10 mm of diameter on asingle production line with the following constraints:

• The available copper allows to produces 21 meters of cable of 5mm diameter per week. Moreover, one meter of 10 mm diametercopper consumes 4 times more copper than a meter of 5 mmdiameter copper.

• Due to demand, the weekly production of 5 mm cable is limited to15 meters and the production of 10 mm cable should not exceed40% of the total production.

• Cable are respectively sold 50 and 200 euros the meter.

What should the company produce in order to maximize its weeklyrevenue?

N. Nisse Graph Theory and applications 10/31

Page 11: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 1: a resource allocation problem

A company produces copper cable of 5 and 10 mm of diameter on asingle production line with the following constraints:

• The available copper allows to produces 21 meters of cable of 5mm diameter per week. Moreover, one meter of 10 mm diametercopper consumes 4 times more copper than a meter of 5 mmdiameter copper.

• Due to demand, the weekly production of 5 mm cable is limited to15 meters and the production of 10 mm cable should not exceed40% of the total production.

• Cable are respectively sold 50 and 200 euros the meter.

What should the company produce in order to maximize its weeklyrevenue?

N. Nisse Graph Theory and applications 10/31

Page 12: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 1: a resource allocation problem

Define two decision variables:

• x1: the number of meters of 5 mm cables produced every week

• x2: the number of meters of 10 mm cables produced every week

The revenue associated to a production (x1,x2) is

z = 50x1 +200x2.

The capacity of production cannot be exceeded

x1 +4x2 ≤ 21.

N. Nisse Graph Theory and applications 11/31

Page 13: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 1: a resource allocation problem

Define two decision variables:

• x1: the number of meters of 5 mm cables produced every week

• x2: the number of meters of 10 mm cables produced every week

The revenue associated to a production (x1,x2) is

z = 50x1 +200x2.

The capacity of production cannot be exceeded

x1 +4x2 ≤ 21.

N. Nisse Graph Theory and applications 11/31

Page 14: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 1: a resource allocation problem

Define two decision variables:

• x1: the number of meters of 5 mm cables produced every week

• x2: the number of meters of 10 mm cables produced every week

The revenue associated to a production (x1,x2) is

z = 50x1 +200x2.

The capacity of production cannot be exceeded

x1 +4x2 ≤ 21.

N. Nisse Graph Theory and applications 11/31

Page 15: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 1: a resource allocation problem

The demand constraints have to be satisfied

x2 ≤4

10(x1 + x2)

x1 ≤ 15

Negative quantities cannot be produced

x1≥ 0,x2≥ 0.

Exercise: Write the above programme in standard form

N. Nisse Graph Theory and applications 12/31

Page 16: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 1: a resource allocation problem

The model: To maximize the sell revenue, determine the solutions ofthe following linear programme x1 and x2:

max z = 50x1 +200x2

subject tox1 +4x2 ≤ 21−4x1 +6x2 ≤ 0

x1 ≤ 15x1,x2 ≥ 0

N. Nisse Graph Theory and applications 13/31

Page 17: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 2: Maximum flow (Reminder on the Problem)

Directed graph: D = (V ,A), source s ∈ V , destination d ∈ V , capacity c : A→ R+.N−(s) = /0 and N+(d) = /0

s

a

c

b

e

d3

332

2

121

flow f : A→ R+ such that :

• capacity constraint: ∀a ∈ A, f (a)≤ c(a)

• conservation constraint: ∀v ∈ V \{s,d}, ∑w∈N−(v)

f (wv) = ∑w∈N+(v)

f (vw)

• value of flow: v(f ) = ∑w∈N+(s)

f (sw).

N. Nisse Graph Theory and applications 14/31

Page 18: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 2: Maximum flow (on an example)

s

a

c

b

e

d3

332

2

121

Exercise: Give a LP computing a maximum flow in the above graphhint: variables correspond to the expected solution

N. Nisse Graph Theory and applications 14/31

Page 19: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 2: Maximum flow (on an example)

s

a

c

b

e

d3

332

2

121

Exercise: Give a LP computing a maximum flow in the above graphhint: variables correspond to the expected solution

Solution: flow f : A→ R+ Variables: fx ∈ R+ for each x ∈ A

N. Nisse Graph Theory and applications 14/31

Page 20: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 2: Maximum flow (on an example)

s

a

c

b

e

d3

332

2

121

Exercise: Give a LP computing a maximum flow in the above graphhint: variables correspond to the expected solution

Solution: flow f : A→ R+ Variables: fx ∈ R+ for each x ∈ AObjective: maximize the flow leaving s Max. fsa + fscsubject to:

N. Nisse Graph Theory and applications 14/31

Page 21: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 2: Maximum flow (on an example)

s

a

c

b

e

d3

332

2

121

Exercise: Give a LP computing a maximum flow in the above graphhint: variables correspond to the expected solution

Solution: flow f : A→ R+ Variables: fx ∈ R+ for each x ∈ AObjective: maximize the flow leaving s Max. fsa + fscsubject to:Capacity constraints: fsa ≤ 3; fsc ≤ 2; fab ≤ 3; fae ≤ 2; fcb ≤ 1; fce ≤ 1; fbd ≤ 3; fed ≤ 2.

N. Nisse Graph Theory and applications 14/31

Page 22: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 2: Maximum flow (on an example)

s

a

c

b

e

d3

332

2

121

Exercise: Give a LP computing a maximum flow in the above graphhint: variables correspond to the expected solution

Solution: flow f : A→ R+ Variables: fx ∈ R+ for each x ∈ AObjective: maximize the flow leaving s Max. fsa + fscsubject to:Capacity constraints: fsa ≤ 3; fsc ≤ 2; fab ≤ 3; fae ≤ 2; fcb ≤ 1; fce ≤ 1; fbd ≤ 3; fed ≤ 2.Conservation constraints: fsa = fab + fae ; fsc = fcb + fce ; fae + fce = fed and fab + fcb = fbd .

N. Nisse Graph Theory and applications 14/31

Page 23: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 2: Maximum flow (on an example)

s

a

c

b

e

d3

332

2

121

Exercise: Give a LP computing a maximum flow in the above graphhint: variables correspond to the expected solution

Solution: flow f : A→ R+ Variables: fx ∈ R+ for each x ∈ AObjective: maximize the flow leaving s Max. fsa + fscsubject to:Capacity constraints: fsa ≤ 3; fsc ≤ 2; fab ≤ 3; fae ≤ 2; fcb ≤ 1; fce ≤ 1; fbd ≤ 3; fed ≤ 2.Conservation constraints: fsa = fab + fae ; fsc = fcb + fce ; fae + fce = fed and fab + fcb = fbd .Variables domain: fx ≥ 0 for any x ∈ A

N. Nisse Graph Theory and applications 14/31

Page 24: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 2: Maximum flow

D = (V ,A) be a graph with capacity c : A→ R+, and s, t ∈ V .Problem: Compute a maximum flow from s to t .

Solution: f : A→ R+ ⇒ variables fa, for each a ∈ AObjective function: maximize value of the flow ∑

u∈N+(s)

f (su)

Constraints:

• capacity constraints: f (a)≤ c(a) for each a ∈ A

• flow conservation: ∑u∈N+(v)

f (vu) = ∑u∈N−(v)

f (uv), ∀v ∈ V \{s, t}

N. Nisse Graph Theory and applications 14/31

Page 25: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Example 2: Maximum flow

D = (V ,A) be a graph with capacity c : A→ R+, and s, t ∈ V .Problem: Compute a maximum flow from s to t .

Maximize ∑u∈N+(s)

f (su)

Subject to: f (a) ≤ c(a) for all a ∈ A

∑u∈N+(v)

f (vu) = ∑u∈N−(v)

f (uv) for all v ∈ V \{s, t}

f (a) ≥ 0 for all a ∈ A

N. Nisse Graph Theory and applications 14/31

Page 26: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Outline

1 Motivations

2 Linear Programmes

3 First examples

4 Solving Methods: Graphical method, simplex...

N. Nisse Graph Theory and applications 15/31

Page 27: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Solving Difficult Problems

• Difficulty: Large number of solutions.

• Choose the best solution among 2n or n! possibilities: all solutionscannot be enumerated.

• Complexity of studied problems: often NP-complete.but Polynomial-time solvable when variables are real !!

• Solving methods:• Optimal solutions:

• Graphical method (2 variables only).• Simplex method. exponential-time, work well in practice• interior point method polynomial-time• Ellipsoid polynomial-time

• Approximations:• Theory of duality (assert the quality of a solution).• Approximation algorithms.

N. Nisse Graph Theory and applications 16/31

Page 28: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Graphical Method

• The constraints of a linear programme define a zone of solutions.

• The best point of the zone corresponds to the optimal solution.

• For problem with 2 variables, easy to draw the zone of solutionsand to find the optimal solution graphically.

N. Nisse Graph Theory and applications 17/31

Page 29: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Graphical Method

Example:

max 350x1 +300x2

subject tox1 + x2 ≤ 200

9x1 +6x2 ≤ 156612x1 +16x2 ≤ 2880

x1,x2 ≥ 0

N. Nisse Graph Theory and applications 18/31

Page 30: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Graphical Method

N. Nisse Graph Theory and applications 19/31

Page 31: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Graphical Method

N. Nisse Graph Theory and applications 20/31

Page 32: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Graphical Method

N. Nisse Graph Theory and applications 21/31

Page 33: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Graphical Method

N. Nisse Graph Theory and applications 22/31

Page 34: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Graphical Method

N. Nisse Graph Theory and applications 23/31

Page 35: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Graphical Method

N. Nisse Graph Theory and applications 24/31

Page 36: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Computation of the optimal solution

The optimal solution is at the intersection of the constraints:

x1 + x2 = 200

9x1 +6x2 = 1566

We get:x1 = 122

x2 = 78

Objective = 66100.

N. Nisse Graph Theory and applications 25/31

Page 37: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Optimal Solutions: Different Cases

N. Nisse Graph Theory and applications 26/31

Page 38: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Optimal Solutions: Different Cases

Three different possible cases:

• a single optimal solution,

• an infinite number of optimal solutions, or

• no optimal solutions.

N. Nisse Graph Theory and applications 26/31

Page 39: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Optimal Solutions: Different Cases

Three different possible cases:

• a single optimal solution,

• an infinite number of optimal solutions, or

• no optimal solutions.

If an optimal solution exists, there is always a corner point optimalsolution!

N. Nisse Graph Theory and applications 26/31

Page 40: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Solving Linear Programmes

N. Nisse Graph Theory and applications 27/31

Page 41: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Solving Linear Programmes

• The constraints of an LP give rise to a geometrical shape: aconvex polyhedron.

• If we can determine all the corner points of the polyhedron, thenwe calculate the objective function at these points and take thebest one as our optimal solution.

• The Simplex Method intelligently moves from corner to corneruntil it can prove that it has found the optimal solution.

N. Nisse Graph Theory and applications 28/31

Page 42: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Solving Linear Programmes

• Geometric method impossible in higher dimensions

• Algebraical methods:• Simplex method (George B. Dantzig 1949): skim through the

feasible solution polytope.Similar to a "Gaussian elimination".Very good in practice, but can take an exponential time.

• Polynomial methods exist:• Leonid Khachiyan 1979: ellipsoid method. But more theoretical

than practical.• Narendra Karmarkar 1984: a new interior method. Can be used in

practice.

N. Nisse Graph Theory and applications 29/31

Page 43: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

But Integer Programming (IP) is different!

• Feasible region: a set ofdiscrete points.

• Corner point solution notassured.

• No "efficient" way to solvean IP.

• Solving it as an LP providesa relaxation and a bound onthe solution.

N. Nisse Graph Theory and applications 30/31

Page 44: Graph Theory and Optimization Introduction on Linear

Motivations Linear Programmes First examples Solving Methods: Graphical method, simplex...

Summary: To be remembered

• What is a linear programme.

• The graphical method of resolution.

• Linear programs can be solved efficiently (polynomial).

• Integer programs are a lot harder (in general no knownpolynomial algorithms).In this case, we look for approximate solutions.

N. Nisse Graph Theory and applications 31/31