halfplane intersection and linear programming

34
Halfplane Intersection and Linear Programming Dan Halperin, Tel Aviv University Figures and pseudocode taken from: CGAA: Chapter 4 in Computational Geometry Algorithms and Applications, de Berg et al

Upload: others

Post on 08-May-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Halfplane Intersection and Linear Programming

Halfplane Intersectionand

Linear Programming

Dan Halperin, Tel Aviv University

Figures and pseudocode taken from:

CGAA: Chapter 4 in Computational Geometry Algorithms and Applications, de Berg et al

Page 2: Halfplane Intersection and Linear Programming

Overview

β€’ The casting problem

β€’ Half-plane intersection

β€’ Linear programming (LP) in low dimensions

β€’ Minimum enclosing disc

β€’ The casting problem, take II (later on in the semester)

Page 3: Halfplane Intersection and Linear Programming

Credits

β€’ CGAA: Chapter 4 in Computational Geometry Algorithms and Applications, Linear Programming, by de Berg et al

β€’ L5vK: Lecture 5 in Computational Geometry, Casting a polyhedron, by Marc van Kreveld

Page 4: Halfplane Intersection and Linear Programming

Slides, Part I

β€’ Lecture 5 in Computational Geometry, Casting a polyhedron, by Marc van Kreveld (Slides4a):β€’ The casting problem

β€’ Half-plane intersection

β€’ Linear programming (LP) in low dimensions

β€’ Supplements, here:β€’ The space of directions

β€’ Probabilistic analysis of LP2D

β€’ Unbounded LP2D

β€’ LP3D

Page 5: Halfplane Intersection and Linear Programming

The space of directions

Page 6: Halfplane Intersection and Linear Programming

[blog.weatherflow.com]

Page 7: Halfplane Intersection and Linear Programming

Representing directions in the plane

β€’ Using the unit circle 𝑆1

β€’ The point 𝑝 represents the vector from the origin to 𝑝

Page 8: Halfplane Intersection and Linear Programming

Representing upward directions

β€’ Using the line 𝑦 = 1

β€’ The point 𝑝′ represents the vector from the origin to 𝑝′

Page 9: Halfplane Intersection and Linear Programming

Representing directions in (3-)space

β€’ Using the unit sphere 𝑆2

β€’ Upward directions: the plane 𝑧 = 1

Page 10: Halfplane Intersection and Linear Programming

LP2D randomized, boundedAnalysis

Page 11: Halfplane Intersection and Linear Programming
Page 12: Halfplane Intersection and Linear Programming

Running time analysis

β€’ Random permutation: 𝑂(𝑛)

β€’ Line 5, the `easy’ case, 𝑣𝑖 βˆ’ 1 βˆ‰ 𝐻𝑖 : 𝑂(𝑛) (𝑣 subscript 𝑖 minus 1)

β€’ It remains to estimate the running time of all the `hard’ cases

β€’ Let 𝑋𝑖 be the indicator random variable, which is 1 if Step 𝑖 is a hard case and 0 otherwise

β€’ The running time of all the hard cases: σ𝑖=1𝑛 𝑂 𝑖 𝑋𝑖

β€’ Randomized analysisβˆ’the expected value of the running time 𝐸(σ𝑖=1

𝑛 𝑂 𝑖 𝑋𝑖)

Page 13: Halfplane Intersection and Linear Programming

β€’ In what follows, we assume that the first two half-planes β„Ž1, β„Ž2 are fixed, so our randomized analysis focuses on steps 𝑖 = 3,… , 𝑛

Page 14: Halfplane Intersection and Linear Programming

Running time analysis, cont’d

β€’ Randomized analysisβˆ’the expected value of the running time 𝐸(σ𝑖=3

𝑛 𝑂 𝑖 𝑋𝑖)

β€’ Using linearity of expectation, 𝐸(σ𝑖=3𝑛 𝑂 𝑖 𝑋𝑖) = σ𝑖=3

𝑛 𝑂 𝑖 𝐸(𝑋𝑖)

