103
T. Mchedlidze · D. Strash · Computational Geometry Linear Programming 1 Tamara Mchedlidze Computational Geometry Lecture INSTITUTE FOR THEORETICAL INFORMATICS · FACULTY OF INFORMATICS Linear Programming 09.5.2018 T. Mchedlidze · D. Strash · Computational Geometry Linear Programming T. Mchedlidze · D. Strash · Computational Geometry Linear Programming T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Linear Programming Computational Geometry Lecture

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming1

Tamara Mchedlidze

Computational Geometry • Lecture

INSTITUTE FOR THEORETICAL INFORMATICS · FACULTY OF INFORMATICS

Linear Programming

09.5.2018

T. Mchedlidze · D. Strash · Computational Geometry Linear ProgrammingT. Mchedlidze · D. Strash · Computational Geometry Linear ProgrammingT. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 2: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming2

Profit optimization• You are the boss of a company, that produces two products P1

und P2 from three raw materials R1, R2 und R3.• Let’s assume you produce x1 items of the product P1 and x2 items of

product P2.• Assume that items P1, P2 get profit of 300e and 500e, respectively.

Then the total profit is:

G(x1, x2) = 300x1 + 500x2

• Assume that the amout of raw material you need for P1 and P2 is:

• And in your warehouse there are 880R1, 150R2 and 60R3. So:

P1 : 4R1 +R2

P2 : 11R1 +R2 +R3

R1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

• Which choice for (x1, x2) maximizes your profit?

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 3: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 1

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 1500

0

Linear constraints:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 4: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 2

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 1500

0

Linear constraints:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 5: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 3

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 1500

0

Linear constraints:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 6: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 4

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 1500

0

Linear constraints:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 7: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 5

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

00

Linear constraints:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 8: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 6

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

00

Linear constraints:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 9: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 7

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

00

Linear constraints:

Feasibleregion: the setof feasiblesolutions

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 10: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 8

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2

00

Linear constraints:

Linear objective function:

Feasibleregion: the setof feasiblesolutions

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 11: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 9

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

Linear constraints:

Linear objective function:

Feasibleregion: the setof feasiblesolutions

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 12: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 10

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

Linear constraints:

Linear objective function:

Feasibleregion: the setof feasiblesolutions

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 13: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 11

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

30.000e

Linear constraints:

Linear objective function:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 14: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 12

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

Linear constraints:

Linear objective function:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 15: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 13

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

Linear constraints:

Linear objective function:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 16: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 14

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

Linear constraints:

Linear objective function:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 17: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 15

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

Linear constraints:

Linear objective function:

∂R1 ∩ ∂R2 =

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 18: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 16

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

Linear constraints:

Linear objective function:

∂R1 ∩ ∂R2 ={(

11040

)}

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 19: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 17

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

G(110, 40) =

Linear constraints:

Linear objective function:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 20: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 18

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 21: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 19

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

53.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 22: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 20

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

53.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

(300, 500)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 23: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 21

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

53.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

(300, 500)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 24: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 22

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

53.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

Ax ≤ b

(300, 500)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 25: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 23

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

53.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

Ax ≤ b

x ≥ 0

(300, 500)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 26: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 24

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

53.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

Ax ≤ b

x ≥ 0

(300, 500)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 27: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 25

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

53.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

Ax ≤ b

max cTx

x ≥ 0

(300, 500)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 28: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 26

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

53.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

Ax ≤ b

max cTx

x ≥ 0

(300, 500)

c - normalvector

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 29: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 27

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

53.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

Ax ≤ b

max cTx

x ≥ 0

maximum value of theobjective function underthe constraints.

=(300, 500)

c - normalvector

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 30: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming3 - 28

SolutionR1 : 4x1 + 11x2 ≤ 880R2 : x1 + x2 ≤ 150R3 : x2 ≤ 60

50

100

150

200

x2

x150 100 150

x1 ≥ 0x2 ≥ 0

G(x1, x2) = 300x1 + 500x2= (300, 500)

(x1

x2

)

00

”Isocost line“ (orthogonal to

(300500

))

15.000e

45.000e

30.000e

53.000e

G(110, 40) =

Linear constraints:

Linear objective function:

53.000

Ax ≤ b

max cTx

x ≥ 0

maximum value of theobjective function underthe constraints.

=

max{cTx | Ax ≤ b, x ≥ 0}

(300, 500)

c - normalvector

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 31: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming4 - 1

