Presentation is loading. Please wait.

Presentation is loading. Please wait.

Simplex “walk on the vertices of the feasible region” v = current vertex if  neighbor v’ of v with better objective then move to v’

Similar presentations


Presentation on theme: "Simplex “walk on the vertices of the feasible region” v = current vertex if  neighbor v’ of v with better objective then move to v’"— Presentation transcript:

1 Simplex “walk on the vertices of the feasible region” v = current vertex if  neighbor v’ of v with better objective then move to v’

2 Simplex “walk on the vertices of the feasible region” vertex = feasible point defined by a collection of d inequalities neighbors = vertices sharing d-1 of the inequalities

3 Simplex v = current vertex if  neighbor v’ of v with better objective then move to v’ max c T x Ax  b x  0 assume v = (0,...,0) T  i such that c i > 0 iff v is not optimal

4 Simplex v = current vertex if  neighbor v’ of v with better objective then move to v’ max c T x Ax  b x  0 v’ = (0,..,x i,..,0) T Make x i as big as possible stopper: a j x = b j

5 Simplex v = current vertex if  neighbor v’ of v with better objective then move to v’ max c T x Ax  b x  0 v’ = (0,..,x i,..,0) T Make x i as big as possible stopper: a j x = b j x i ’ = b j – a j xSubstitute:

6 Simplex max 2x+y x+y  4 y-x  1 x-y  2 y  2 x  0 y  0 Is (x,y)=(0,0) optimal?

7 Simplex max 2x+y x+y  4 y-x  1 x-y  2 y  2 x  0 y  0 Let’s increase y as much as we can.

8 Simplex max 2x+y x+y  4 y-x  1 x-y  2 y  2 x  0 y  0 substitute z=1-(y-x)

9 Simplex max 2x+y x+y  4 y-x  1 x-y  2 y  2 x  0 y  0 substitute z=1-(y-x) z  0 y  x-z+1

10 Simplex max 2x+y x+y  4 y-x  1 x-y  2 y  2 x  0 y  0 y  x-z+1 max 3x-z+1 2x-z  3 z  0 z  1 x-z  1 x  0 z-x  1

11 Simplex max 3x-z+1 2x-z  3 z  0 z  1 x-z  1 x  0 z-x  1 Is (x,z)=(0,0) optimal?

12 Simplex max 3x-z+1 2x-z  3 z  0 z  1 x-z  1 x  0 z-x  1 Let’s increase x as much as we can.

13 Simplex max 3x-z+1 2x-z  3 z  0 z  1 x-z  1 x  0 z-x  1 substitute w=1-(x-z)

14 Simplex max 3x-z+1 2x-z  3 z  0 z  1 x-z  1 x  0 z-x  1 substitute w=1-(x-z) w  0 x  1+z-w

15 Simplex max 3x-z+1 2x-z  3 z  0 z  1 x-z  1 x  0 z-x  1 x  1+z-w max 2z-3w+4 z-2w  1 z  0 z  1 w  0 w-z  1 w  2

16 Simplex max 2z-3w+4 z-2w  1 z  0 z  1 w  0 w-z  1 w  2 Is (z,w)=(0,0) optimal?

17 Simplex max 2z-3w+4 z-2w  1 z  0 z  1 w  0 w-z  1 w  2 Let’s increase z as much as we can.

18 Simplex max 2z-3w+4 z-2w  1 z  0 z  1 w  0 w-z  1 w  2 substitute u=1-(z-2w)

19 Simplex max 2z-3w+4 z-2w  1 z  0 z  1 w  0 w-z  1 w  2 substitute u=1-(z-2w) u  0 z  1+2w-u

20 Simplex max 2z-3w+4 z-2w  1 z  0 z  1 w  0 w-z  1 w  2 z  1+2w-u max w-2u+6 u  0 u-2w  1 2w-u  2 w  0 u-w  2 w  2

21 Simplex max w-2u+6 u  0 u-2w  1 2w-u  2 w  0 u-w  2 w  2 Is (u,w)=(0,0) optimal?

22 Simplex max w-2u+6 u  0 u-2w  1 2w-u  2 w  0 u-w  2 w  2 Let’s increase w as much as we can.

23 Simplex max w-2u+6 u  0 u-2w  1 2w-u  2 w  0 u-w  2 w  2 substitute v=2-(2w-u)

24 Simplex max w-2u+6 u  0 u-2w  1 2w-u  2 w  0 u-w  2 w  2 substitute v=2-(2w-u) v  0 w  1+u/2-v/2

25 Simplex max w-2u+6 u  0 u-2w  1 2w-u  2 w  0 u-w  2 w  2 w  1+u/2-v/2 max 7-3u/2-v/2 u  0 v  3 v  0 v-u  2 u+v  6 u-v  2

