1 / 43

Linear Programming and Simplex Algorithm

Linear Programming and Simplex Algorithm. Reference: Numerical Recipe Sec. 10.8. Content. Linear programming problems Simplex algorithm QSOpt solver LP Applications Collision detection Melodic similarity Underdetermined linear systems. The Diet Problem.

tia
Download Presentation

Linear Programming and Simplex Algorithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linear Programming and Simplex Algorithm Reference: Numerical Recipe Sec. 10.8

  2. Content • Linear programming problems • Simplex algorithm • QSOpt solver • LP Applications • Collision detection • Melodic similarity • Underdetermined linear systems

  3. The Diet Problem • Dietician preparing a diet consisting of two foods, A and B. Minimum requirement: protein 60g; fat 24g; carbohydrate 30g Looking for minimum cost diet

  4. Cp. NLP subject to Linear Programming

  5. The Problem Maximize N: dimension of x M: number of constraints (M = m1+m2+m3) Subject to

  6. Theory of Linear Optimization Terminology: Feasible vector Feasible basic vector Optimal feasible vector

  7. Theory (cont) • Feasible region is convex and bounded by hyperplanes • Feasible vectors that satisfy N of the original constraints as equalities are termed feasible basic vectors. • Optimal occur at boundary (gradient vector of objective function is always nonzero) • Combinatorial problem: determining which N constraints (out of the N+M constraints) would be satisfied by the optimal feasible vector

  8. Simplex Algorithm (Dantzig 1948) • A series of combinations is tried to increase the objective function • Number of iterations less than O(max(M,N)) • Worst case complexity is exponential (in number of variables); yet has polynomial smoothed complexity (and works well in practice)

  9. The Canonical Problem Maximize N: dimension of x M: number of constraints (M = m1+m2+m3) Subject to I. II. III.

  10. Contains a GUI and a callable library QSopt [ref]

  11. LP Format Example Problem smallExample Minimize obj: 0.60x1 + 0.40x2 Subject to c1: 12x1 + 6x2 >= 24 30x1 + 15x2 >= 30 Bounds 0 <= x1 0 <= x2 End Somehow x1 >= 0 x2 >= 0 Doesn’t work!? BNF for QSOpt scripts

  12. QSOpt Examples

  13. Primal problem Dual problem Duality

  14. Duality • If a linear program has a finite optimal solution then so does the dual. Furthermore, the optimal values of the two programs are the same. • If either problem has an unbounded optimal solution, then the other problem has no feasible solutions.

  15. Diet Problem

  16. Applications

  17. The Problem Under-determined system (infinite number of solutions) Find the solution with minimum magnitude (i.e., closest to origin)

  18. (-2,0,0) (1,-1,1) Example Approach 1: find complete solution (-2,0,0) subtract its projection along (1,-1,1)

  19. Linear Programming Solution • Most simplex algorithm assume nonnegative variables • Set

  20. Example

  21. Solved by QSopt The real minimum (-4/3, -2/3, 2/3) The LP constraint is not exactly ||x||2 (but ||x||) This problem can also be solved by SVD (singular value decomposition)

  22. LP in CD (narrow phase, ref) • A pair of convex objects: each facet represented by the plane inequality aix+biy+ciz  di • If two sets of inequality (from two convex objects) define a feasible region, then a collision is detected • The type of optimization (min|max) and the objective function used is irrelevant.

  23. Convert to dual problem for better efficiency(?!) LP for CD

  24. Transportation Distance as a Measure to Melodic Similarity Ref: Typke et al. 2003

  25. Example Partially matched

  26. Earth Mover Distance

  27. EMD as Linear Program Solve by simplex algorithm

  28. EMD for Melodic Similarity • Ground distance: Euclidean distance • Scale time coordinate (so that they are comparable) • Transposition: transpose one of the melodies so that the weighted average pitch is equal (not optimum but acceptable)

  29. HW: Verify planar CD using LP Warning: Non-negative assumption (for some solvers)!!

  30. 5 6 2 4 1 3 Verify planar CD using LP.

  31. LP Solvers • Lp_solve: MILP • QSopt • GLPK

  32. Contains a GUI and a callable library QSopt [ref]

  33. LP Format Example Problem smallExample Minimize obj: 0.60x1 + 0.40x2 Subject to c1: 12x1 + 6x2 >= 24 30x1 + 15x2 >= 30 Bounds 0 <= x1 0 <= x2 End [weird] Somehow x1 >= 0 x2 >= 0 Doesn’t work!?

  34. LP format BNF definition1

  35. LP format BNF definition2

  36. QSOpt API

  37. Scenario: Read and Solve

  38. value: objective function x: solution vector (columns) pi: dual variables slack: slack variables rc: reduced cost In our applications, we don’t really care about pi, slack, and rc. Set them to NULL Accessing a Solution

  39. QS_MAX or QS_MIN cmatind # of nonzeros in jth column Location of start entry

  40. QSnew_row QSadd_rows QSnew_col QSadd_cols QSdelete_row QSdelete_col QSchange_coef QSchange_objcoef QSchange_rhscoef QSchange_sense See reference manuals for more details (Ch.5) Use QSwrite_prob to verify the change Modify an LP Problem

More Related