Download presentation
Presentation is loading. Please wait.
Published byAugustus Rodgers Modified over 8 years ago
1
UNC Chapel Hill M. C. Lin Randomized Linear Programming For any set of H of half-planes, there is a good order to treat them. Thus, we can improve the expected running time to O(n). There is no good way to determining an ordering of H, so simply pick a random ordering. Worst case for RLP: O(n 2 ), but maybe better!
2
UNC Chapel Hill M. C. Lin 2DRandomizedLP(H,c) Input: A line program (H, c) where H is set of n half-planes, c R 2 Output: if (H, c) is unbounded, a ray p completely contained in the feasible region is reported. If (H, c) is infeasible, then this fact is reported. Else, a feasible point p that maximizes f c (p) is reported. 1. if UnboundedLP( H, c ) reports that ( H, c ) is unbounded/infeasible 2. then Report that info and, in the unbounded case, a ray along which ( H, c ) is unbounded 3. else Let h 1, h 2 H be the 2 certificat half-planes returned by UnboundedLP; let v 2 be the intersection point of l 1 & l 2 4. Compute a random permutation h 3, …, h n of remaining half-planes by calling RandomPermutation( H[3…n] )
3
UNC Chapel Hill M. C. Lin 2DRandomizedLP(H,c) 5. for i 3 to n 6. do if v i-1 h i 7. then v i v i-1 8. else v i the point p on l i that maximizes f c (p), subject to the constraints, h 1, …, h i-1 9. if p does not exist 10. then Report that LP is infeasible & quit. 11. return v n
4
UNC Chapel Hill M. C. Lin RandomPermutation(A) Input: An array A [1…n] Output: The array A [1…n] with the same elements, but rearranged into a random permutation. 1. for k n downto 2 2. do rndindex RANDOM( k ) 3. Exchange A [ k ] and A [ rndindex ] RANDOM( ) takes k as input & generate a random integer btw 1 and k in constant time
5
UNC Chapel Hill M. C. Lin R-LP Algorithm Analysis There are ( n-2 )! possible permutation of half-planes in 2D R-LP, each with equal likelihood. The average expected running time over all ( n -2)! possibilities is E[ 3 i n O(i)·X i ] = 3 i n O(i)·E[X i ] = 3 i n O(i)·[2/(i-2)] = O(n) The 2D-LP problem with n constraints can be solved in O(n) randomized expected time using worst-case linear storage.
6
UNC Chapel Hill M. C. Lin Unbounded Linear Programming Let H = { h 3, …, h n } and let n i be the outward normal of h i. l i denotes the line bounding h i. Let i denote the smallest angle that makes with c, with 0 j 180 . Half-planes h i with a minimal value of i are crucial in deciding whether LP is bounded or not. Let be a half- plane s.t. i = min 1 j n j and define H min { h j H | n j = n i } H par { h j H | n j = -n i } If (H min H par ) is empty, then the LP is infeasible. If (H min H par ) isn’t , l i * bounds one side with h i * H min : –If l i * h j is unbounded in c for every h j in H \(H min H par ), LP is unbnd –If l i * h j * is bounded in c for some h j * in H \(H min H par ), LP is bnded
7
UNC Chapel Hill M. C. Lin UnboundedLP(H,c) Input: A line program (H, c) where H is set of n half-planes, c R 2 Output: if (H, c) is unbounded, o/p a ray p completely contained in the feasible region. If (H, c) is bounded, o/p either consists of 2 half-planes h i * and h j * from H s.t. ({ h i *, h j *}, c ) is bounded, or it reports that LP is infeasible. 1. For each half-plane h i H, compute the angle i 2. Let h i be a half-plane with i = min 1 j n j 3. H min { h j H | n j = n i } 4. H par { h j H | n j = -n i } 5. H * H \ (H min H par ) 6. Compute the intersection of half-planes in H min H par
8
UNC Chapel Hill M. C. Lin UnboundedLP(H,c) 7. if the intersection is empty 8. then Report that (H,c) is infeasible 9. else Let h i * H min be the half-plane whose bounding line bounds the intersection. 10. if there is a half-plane h j * H* s.t. l i * h j * is bounded in direction c 11. then Report that ({ h i *, h j *}, c ) is bounded 12. else Report that (H,c) is unbounded along the ray l i * ( H*) Algorithm UnboundedLP decides in O(n) time whether a 2D-LP with n constraints is unbounded.
9
UNC Chapel Hill M. C. Lin When UnboundedLP is Not Needed When we only want to know if there is a feasible point We have a priori bound A on the absolute value of the solution. In such a case, we can add 2d constraints of the form x i A, and -A x i, for 1 i d.
10
UNC Chapel Hill M. C. Lin LP in Higher Dimensions The 3D-LP w/ n constraints can be solved in O(n) expected time using linear storage. The d -dimensional LP problem with n constraints can be solved in O(d!n) expected time using linear storage. RLP is only useful for lower dimensional problems. Other LP techniques, such as the simplex algorithm, are preferred for higher dimensions. Similar optimization techniques in higher dimensions are used to solve molecular confirmation problems, by minimizing total energy of the state, subject to constraints on joint-angle, bonds/forces, etc.
11
UNC Chapel Hill M. C. Lin Collision Detection The problem in 3D can be posed as: Maximize1 Subject toa 11 x + a 12 y + a 13 z b 1 : a m1 x + a m2 y + a m3 z b m c 11 x + c 12 y + c 13 z d 1 : c n1 x + c n2 y + c n3 z d n where (a i1, a i2, a i3, b i ) and (c k1, c k2, c k3, d k ) represent the outward normals of the faces of convex polyhedra A & B. If the LP is feasible, then A&B’ve collided.
12
UNC Chapel Hill M. C. Lin Smallest Enclosing Discs A robot arm whose base is fixed and has to pick up items at various points and locate them at other points. Problem: what would be a good position for the base of the arm? A good position is at the center of the smallest disc that encloses all the points.
13
UNC Chapel Hill M. C. Lin Transform to a Randomized Algorithm Generate a random permutation p 1, …, p n of P Let P i = { p 1, …, p i }. We add points one by one, while maintaining D i, the smallest enclosing disc of P i. Let 2 < i < n, P i and D i be defined as above, we have: –if p i D i-1, then D i = D i-1 –if p i D i-1, else p i lies on the boundary of D i
14
UNC Chapel Hill M. C. Lin MiniDisc(P) Input: A set P of n points in the plane Output: The smallest enclosing disc for P 1. Compute a random permutation p 1, …, p n of P 2. Let D 2 be the smallest enclosing disc for { p 1, p 2 } 3. for i 3 to n 4. do if p i D i-1 5. then D i D i-1 6. else D i MiniDiscWithPoint({ p 1, …, p i-1 }, p i ) 7. return D n
15
UNC Chapel Hill M. C. Lin MiniDiscWithPoint(P,q) Input: A set P of n points in the plane, and a point q s.t. there exists an enclosing disc for P with q on its boundary Output: The smallest enclosing disc for P with q on its bndary 1. Compute a random permutation p 1, …, p n of P 2. Let D 1 be smallest enclosing disc w/ q & p 1 on its boundary 3. for j 2 to n 4. do if p j D j-1 5. then D j D j-1 6. else D j MiniDiscWith2Point({ p 1, …, p j-1 }, p j, q ) 7. return D n
16
UNC Chapel Hill M. C. Lin MiniDiscWith2DPoint(P,q 1,q 2 ) Input: A set P of n points in the plane, and two points q 1 & q 2 s.t. there exists an enclosing disc for P with q 1 & q 2 on boundary Output: The smallest enclosing disc for P with q 1 & q 2 on bndary 1. Let D 0 be smallest enclosing disc w/ q 1 & q 2 on boundary 2. for k 1 to n 3. do if p k D k-1 4. then D k D k-1 5. else D k the disc w/ q 1, q 2 and p k on its boundary 6. return D n
17
UNC Chapel Hill M. C. Lin Algorithm Analysis The running time of MiniDiscWithPoint is O(n) without call to MiniDiscWith2Points. The probability of making such a call is 2/i. The total expect run time of MiniDiscWithPoint is O(n) + 2 i n O(i)·(2/i) = O(n) Applying the same argument once more. We have: the smallest enclosing disc for a set of n points in the plane can be computed in O(n) expected time using worst-case O(n) storage
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.