Top Banner
CS 270, SPRING 2013 PROJECT A VISUAL TOOL FOR THE SIMPLEX METHOD IN LP Soham Uday Mehta
25
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Soham Uday Mehta. Linear Programming in 3 variables.

CS 270, SPRING 2013 PROJECT

A VISUAL TOOL FOR THE SIMPLEX METHOD IN LP

Soham Uday Mehta

Page 2: Soham Uday Mehta. Linear Programming in 3 variables.

Linear Programming in 3 variables

Subject to

Page 3: Soham Uday Mehta. Linear Programming in 3 variables.

Goals

Visualize the convex feasible region specified by constraints (in 3D)

Page 4: Soham Uday Mehta. Linear Programming in 3 variables.

Goals

Visualize the convex feasible region specified by constraints (in 3D)

Visualize Simplex Algorithm to solve the LP (simple version)

Page 5: Soham Uday Mehta. Linear Programming in 3 variables.

Visualization

Each constraint becomes a polygon bounding the convex feasible region

Page 6: Soham Uday Mehta. Linear Programming in 3 variables.

Visualization

Each constraint becomes a polygon bounding the convex feasible region

Start with 3 Quads for

Assume we have all polygons for current convex region and we want to add a new constraint

Page 7: Soham Uday Mehta. Linear Programming in 3 variables.

Visualization

Each constraint becomes a polygon bounding the convex feasible region

Start with 3 Quads for

Assume we have all polygons for current convex region and we want to add a new constraint

Need to clip all polygons by new constraint

Page 8: Soham Uday Mehta. Linear Programming in 3 variables.

Visualization

Find the ‘side’ of plane each vertex of polygon is on

If an edge of poly cuts plane, add new vertex and remove the ‘wrong’ side vertex

Page 9: Soham Uday Mehta. Linear Programming in 3 variables.

Visualization

Each constraint may also create a new polygon

Page 10: Soham Uday Mehta. Linear Programming in 3 variables.

Visualization

Each constraint may also create a new polygon

Page 11: Soham Uday Mehta. Linear Programming in 3 variables.

Visualization

Each constraint may also create a new polygon

Store ‘new’ vertices created by clipping existing polygons

Page 12: Soham Uday Mehta. Linear Programming in 3 variables.

Visualization

Each constraint may also create a new polygon

Store ‘new’ vertices created by clipping existing polygons

Remove duplicates

Page 13: Soham Uday Mehta. Linear Programming in 3 variables.

Visualization

Each constraint may also create a new polygon

Store ‘new’ vertices created by clipping existing polygons

Remove duplicates, re-order vertices, and create new poly

Page 14: Soham Uday Mehta. Linear Programming in 3 variables.

Simplex Algorithm

1. Start with a random vertex

Page 15: Soham Uday Mehta. Linear Programming in 3 variables.

Simplex Algorithm

1. Start with a random vertex

2. Find extreme directions at current vertex

3. Pick maximum improvement direction

4. If no improvement in any direction, stop

Page 16: Soham Uday Mehta. Linear Programming in 3 variables.

Simplex Algorithm

1. Start with a random vertex

2. Find extreme directions at current vertex

3. Pick maximum improvement direction

4. If no improvement in any direction, stop

5. Find max. feasible step and move to next vertex

6. Go back to 2

Page 17: Soham Uday Mehta. Linear Programming in 3 variables.

Choosing the start vertex

First add 1 auxiliary variable to each constraint to convert it to an equation, create matrix

Randomly choose from the and set to , solve the equations for rest

Page 18: Soham Uday Mehta. Linear Programming in 3 variables.

Choosing the start vertex

First add 1 auxiliary variable to each constraint to convert it to an equation, create matrix

Randomly choose from the and set to , solve the equations for rest

If matrix is not invertible or some , solve with different choice

The ones set to zero are called non-basic, rest are basic – store this in a boolean vector “B”

Page 19: Soham Uday Mehta. Linear Programming in 3 variables.

Finding directions at any vertex

Each non-basic variable gives a direction

Page 20: Soham Uday Mehta. Linear Programming in 3 variables.

Finding directions at any vertex

Each non-basic variable gives a direction

For , set 1 non-basic value to 1, other two to 0 and solve for rest (free upto a constant)

Pick direction which gives maximum

If all directions give , reached maximum, STOP

Page 21: Soham Uday Mehta. Linear Programming in 3 variables.

Finding the next vertex

Choose step size

Move to next vertex

Page 22: Soham Uday Mehta. Linear Programming in 3 variables.

Finding the next vertex

Choose step size

Move to next vertex

Update “B” vector to correspond to new vertex: non-basic generating the max direction becomes basic, the basic fixing becomes non-basic

Page 23: Soham Uday Mehta. Linear Programming in 3 variables.
Page 24: Soham Uday Mehta. Linear Programming in 3 variables.

Conclusion

Will be available for download

Page 25: Soham Uday Mehta. Linear Programming in 3 variables.

Conclusion

Will be available for download

Thanks for your attention

Comments / Questions?