β€’ 𝐸 𝑋𝑖 = ?

β€’ The expected value of an indicator random variable is the probability that 𝑋𝑖 = 1

β€’ Let’s start with 𝑋𝑛

Page 15: Halfplane Intersection and Linear Programming

The last step

β€’ What is the probability that 𝑋𝑛 = 1?

β€’ Pr[𝑋𝑛 = 1]≀2

π‘›βˆ’2

β€’ Why at most?β€’ more than two lines meet at 𝑣𝑛‒ 𝑣𝑛 is defined by β„Ž1 or β„Ž2

[CGAA]

Page 16: Halfplane Intersection and Linear Programming

The 𝑖th step

β€’ What is the probability that 𝑋𝑖 = 1?

β€’ Let’s first assume that the set of half-planes β„Ž3 … β„Žπ‘– is fixed

β€’ Then the previous argument holds and the probability is ≀2

π‘–βˆ’2

β€’ But every subset of 𝑖 βˆ’ 2 half-planes has the same probability to be those β„Ž3 … β„Žπ‘–

β€’ Hence, Pr[𝑋𝑖 = 1]≀2

π‘–βˆ’2

Page 17: Halfplane Intersection and Linear Programming

Summary

β€’ 𝐸(σ𝑖=3𝑛 𝑂 𝑖 𝑋𝑖) = σ𝑖=3

𝑛 𝑂 𝑖 𝐸(𝑋𝑖) ≀ σ𝑖=3𝑛 𝑂 𝑖

2

π‘–βˆ’2= 𝑂(𝑛)

β€’ Together with the other costs, the algorithm runs in expected 𝑂(𝑛) time

Page 18: Halfplane Intersection and Linear Programming

LP2D unbounded

Page 19: Halfplane Intersection and Linear Programming

Possible outcomes of LP2D

β€’ We now consider also the case where the program may be unbounded

β€’ Possible output:β€’ The optimal (maximal) solution, as before

β€’ The program is infeasible, as before

β€’ The program is unbounded: a ray along which the solution gets arbitrarily large values

Page 20: Halfplane Intersection and Linear Programming

Overall scheme for general LP2D

β€’ We will start by testing for the unbounded case, with possible outcomes:β€’ The program is infeasible, stop

β€’ The program is unbounded, with the desired ray, stop

β€’ The program is bounded, together with two witness half-planes β„Ž1, β„Ž2 for the boundedness, continue to the previous, bounded, procedure

β€’ Notice that our guarantee that the program is bounded does not preclude the case that it is infeasible, which will be found by the previous (bounded) procedure

Page 21: Halfplane Intersection and Linear Programming

Notation

β€’ LP2D(𝐻, Ԧ𝑐)

β€’ 𝐻 = {β„Ž1, … , β„Žπ‘›}

β€’ Ԧ𝑐 is the objective vector

β€’ The LP is unbounded if there is a ray 𝜌 fully contained in the feasible region and such that the objective function grows arbitrarily as we proceed along 𝜌 away from its terminus 𝑝

β€’ We denote the ray’s direction by Ԧ𝑑

β€’ 𝜌 = {𝑝 + πœ† Ԧ𝑑: πœ† > 0}

Page 22: Halfplane Intersection and Linear Programming

Notation, cont’d

β€’ For a half-plane β„Ž ∈ 𝐻 , Τ¦πœ‚ (β„Ž) is the normal to the line defining the half-plane and pointing into the feasible region of β„Ž

Page 23: Halfplane Intersection and Linear Programming

Necessary conditions for unboundedness

𝜌 = {𝑝 + πœ† Ԧ𝑑: πœ† > 0}

β€’ Ԧ𝑑 βˆ™ Ԧ𝑐 > 0

β€’ for each half-plane β„Ž ∈ 𝐻 , Τ¦πœ‚ (β„Ž) βˆ™ Ԧ𝑑 β‰₯ 0

Let 𝐻′ = {β„Ž ∈ 𝐻: Τ¦πœ‚ (β„Ž) βˆ™ Ԧ𝑑 = 0}, the we also require the following boundary condition:

