simplex

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

Upload: merrill-donaldson

Post on 01-Jan-2016

13 views

Category:

Documents


0 download

DESCRIPTION

Simplex. “walk on the vertices of the feasible region”. v = current vertex if  neighbor v’ of v with better objective then move to v’. Simplex. “walk on the vertices of the feasible region”. vertex = feasible point defined by a collection of d inequalities. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Simplex

Simplex

“walk on the verticesof the feasible region”

v = current vertexif neighbor v’ of v with better objectivethen move to v’

Page 2: Simplex

Simplex

“walk on the verticesof the feasible region”

vertex = feasible point defined by a collection of d inequalities

neighbors = vertices sharing d-1 of the inequalities

Page 3: Simplex

Simplex v = current vertexif neighbor v’ of v with better objectivethen move to v’max cT x

Ax bx 0

assume v = (0,...,0)T

i such that ci > 0 iff v is not optimal

Page 4: Simplex

Simplex v = current vertexif neighbor v’ of v with better objectivethen move to v’max cT x

Ax bx 0

v’ = (0,..,xi,..,0)T

Make xi as big as possible stopper: aj x = bj

Page 5: Simplex

Simplex v = current vertexif neighbor v’ of v with better objectivethen move to v’max cT x

Ax bx 0

v’ = (0,..,xi,..,0)T

Make xi as big as possible stopper: aj x = bj

xi’ = bj – aj xSubstitute:

Page 6: Simplex

Simplex

max 2x+yx+y 4y-x 1x-y 2y 2x 0y 0

Is (x,y)=(0,0) optimal?

Page 7: Simplex

Simplex

max 2x+yx+y 4y-x 1x-y 2y 2x 0y 0

Let’s increase y as much as we can.

Page 8: Simplex

Simplex

max 2x+yx+y 4y-x 1x-y 2y 2x 0y 0

substitute z=1-(y-x)

Page 9: Simplex

Simplex

max 2x+yx+y 4y-x 1x-y 2y 2x 0y 0

substitute z=1-(y-x)z 0y x-z+1

Page 10: Simplex

Simplex

max 2x+yx+y 4y-x 1x-y 2y 2x 0y 0

y x-z+1

max 3x-z+12x-z 3z 0z 1x-z 1x 0z-x 1

Page 11: Simplex

Simplex

max 3x-z+12x-z 3z 0z 1x-z 1x 0z-x 1

Is (x,z)=(0,0) optimal?

Page 12: Simplex

Simplex

max 3x-z+12x-z 3z 0z 1x-z 1x 0z-x 1

Let’s increase x as much as we can.

Page 13: Simplex

Simplex

max 3x-z+12x-z 3z 0z 1x-z 1x 0z-x 1

substitute w=1-(x-z)

Page 14: Simplex

Simplex

max 3x-z+12x-z 3z 0z 1x-z 1x 0z-x 1

substitute w=1-(x-z)w 0x 1+z-w

Page 15: Simplex

Simplex

max 3x-z+12x-z 3z 0z 1x-z 1x 0z-x 1

x 1+z-w

max 2z-3w+4z-2w 1z 0z 1w 0w-z 1w 2

Page 16: Simplex

Simplex

max 2z-3w+4z-2w 1z 0z 1w 0w-z 1w 2

Is (z,w)=(0,0) optimal?

Page 17: Simplex

Simplex

max 2z-3w+4z-2w 1z 0z 1w 0w-z 1w 2

Let’s increase z as much as we can.

Page 18: Simplex

Simplex

max 2z-3w+4z-2w 1z 0z 1w 0w-z 1w 2

substitute u=1-(z-2w)

Page 19: Simplex

Simplex

max 2z-3w+4z-2w 1z 0z 1w 0w-z 1w 2

substitute u=1-(z-2w)u 0z 1+2w-u

Page 20: Simplex

Simplex

max 2z-3w+4z-2w 1z 0z 1w 0w-z 1w 2

z 1+2w-u

max w-2u+6u 0u-2w 12w-u 2w 0u-w 2w 2

Page 21: Simplex

Simplex

max w-2u+6u 0u-2w 12w-u 2w 0u-w 2w 2

Is (u,w)=(0,0) optimal?

Page 22: Simplex

Simplex

max w-2u+6u 0u-2w 12w-u 2w 0u-w 2w 2

Let’s increase w as much as we can.

Page 23: Simplex

Simplex

max w-2u+6u 0u-2w 12w-u 2w 0u-w 2w 2

substitute v=2-(2w-u)

Page 24: Simplex

Simplex

max w-2u+6u 0u-2w 12w-u 2w 0u-w 2w 2

substitute v=2-(2w-u)v 0w 1+u/2-v/2

Page 25: Simplex

Simplex

max w-2u+6u 0u-2w 12w-u 2w 0u-w 2w 2