Linear programming

Definition: Given a set of linear constraints H and a linearobjective function c in Rd, a linear program (LP)is formulated as follows:

maximize c1x1 + c2x2 + · · ·+ cdxd

under constr. a1,1x1 + · · ·+ a1,dxd ≤ b1a2,1x1 + · · ·+ a2,dxd ≤ b2

...an,1x1 + · · ·+ an,dxd ≤ bn

}H

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 32: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming4 - 2

Linear programming

Definition: Given a set of linear constraints H and a linearobjective function c in Rd, a linear program (LP)is formulated as follows:

maximize c1x1 + c2x2 + · · ·+ cdxd

under constr. a1,1x1 + · · ·+ a1,dxd ≤ b1a2,1x1 + · · ·+ a2,dxd ≤ b2

...an,1x1 + · · ·+ an,dxd ≤ bn

• H is a set of half-spaces in Rd.• We are searching for a point x ∈

⋂h∈H h, that maximizes

cTx, i.e. max{cTx | Ax ≤ b, x ≥ 0}.• Linear programming is a central method in operations

research.

}H

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 33: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming5 - 1

Algorithms for LPs

There are many algorithms to solve LPs:

• Simplex-Algorithm [Dantzig, 1947]• Ellipsoid-Method [Khatchiyan, 1979]• Interior-Point-Method [Karmarkar, 1979]

They work well in practice, especially for large values of n(number of constraints) and d (number of variables).

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 34: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming5 - 2

Algorithms for LPs

There are many algorithms to solve LPs:

• Simplex-Algorithm [Dantzig, 1947]• Ellipsoid-Method [Khatchiyan, 1979]• Interior-Point-Method [Karmarkar, 1979]

They work well in practice, especially for large values of n(number of constraints) and d (number of variables).

Today: Special case d = 2

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 35: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming5 - 3

Algorithms for LPs

There are many algorithms to solve LPs:

• Simplex-Algorithm [Dantzig, 1947]• Ellipsoid-Method [Khatchiyan, 1979]• Interior-Point-Method [Karmarkar, 1979]

They work well in practice, especially for large values of n(number of constraints) and d (number of variables).

Today: Special case d = 2

Possibilities for the solution space

⋂H = ∅ ⋂

H is unboundedin the direction c

c c

c

infeasible

feasible region⋂H is bounded

solution is notunique

unique solution

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 36: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming6 - 1

First approach

Idea: Compute the feasible region⋂H and search for the

angle p, that maximizes cT p.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 37: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming6 - 2

First approach

Idea: Compute the feasible region⋂H and search for the

angle p, that maximizes cT p.

How can we proceed?

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 38: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming6 - 3

First approach

Idea: Compute the feasible region⋂H and search for the

angle p, that maximizes cT p.• The half-planes are convex• Let’s try a simple Divide-and-Conquer Algorithm

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 39: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming6 - 4

First approach

Idea: Compute the feasible region⋂H and search for the

angle p, that maximizes cT p.• The half-planes are convex• Let’s try a simple Divide-and-Conquer Algorithm

IntersectHalfplanes(H)

if |H| = 1 thenC ← H

else(H1, H2)← SplitInHalves(H)C1 ← IntersectHalfplanes(H1)C2 ← IntersectHalfplanes(H2)C ← IntersectConvexRegions(C1, C2)

return C

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 40: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming7 - 1

Intersect convex regions

IntersectConvexRegions(C1, C2) can be implemented using asweep line method:

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 41: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming7 - 2

Intersect convex regions

IntersectConvexRegions(C1, C2) can be implemented using asweep line method:• consider the left and the right boundaries of C1 and C2

C1C2

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 42: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming7 - 3

Intersect convex regions

IntersectConvexRegions(C1, C2) can be implemented using asweep line method:• consider the left and the right boundaries of C1 and C2

• move the sweep line ` from top to bottom and save thecrossed edges (≤ 4)

C1C2

`

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 43: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming7 - 4

Intersect convex regions

IntersectConvexRegions(C1, C2) can be implemented using asweep line method:• consider the left and the right boundaries of C1 and C2

• move the sweep line ` from top to bottom and save thecrossed edges (≤ 4)• The nodes of C1 ∪ C2 define events. We process every

event in O(1) time, dependent on the type of the edgesincident to the event vertex.

C1C2

`

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 44: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming7 - 5

Intersect convex regions