β€’ the linear program 𝐻′, Ԧ𝑐 is feasible

Page 24: Halfplane Intersection and Linear Programming

Conditions for unboundedness

Claim: (𝐻, Ԧ𝑐) is unbounded iff there is a direction Ԧ𝑑 with Ԧ𝑑 βˆ™ Ԧ𝑐 > 0 such that for each β„Ž ∈ 𝐻 , Τ¦πœ‚ (β„Ž) βˆ™ Ԧ𝑑 β‰₯ 0 , and the linear program 𝐻′, Ԧ𝑐 is feasible

β€’ We showed that the conditions are necessary. We will show that they are sufficient by constructing the witness ray 𝜌

Page 25: Halfplane Intersection and Linear Programming

Constructing the ray 𝜌

β€’ Assume Ԧ𝑐 = (0,1)

β€’ Then the ray must be directed upward, and we can represent the possible directions Ԧ𝑑 by the line 𝑦 = 1, Ԧ𝑑 =(dx,1)

β€’ Every constraint of the form Τ¦πœ‚ (β„Ž) βˆ™ Ԧ𝑑 β‰₯ 0 becomes a half-line, ray, on the line 𝑦 = 1

β€’ The valid directions:

The intersection of all

these rays

Page 26: Halfplane Intersection and Linear Programming

The valid directions

β€’ Recall

[L5vK]

Page 27: Halfplane Intersection and Linear Programming

β€’ Assume first that the intersection is not empty

β€’ We take the direction at the left endpoint of the interval (if it is bounded only on the right, we take the right endpoint)

β€’ Denote it by Ԧ𝑑

β€’ We first need to check that Ԧ𝑑 is valid (relevant only if the interval is a single point)

β€’ The validity check is in the original plane, where we aim to construct the ray 𝜌

β€’ The test: is the linear program 𝐻′, Ԧ𝑐 is feasible

Page 28: Halfplane Intersection and Linear Programming

Is the linear program 𝐻′, Ԧ𝑐 is feasible?

β€’ Recall: 𝐻′ = {β„Ž ∈ 𝐻: Τ¦πœ‚ (β„Ž) βˆ™ Ԧ𝑑 = 0}

β€’ Outcome 1: If infeasible, report that the original LP infeasible and stop

Page 29: Halfplane Intersection and Linear Programming

If 𝐻′, Ԧ𝑐 is feasible

β€’ Outcome 2: Stick to the left wall of the feasible region and construct the ray there

Page 30: Halfplane Intersection and Linear Programming

If no valid direction Ԧ𝑑 exists

β€’ Namely 𝑝𝑙 > π‘π‘Ÿ, then the half-planes inducing 𝑝𝑙 and π‘π‘Ÿ are witnesses to the boundedness of the LP

β€’ Outcome 3: Go to the bounded procedure and start with these two half-planes as β„Ž1 and β„Ž2

Page 31: Halfplane Intersection and Linear Programming

LP3D

Page 32: Halfplane Intersection and Linear Programming

The input

β€’ LP3D(𝐻, Ԧ𝑐)

β€’ 𝐻 = β„Ž1, … , β„Žπ‘› , half-spacesβ€’ β„Žπ‘– is bounded by the plane 𝑔𝑖

β€’ Ԧ𝑐 is the objective vector

β€’ Assume we have already run LP3DUnbounded, and obtained three witnesses to the boundedness of LP3D(𝐻, Ԧ𝑐)

β€’ Let’s rename these three half-space β„Ž1, β„Ž2, β„Ž3β€’ They define an optimum 𝑣3

Page 33: Halfplane Intersection and Linear Programming

The incremental step

β€’ We now add β„Ž4β€’ If 𝑣3 ∈ β„Ž4 then 𝑣4: = 𝑣3β€’ Else, 𝑣4 lies on 𝑔4

β€’ How do we find 𝑣4?

[gdbooks/3dcollisions]

Page 34: Halfplane Intersection and Linear Programming

THE END