w1+u/2-v/2

max 7-3u/2-v/2u 0v 3v 0v-u 2u+v 6u-v 2

Page 26: Simplex

Simplex

max 7-3u/2-v/2u 0v 3v 0v-u 2u+v 6u-v 2

Is (u,v)=(0,0) optimal?

Page 27: Simplex

Simplex

max 7-3u/2-v/2u 0v 3v 0v-u 2u+v 6u-v 2

Is (u,v)=(0,0) optimal? YES

7

Page 28: Simplex

Simplex

(u,v)=(0,0)

w 1+u/2-v/2 = 1z 1+2w-u = 3x 1+z-w = 3

y x-z+1 = 1

(x,y)=(3,1)

Page 29: Simplex

Simplex

(x,y)=(3,1)max 2x+yx+y 4y-x 1x-y 2y 2x 0y 0

is an optimal solution

Page 30: Simplex

Simplex – geometric view

(x,y)=(3,1)max 2x+yx+y 4y-x 1x-y 2y 2x 0y 0

Page 31: Simplex

Getting the first point

min cT x Ax=bx 0

min 1T zA x + z = bx 0z 0

wlog b 0

Page 32: Simplex
Page 33: Simplex

Points, lines

point = (x,y)

line = (x1,y1),(x2,y2)

2 points

=

Page 34: Simplex

Line as a point and a vector

point = (x,y)

line = (x1,y1),(x2-x1,y2-y1)

point and a vector=

x1+t (x2-x1),y1+t (y2-y1)

Page 35: Simplex

Is point on a line?

point = (x,y)

line = (x1,y1),(x2,y2)

x=x1+t (x2-x1)y=y1+t (y2-y1)

Page 36: Simplex

Is point on a line?

point = (x,y)

line = (x1,y1),(x2,y2)

t (x2-x1)=x-x_1t (y2-y1)=y-y_1

x2-x1 x-x1

y2-y1 y-y1( )det

Page 37: Simplex

Is point on a line?

point = (x,y)

line = (x1,y1),(x2,y2)

x2-x1 x-x1

y2-y1 y-y1( )det

is on

if and only if

= 0

Page 38: Simplex

Is point on a line?

x2-x1 x-x1

y2-y1 y-y1( )det

=0 for x on the line>0

<0

Page 39: Simplex

Line segment

line segment = (x1,y1),(x2,y2)

x=x1+t (x2-x1)y=y1+t (y2-y1)

t [0,1]

Page 40: Simplex

Do two line segments intersect?

a1=(x1,y1), a2=(x2,y2) a3=(x3,y3), a4= (x4,y4)

a1

a2

a3

a4

L1

L2

a1 and a2 on different sides of L2

a3 and a4 on different sides of L1

or endpoint of a segment lies on the other segment

Page 41: Simplex

Many segments, do any 2 intersect?

(a1,b1)(a2,b2) ...(an,bn)

O(n2) algorithm

Page 42: Simplex

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

Page 43: Simplex

Sweep algorithm

Page 44: Simplex

Sweep algorithm sort points by the x-coordinate

Page 45: Simplex

Sweep algorithm

events: insert segment delete segment

Page 46: Simplex

Sweep algorithm

will find the left-most intersection point

the lines are “neighborson the sweep line”

Page 47: Simplex

Sweep algorithm

sort the endpoints by x-coord p1,...,p2n

T empty B-treefor i from 1 to 2n do if pi is the left point of a segment s INSERT s into T check if s intersects prev(s) or next(s) in T if pi is the right point of a segment s check if prev(s) interesects next(s) in T DELETE s from T

Page 48: Simplex

Area of a simple polygon

(x1,y1)

(x3,y3)

(x2,y2)

Page 49: Simplex

Area of a simple polygon

(x1,y1),...,(xn,yn)

Page 50: Simplex

Area of a simple polygon

(x1,y1),...,(xn,yn)

R=0for i from 1 to n do R=R+(yi+1+yi)*(xi+1-xi)return |R|/2

(xn+1,yn+1)=(x1,y1)

Page 51: Simplex

Convex hull smallest convex setcontaining all the points

Page 52: Simplex

Convex hull smallest convex setcontaining all the points

Page 53: Simplex

Jarvis march

find the left-most point

(assume no 3 points colinear)

s

Page 54: Simplex

Jarvis march

find the point that appears most to the right looking from s

(assume no 3 points colinear)

s

Page 55: Simplex

Jarvis march (assume no 3 points colinear)

s

p

find the point that appears most to the right looking from p

Page 56: Simplex

Jarvis march (assume no 3 points colinear)

Page 57: Simplex

Jarvis march (assume no 3 points colinear)

Page 58: Simplex

Jarvis march (assume no 3 points colinear)

s point with smallest x-coordp srepeat 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 quntil p = s