26 Simplex max 7-3u/2-v/2 u  0 v  3 v  0 v-u  2 u+v  6 u-v  2 Is (u,v)=(0,0) optimal?

27 Simplex max 7-3u/2-v/2 u  0 v  3 v  0 v-u  2 u+v  6 u-v  2 Is (u,v)=(0,0) optimal? YES 7

28 Simplex (u,v)=(0,0) w  1+u/2-v/2 = 1 z  1+2w-u = 3 x  1+z-w = 3 y  x-z+1 = 1 (x,y)=(3,1)

29 Simplex (x,y)=(3,1) max 2x+y x+y  4 y-x  1 x-y  2 y  2 x  0 y  0 is an optimal solution

30 Simplex – geometric view (x,y)=(3,1) max 2x+y x+y  4 y-x  1 x-y  2 y  2 x  0 y  0

31 Getting the first point min c T x Ax=b x  0 min 1 T z A x + z = b x  0 z  0 wlog b  0

32

33 Points, lines point = (x,y) line = (x 1,y 1 ),(x 2,y 2 ) 2 points =

34 Line as a point and a vector point = (x,y) line = (x 1,y 1 ),(x 2 -x 1,y 2 -y 1 ) point and a vector = x 1 +t (x 2 -x 1 ),y 1 +t (y 2 -y 1 )

35 Is point on a line? point = (x,y) line = (x 1,y 1 ),(x 2,y 2 ) x=x 1 +t (x 2 -x 1 ) y=y 1 +t (y 2 -y 1 )

36 Is point on a line? point = (x,y) line = (x 1,y 1 ),(x 2,y 2 ) t (x 2 -x 1 )=x-x_1 t (y 2 -y 1 )=y-y_1 x 2 -x 1 x-x 1 y 2 -y 1 y-y 1 ( ) det

37 Is point on a line? point = (x,y) line = (x 1,y 1 ),(x 2,y 2 ) x 2 -x 1 x-x 1 y 2 -y 1 y-y 1 ( ) det is on if and only if = 0

38 Is point on a line? x 2 -x 1 x-x 1 y 2 -y 1 y-y 1 ( ) det =0 for x on the line >0 <0

39 Line segment line segment = (x 1,y 1 ),(x 2,y 2 ) x=x 1 +t (x 2 -x 1 ) y=y 1 +t (y 2 -y 1 ) t  [0,1]

40 Do two line segments intersect? a 1 =(x 1,y 1 ), a 2 =(x 2,y 2 ) a 3 =(x 3,y 3 ), a 4 = (x 4,y 4 ) a1a1 a2a2 a3a3 a4a4 L1L1 L2L2 a 1 and a 2 on different sides of L 2 a 3 and a 4 on different sides of L 1 or endpoint of a segment lies on the other segment

41 Many segments, do any 2 intersect? (a 1,b 1 ) (a 2,b 2 )... (a n,b n ) O(n 2 ) algorithm

42 Many segments, do any 2 intersect? O(n log n) algorithm assume no two points have the same x-coordinate no 3 segments intersect at one point

43 Sweep algorithm

44 sort points by the x-coordinate

45 Sweep algorithm events: insert segment delete segment

46 Sweep algorithm will find the left-most intersection point the lines are “neighbors on the sweep line”

47 Sweep algorithm sort the endpoints by x-coord  p 1,...,p 2n T  empty B-tree for i from 1 to 2n do if p i is the left point of a segment s INSERT s into T check if s intersects prev(s) or next(s) in T if p i is the right point of a segment s check if prev(s) interesects next(s) in T DELETE s from T

48 Area of a simple polygon (x 1,y 1 ) (x 3,y 3 ) (x 2,y 2 )

49 Area of a simple polygon (x 1,y 1 ),...,(x n,y n )

50 Area of a simple polygon (x 1,y 1 ),...,(x n,y n ) R=0 for i from 1 to n do R=R+(y i+1 +y i )*(x i+1 -x i ) return |R|/2 (x n+1,y n+1 )=(x 1,y 1 )

51 Convex hull smallest convex set containing all the points

52 Convex hull smallest convex set containing all the points

53 Jarvis march find the left-most point (assume no 3 points colinear) s

54 Jarvis march find the point that appears most to the right looking from s (assume no 3 points colinear) s

55 Jarvis march (assume no 3 points colinear) s p find the point that appears most to the right looking from p

56 Jarvis march (assume no 3 points colinear)

57 Jarvis march (assume no 3 points colinear)

58 Jarvis march (assume no 3 points colinear) s  point with smallest x-coord p  s repeat PRINT(p) q  point other than p for i from 1 to n do if i  p and point i to the right of line (p,q) then q  i p  q until p = s


Download ppt "Simplex “walk on the vertices of the feasible region” v = current vertex if  neighbor v’ of v with better objective then move to v’"

Similar presentations


Ads by Google