BerGeo/h2/howto

57 lines
1.3 KiB
Plaintext
Raw Normal View History

2018-10-08 13:35:14 +00:00
---- MbC ---
MbC(P: l, r): (finds UH of P from x-coordinates l to r)
Find median x-coordinate x_m
Partition points on x_m into Pl and Pr
Find bridge uv over x_m
Remove points below bridge
Recurse MbC(Pl: l, u.x) and MbC(Pr: v.x, r)
Find bridge is finding the line (y=ax+b) such that:
1) passes above all the points
2) has the lowest intersection point with the median line
---- 1D ----
Unknown x1
Minimize c1*x1
such that
a1*x1 \leq b1
a2*x1 \leq b2
...
an*x1 \leq bn
for each of the constraints:
ai*x1 \leq bi
=>
if ai > 0: x1 <= bi/ai
if ai < 0: x1 >= bi/ai
if ai = 0:
if bi < 0: impossible
if bi \geq 0: always satisfied
this means that each constraint half of the real line
therefore run for-loop on bi/ai and check the ifs
when we have feasible region/interval:
if c1 > 0: choose minimum of interval
if c1 < 0: choose maximum of interval
if c1 = 0: degenerate
---- 2D ----
a and b are unknowns
minimize ax_m + b
such that y_i \leq ax_i + b, for every input point (x_i, y_i)
where x_m is given (median)
Algorithm:
Initialise v
Randomly shuffle constraints
for i=1 to n:
if constraint i does not violate v, do nothing
else solve 1d LP on boundary of constraint i