IntersectConvexRegions(C1, C2) can be implemented using asweep line method:• consider the left and the right boundaries of C1 and C2

• move the sweep line ` from top to bottom and save thecrossed edges (≤ 4)• The nodes of C1 ∪ C2 define events. We process every

event in O(1) time, dependent on the type of the edgesincident to the event vertex.

C1C2

`

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 45: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming7 - 6

Intersect convex regions

IntersectConvexRegions(C1, C2) can be implemented using asweep line method:• consider the left and the right boundaries of C1 and C2

• move the sweep line ` from top to bottom and save thecrossed edges (≤ 4)• The nodes of C1 ∪ C2 define events. We process every

event in O(1) time, dependent on the type of the edgesincident to the event vertex.

C1C2

`

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 46: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming7 - 7

Intersect convex regions

IntersectConvexRegions(C1, C2) can be implemented using asweep line method:• consider the left and the right boundaries of C1 and C2

• move the sweep line ` from top to bottom and save thecrossed edges (≤ 4)• The nodes of C1 ∪ C2 define events. We process every

event in O(1) time, dependent on the type of the edgesincident to the event vertex.

C1C2

`

Theorem 1:The intersection of two convexpolygonal regions in the planewith n1 + n2 = n nodes can becomputed in O(n) time.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 47: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming8 - 1

Running time of IntersectHalfplanes(H)

IntersectHalfplanes(H)

if |H| = 1 thenC ← H

else(H1, H2)← SplitInHalves(H)C1 ← IntersectHalfplanes(H1)C2 ← IntersectHalfplanes(H2)C ← IntersectConvexRegions(C1, C2)

return C

Task: What is the running time of IntersectHalfplanes(H)?

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 48: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming8 - 2

Running time of IntersectHalfplanes(H)

IntersectHalfplanes(H)

if |H| = 1 thenC ← H

else(H1, H2)← SplitInHalves(H)C1 ← IntersectHalfplanes(H1)C2 ← IntersectHalfplanes(H2)C ← IntersectConvexRegions(C1, C2)

return C

Task: What is the running time of IntersectHalfplanes(H)?

Recursive formula

T (n) =

{O(1) when n = 1

O(n) + 2T (n/2) when n > 1T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 49: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming8 - 3

Running time of IntersectHalfplanes(H)

IntersectHalfplanes(H)

if |H| = 1 thenC ← H

else(H1, H2)← SplitInHalves(H)C1 ← IntersectHalfplanes(H1)C2 ← IntersectHalfplanes(H2)C ← IntersectConvexRegions(C1, C2)

return C

Task: What is the running time of IntersectHalfplanes(H)?

Recursive formula

T (n) =

{O(1) when n = 1

O(n) + 2T (n/2) when n > 1

Master Theorem ⇒T (n) ∈ O(n log n)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 50: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming8 - 4

Running time of IntersectHalfplanes(H)

IntersectHalfplanes(H)

if |H| = 1 thenC ← H

else(H1, H2)← SplitInHalves(H)C1 ← IntersectHalfplanes(H1)C2 ← IntersectHalfplanes(H2)C ← IntersectConvexRegions(C1, C2)

return C

Task: What is the running time of IntersectHalfplanes(H)?

Recursive formula

T (n) =

{O(1) when n = 1

O(n) + 2T (n/2) when n > 1

Master Theorem ⇒T (n) ∈ O(n log n)

• feasible region⋂H can be found in O(n log n) time

• ⋂H has O(n) nodes• the node p that maximizes cT p can therefore be found

in O(n log n) time

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 51: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming8 - 5

Running time of IntersectHalfplanes(H)

IntersectHalfplanes(H)

if |H| = 1 thenC ← H

else(H1, H2)← SplitInHalves(H)C1 ← IntersectHalfplanes(H1)C2 ← IntersectHalfplanes(H2)C ← IntersectConvexRegions(C1, C2)

return C

Task: What is the running time of IntersectHalfplanes(H)?

Recursive formula

T (n) =

{O(1) when n = 1

O(n) + 2T (n/2) when n > 1

Master Theorem ⇒T (n) ∈ O(n log n)

• feasible region⋂H can be found in O(n log n) time

• ⋂H has O(n) nodes• the node p that maximizes cT p can therefore be found

in O(n log n) time

Can we do better?

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 52: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming9 - 1

Bounded LPs

Idea: Instead of computing the feasible region and thensearching for the optimal angle, do this incrementally.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 53: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming9 - 2

Bounded LPs

Idea: Instead of computing the feasible region and thensearching for the optimal angle, do this incrementally.

Invariant: Current best solution is a unique corner of thecurrent feasible polygon

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 54: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming9 - 3

Bounded LPs

Idea: Instead of computing the feasible region and thensearching for the optimal angle, do this incrementally.

Invariant: Current best solution is a unique corner of thecurrent feasible polygon

How to deal with theunbounded feasible regions?

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 55: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming9 - 4

Bounded LPs

Idea: Instead of computing the feasible region and thensearching for the optimal angle, do this incrementally.

Invariant: Current best solution is a unique corner of thecurrent feasible polygon

How to deal with theunbounded feasible regions?

Define two half-planes for a big enough value M

m1 =

{x ≤M if cx > 0

−x ≤M otherwisem2 =

{y ≤M if cy > 0

−y ≤M otherwise

c

m1m2

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 56: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming9 - 5

Bounded LPs

Idea: Instead of computing the feasible region and thensearching for the optimal angle, do this incrementally.

Invariant: Current best solution is a unique corner of thecurrent feasible polygon

How to deal with theunbounded feasible regions?

Define two half-planes for a big enough value M

m1 =

{x ≤M if cx > 0

−x ≤M otherwisem2 =

{y ≤M if cy > 0

−y ≤M otherwise

When the optimal point is notunique, select lexicographicallysmallest one!

c

m1m2

c

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 57: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming9 - 6

Bounded LPs

Idea: Instead of computing the feasible region and thensearching for the optimal angle, do this incrementally.

Invariant: Current best solution is a unique corner of thecurrent feasible polygon

How to deal with theunbounded feasible regions?

Define two half-planes for a big enough value M

m1 =

{x ≤M if cx > 0

−x ≤M otherwisem2 =

{y ≤M if cy > 0

−y ≤M otherwise

Consider a LP (H, c) with H = {h1, . . . , hn}, c = (cx, cy). Wedenote the first i constraints by Hi = {m1,m2, h1, . . . , hi},and the feasible polygon defineed by them byCi = m1 ∩m2 ∩ h1 ∩ · · · ∩ hi

When the optimal point is notunique, select lexicographicallysmallest one!

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 58: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming10 - 1

Properties

• each region Ci has a single optimal angle vi

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 59: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming10 - 2

Properties

• each region Ci has a single optimal angle vi• it holds that: C0 ⊇ C1 ⊇ · · · ⊇ Cn = C

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 60: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming10 - 3

Properties

• each region Ci has a single optimal angle vi• it holds that: C0 ⊇ C1 ⊇ · · · ⊇ Cn = C

How the optimal angle vi−1 changes when the half plane hi isadded?

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 61: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming10 - 4

Properties

• each region Ci has a single optimal angle vi• it holds that: C0 ⊇ C1 ⊇ · · · ⊇ Cn = C

How the optimal angle vi−1 changes when the half plane hi isadded?

Lemma 1: For 1 ≤ i ≤ n and bounding line `i of hi holds that:(i) If vi−1 ∈ hi then vi = vi−1,(ii) otherwise, either Ci = ∅ or vi ∈ `i.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 62: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming10 - 5

Properties

• each region Ci has a single optimal angle vi• it holds that: C0 ⊇ C1 ⊇ · · · ⊇ Cn = C

How the optimal angle vi−1 changes when the half plane hi isadded?

Lemma 1: For 1 ≤ i ≤ n and bounding line `i of hi holds that:(i) If vi−1 ∈ hi then vi = vi−1,(ii) otherwise, either Ci = ∅ or vi ∈ `i.

c

v4T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 63: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming10 - 6

Properties

• each region Ci has a single optimal angle vi• it holds that: C0 ⊇ C1 ⊇ · · · ⊇ Cn = C

How the optimal angle vi−1 changes when the half plane hi isadded?

Lemma 1: For 1 ≤ i ≤ n and bounding line `i of hi holds that:(i) If vi−1 ∈ hi then vi = vi−1,(ii) otherwise, either Ci = ∅ or vi ∈ `i.

c

v4

c

v4 = v5

h5

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 64: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming10 - 7

Properties

• each region Ci has a single optimal angle vi• it holds that: C0 ⊇ C1 ⊇ · · · ⊇ Cn = C

How the optimal angle vi−1 changes when the half plane hi isadded?

Lemma 1: For 1 ≤ i ≤ n and bounding line `i of hi holds that:(i) If vi−1 ∈ hi then vi = vi−1,(ii) otherwise, either Ci = ∅ or vi ∈ `i.

c

v4

c

v4 = v5

h5

c

v5v6

h6

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 65: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming10 - 8

Properties

• each region Ci has a single optimal angle vi• it holds that: C0 ⊇ C1 ⊇ · · · ⊇ Cn = C

How the optimal angle vi−1 changes when the half plane hi isadded?

Lemma 1: For 1 ≤ i ≤ n and bounding line `i of hi holds that:(i) If vi−1 ∈ hi then vi = vi−1,(ii) otherwise, either Ci = ∅ or vi ∈ `i.

c

v4

c

v4 = v5

h5

c

v5v6

h6

Proof on the board

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 66: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming11 - 1

One-dimentional LP

In case(ii) of Lemma 1, we search for the best point on thesegment `i ∩ Ci−1:

• we parametrize `i : y = ax+ b

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 67: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming11 - 2

One-dimentional LP

In case(ii) of Lemma 1, we search for the best point on thesegment `i ∩ Ci−1:

• we parametrize `i : y = ax+ b

• define new objective function f ic(x) = cT(

xax+b

)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 68: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming11 - 3

One-dimentional LP

In case(ii) of Lemma 1, we search for the best point on thesegment `i ∩ Ci−1:

• we parametrize `i : y = ax+ b

• define new objective function f ic(x) = cT(

xax+b

)• for j ≤ i− 1 let σx(`j , `i) denote the x-coordinate of `j ∩ `i

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 69: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming11 - 4

One-dimentional LP

In case(ii) of Lemma 1, we search for the best point on thesegment `i ∩ Ci−1:

• we parametrize `i : y = ax+ b

• define new objective function f ic(x) = cT(

xax+b

)• for j ≤ i− 1 let σx(`j , `i) denote the x-coordinate of `j ∩ `i

This gives us the following one-dimentional LP:

maximize f ic(x) = cxx+ cy(ax+ b)

with constr. x ≤ σx(`j , `i) if `i ∩ hj is limited to the rightx ≥ σx(`j , `i) if `i ∩ hj is limited to the left

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 70: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming11 - 5

One-dimentional LP

In case(ii) of Lemma 1, we search for the best point on thesegment `i ∩ Ci−1:

• we parametrize `i : y = ax+ b

• define new objective function f ic(x) = cT(

xax+b

)• for j ≤ i− 1 let σx(`j , `i) denote the x-coordinate of `j ∩ `i

This gives us the following one-dimentional LP:

maximize f ic(x) = cxx+ cy(ax+ b)

with constr. x ≤ σx(`j , `i) if `i ∩ hj is limited to the rightx ≥ σx(`j , `i) if `i ∩ hj is limited to the left

How to solve this LP? Running time?

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 71: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming11 - 6

One-dimentional LP

In case(ii) of Lemma 1, we search for the best point on thesegment `i ∩ Ci−1:

• we parametrize `i : y = ax+ b

• define new objective function f ic(x) = cT(

xax+b

)• for j ≤ i− 1 let σx(`j , `i) denote the x-coordinate of `j ∩ `i

This gives us the following one-dimentional LP:

maximize f ic(x) = cxx+ cy(ax+ b)

with constr. x ≤ σx(`j , `i) if `i ∩ hj is limited to the rightx ≥ σx(`j , `i) if `i ∩ hj is limited to the left

Lemma 2: A one-dimentional LP can be solved in linear time. Inparticular, in case (ii), one can compute the newangle vi or decide whether Ci = ∅ in O(i) time.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 72: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming12 - 1

Incremental Algorithm

2dBoundedLP(H, c,m1,m2)

C0 ← m1 ∩m2

v0 ← unique angle of C0

for i← 1 to n doif vi−1 ∈ hi then

vi ← vi−1else

vi ← 1dBoundedLP(σ(Hi−1), f ic)if vi = nil then

return infeasible

return vn

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 73: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming12 - 2

Incremental Algorithm

2dBoundedLP(H, c,m1,m2)

C0 ← m1 ∩m2

v0 ← unique angle of C0

for i← 1 to n doif vi−1 ∈ hi then

vi ← vi−1else

vi ← 1dBoundedLP(σ(Hi−1), f ic)if vi = nil then

return infeasible

return vn

O(1)

O(i)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 74: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming12 - 3

Incremental Algorithm

2dBoundedLP(H, c,m1,m2)

C0 ← m1 ∩m2

v0 ← unique angle of C0

for i← 1 to n doif vi−1 ∈ hi then

vi ← vi−1else

vi ← 1dBoundedLP(σ(Hi−1), f ic)if vi = nil then

return infeasible

return vn

O(1)

O(i)

worst-case running time:T (n) =

∑ni=1O(i) = O(n2)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 75: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming12 - 4

Incremental Algorithm

2dBoundedLP(H, c,m1,m2)

C0 ← m1 ∩m2

v0 ← unique angle of C0

for i← 1 to n doif vi−1 ∈ hi then

vi ← vi−1else

vi ← 1dBoundedLP(σ(Hi−1), f ic)if vi = nil then

return infeasible

return vn

O(1)

O(i)

worst-case running time:T (n) =

∑ni=1O(i) = O(n2)

Question: Can in reality the case(ii) happen n times?

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 76: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming12 - 5

Incremental Algorithm

2dBoundedLP(H, c,m1,m2)

C0 ← m1 ∩m2

v0 ← unique angle of C0

for i← 1 to n doif vi−1 ∈ hi then

vi ← vi−1else

vi ← 1dBoundedLP(σ(Hi−1), f ic)if vi = nil then

return infeasible

return vn

O(1)

O(i)

worst-case running time:T (n) =

∑ni=1O(i) = O(n2)

Lemma 3: Algorithmus 2dBoundedLP needs Θ(n2) time tosolve an LP with n contraints and 2 variables.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 77: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming13 - 1

What else can we do?

Obs.: It is not the half-planes H that force the high runningtime, but the order in which we consider them.

c

h1h2

h3h4h5h6

v2v3v4v5v6

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 78: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming13 - 2

What else can we do?

Obs.: It is not the half-planes H that force the high runningtime, but the order in which we consider them.

How to find (quickly) a good ordering?

c

h1h2

h3h4h5h6

v2v3v4v5v6

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 79: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming13 - 3

What else can we do?

Obs.: It is not the half-planes H that force the high runningtime, but the order in which we consider them.

How to find (quickly) a good ordering?

Zufallig!

c

h1h2

h3h4h5h6

v2v3v4v5v6

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 80: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming14

Randomized incremental algorithm

2dRandomizedBoundedLP(H, c,m1,m2)

C0 ← m1 ∩m2

v0 ← unique angle of C0

H ← RandomPermutation(H)for i← 1 to n do

if vi−1 ∈ hi thenvi ← vi−1

elsevi ← 1dBoundedLP(σ(Hi−1), f ic)if vi = nil then

return infeasible

return vn

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 81: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming15 - 1

Random permutation

RandomPermutation(A)

Input: Array A[1 . . . n]Output: Array A, rearranged into a random permutationfor k ← n to 2 do

r ← Random(k)exchange A[r] and A[k]

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 82: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming15 - 2

Random permutation

RandomPermutation(A)

Input: Array A[1 . . . n]Output: Array A, rearranged into a random permutationfor k ← n to 2 do

r ← Random(k)exchange A[r] and A[k]

Random num. between 1 and k

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 83: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming15 - 3

Random permutation

RandomPermutation(A)

Input: Array A[1 . . . n]Output: Array A, rearranged into a random permutationfor k ← n to 2 do

r ← Random(k)exchange A[r] and A[k]

Random num. between 1 and k

Obs.: The running time of 2dRandomizedBoundedLPdepends on the random permutation computed by theprocedure RandomPermutation. In the following wecompute the expected running time.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 84: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming15 - 4

Random permutation

RandomPermutation(A)

Input: Array A[1 . . . n]Output: Array A, rearranged into a random permutationfor k ← n to 2 do

r ← Random(k)exchange A[r] and A[k]

Random num. between 1 and k

Obs.: The running time of 2dRandomizedBoundedLPdepends on the random permutation computed by theprocedure RandomPermutation. In the following wecompute the expected running time.

Theorem 2: A two-dimentional LP with n constraints can besolved in O(n) randomized expected time.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 85: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming15 - 5

Random permutation

RandomPermutation(A)

Input: Array A[1 . . . n]Output: Array A, rearranged into a random permutationfor k ← n to 2 do

r ← Random(k)exchange A[r] and A[k]

Random num. between 1 and k

Obs.: The running time of 2dRandomizedBoundedLPdepends on the random permutation computed by theprocedure RandomPermutation. In the following wecompute the expected running time.

Theorem 2: A two-dimentional LP with n constraints can besolved in O(n) randomized expected time.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 86: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming15 - 6

Random permutation

RandomPermutation(A)

Input: Array A[1 . . . n]Output: Array A, rearranged into a random permutationfor k ← n to 2 do

r ← Random(k)exchange A[r] and A[k]

Random num. between 1 and k

Obs.: The running time of 2dRandomizedBoundedLPdepends on the random permutation computed by theprocedure RandomPermutation. In the following wecompute the expected running time.

Theorem 2: A two-dimentional LP with n constraints can besolved in O(n) randomized expected time.

Proof on the boardT. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 87: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming16 - 1

Unbounded LPs

Till now: Artificial contraints to bound C by m1 and m2

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 88: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming16 - 2

Unbounded LPs

Till now: Artificial contraints to bound C by m1 and m2

⋂H unbounded in the direction c

c

Next: recongnize and deal with an unbonded LP

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 89: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming16 - 3

Unbounded LPs

Till now: Artificial contraints to bound C by m1 and m2

⋂H unbounded in the direction c

c

Next: recongnize and deal with an unbonded LP

Def.: A LP (H, c) is called unbounded, if there exists a rayρ = {p+ λd | λ > 0} in C =

⋂H, such that the value

of the objective function fc becomes arbitrarily largealong ρ.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 90: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming16 - 4

Unbounded LPs

Till now: Artificial contraints to bound C by m1 and m2

⋂H unbounded in the direction c

c

Next: recongnize and deal with an unbonded LP

Def.: A LP (H, c) is called unbounded, if there exists a rayρ = {p+ λd | λ > 0} in C =

⋂H, such that the value

of the objective function fc becomes arbitrarily largealong ρ.

It must be that:• 〈d, c〉 > 0• 〈d, η(h)〉 ≥ 0 for all h ∈ H where η(h) is the normal

vector of h oriented towards the feasible side of h

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 91: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming17 - 1

Characterization

Lemma 4: A LP (H, c) is unbounded iff there is a vector d ∈ R2

such that• 〈d, c〉 > 0• 〈d, η(h)〉 ≥ 0 for all h ∈ H• LP (H ′, c) with H ′ = {h ∈ H | 〈d, η(h)〉 = 0} is

feasible.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 92: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming17 - 2

Characterization

Lemma 4: A LP (H, c) is unbounded iff there is a vector d ∈ R2

such that• 〈d, c〉 > 0• 〈d, η(h)〉 ≥ 0 for all h ∈ H• LP (H ′, c) with H ′ = {h ∈ H | 〈d, η(h)〉 = 0} is

feasible.

Test whether (H, c) is unbounded with a one-dimentional LP:Step 1:• rotate coordinate system till c = (0, 1)• normalize vector d with 〈d, c〉 > 0 as d = (dx, 1)• For normal vector η(h) = (ηx, ηy) it should hold that〈d, η(h)〉 = dxηx + ηy ≥ 0• Let H = {dxηx + ηy ≥ 0|h ∈ H}• Check whether this one-dim. LP H is feasible

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 93: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming18 - 1

Test auf Unbeschranktheit

Step 2: If Step 1 returns a feasible solution d?x• compute H ′ = {h ∈ H | d?xηx(h) + ηy(h) = 0}• Normals to H ′ are orthogonal to d = (dx, 1) ⇒ lines

bounding half-planes of H ′ are parallel to d• intersect the bounding lines of H ′ with x-axis → 1d-LP

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 94: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming18 - 2

Test auf Unbeschranktheit

Step 2: If Step 1 returns a feasible solution d?x• compute H ′ = {h ∈ H | d?xηx(h) + ηy(h) = 0}• Normals to H ′ are orthogonal to d = (dx, 1) ⇒ lines

bounding half-planes of H ′ are parallel to d• intersect the bounding lines of H ′ with x-axis → 1d-LP

If the two steps result in a feasible solution, the LP (H, c) isunbounded and we can construct the ray ρ.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 95: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming18 - 3

Test auf Unbeschranktheit

Step 2: If Step 1 returns a feasible solution d?x• compute H ′ = {h ∈ H | d?xηx(h) + ηy(h) = 0}• Normals to H ′ are orthogonal to d = (dx, 1) ⇒ lines

bounding half-planes of H ′ are parallel to d• intersect the bounding lines of H ′ with x-axis → 1d-LP

If the two steps result in a feasible solution, the LP (H, c) isunbounded and we can construct the ray ρ.

If the LP H ′ in Step 2 is infeasible, then then so is the initialLP (H, c).

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 96: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming18 - 4

Test auf Unbeschranktheit

Step 2: If Step 1 returns a feasible solution d?x• compute H ′ = {h ∈ H | d?xηx(h) + ηy(h) = 0}• Normals to H ′ are orthogonal to d = (dx, 1) ⇒ lines

bounding half-planes of H ′ are parallel to d• intersect the bounding lines of H ′ with x-axis → 1d-LP

If the two steps result in a feasible solution, the LP (H, c) isunbounded and we can construct the ray ρ.

If the LP H ′ in Step 2 is infeasible, then then so is the initialLP (H, c).

If the LP H of the Step 1 is infeasible, then by Lemma 4,(H, c) is bounded.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 97: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming19 - 1

Certificates of boundness

Obs.: When the LP H = {dxηx + ηy ≥ 0|h ∈ H} of theStep 1 is infeasible, we can use this informationfurther!

dleftxdrightx

1d-LP H is infeasible ⇔ the interval [dleftx , drightx ] = ∅

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 98: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming19 - 2

Certificates of boundness

Obs.: When the LP H = {dxηx + ηy ≥ 0|h ∈ H} of theStep 1 is infeasible, we can use this informationfurther!

dleftxdrightx

1d-LP H is infeasible ⇔ the interval [dleftx , drightx ] = ∅• let h1 and h2 be the half planes corresponding to dleftx anddrightx• There is no vector d that would “satisfy” h1 and h2, thus• the LP ({h1, h2}, c) is already bounded• h1 and h2 are certificates of the boundness• use h1 and h2 in 2dRandomizedBoundedLP as m1 and m2

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 99: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming20 - 1

Algorithms

2dRandomizedLP(H, c)

∃? Vector d with 〈d, c〉 > 0 and 〈d, η(h)〉 ≥ 0 for all h ∈ Hif d exists then

H ′ ← {h ∈ H | 〈d, η(h)〉 = 0}if H ′ feasible then

return (ray ρ, unbounded)else

return infeasible

else(h1, h2)← Certificates for the boundness of (H, c)

H ← H \ {h1, h2}return 2dRandomizedBoundedLP(H, c, h1, h2)

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 100: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming20 - 2

Algorithms

2dRandomizedLP(H, c)

∃? Vector d with 〈d, c〉 > 0 and 〈d, η(h)〉 ≥ 0 for all h ∈ Hif d exists then

H ′ ← {h ∈ H | 〈d, η(h)〉 = 0}if H ′ feasible then

return (ray ρ, unbounded)else

return infeasible

else(h1, h2)← Certificates for the boundness of (H, c)

H ← H \ {h1, h2}return 2dRandomizedBoundedLP(H, c, h1, h2)

Theorem 3: A two-dimentional LP with n constraints can besolved in O(n) randomized expected time.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 101: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming21 - 1

Discussion

Can the two-dimentional algorithms be generalized to moredimentions?

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 102: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming21 - 2

Discussion

Can the two-dimentional algorithms be generalized to moredimentions?

Yes! The same way as the two-dimentional LP is solved incrementallywith reduction to a one-dimentional LP, a d-dimentional LP can besolved by a randomized incremental algorithm with a reduction to(d− 1)-dimentional LP. The expected running time is then O(cdd!n) fora constant c. The algorithm is therefore usefull only for small values on d.

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming

Page 103: Linear Programming Computational Geometry Lecture

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming21 - 3

Discussion

Can the two-dimentional algorithms be generalized to moredimentions?

Yes! The same way as the two-dimentional LP is solved incrementallywith reduction to a one-dimentional LP, a d-dimentional LP can besolved by a randomized incremental algorithm with a reduction to(d− 1)-dimentional LP. The expected running time is then O(cdd!n) fora constant c. The algorithm is therefore usefull only for small values on d.

The simple randomized incremental algorithm for two and moredimentions given in this lecture is due to Seidel (1991).

T. Mchedlidze · D. Strash · Computational Geometry Linear Programming