Solving Linear Programs Using the Simplex Method (Manual)

Similar documents
CASE STUDY. fourteen. Animating The Simplex Method. case study OVERVIEW. Application Overview and Model Development.

Section Notes 5. Review of Linear Programming. Applied Math / Engineering Sciences 121. Week of October 15, 2017

Linear Programming. Linear programming provides methods for allocating limited resources among competing activities in an optimal way.

Part 4. Decomposition Algorithms Dantzig-Wolf Decomposition Algorithm

Introduction to Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

AM 121: Intro to Optimization Models and Methods Fall 2017

Outline. CS38 Introduction to Algorithms. Linear programming 5/21/2014. Linear programming. Lecture 15 May 20, 2014

56:272 Integer Programming & Network Flows Final Examination -- December 14, 1998

Read: H&L chapters 1-6

5.4 Pure Minimal Cost Flow

VARIANTS OF THE SIMPLEX METHOD

Some Advanced Topics in Linear Programming

Advanced Operations Research Techniques IE316. Quiz 2 Review. Dr. Ted Ralphs

4.1 The original problem and the optimal tableau

Linear Programming Problems

Optimization of Design. Lecturer:Dung-An Wang Lecture 8

Solutions for Operations Research Final Exam

The Simplex Algorithm for LP, and an Open Problem

Civil Engineering Systems Analysis Lecture XIV. Instructor: Prof. Naveen Eluru Department of Civil Engineering and Applied Mechanics

Section Notes 4. Duality, Sensitivity, and the Dual Simplex Algorithm. Applied Math / Engineering Sciences 121. Week of October 8, 2018

16.410/413 Principles of Autonomy and Decision Making

Linear Programming. Course review MS-E2140. v. 1.1

Marginal and Sensitivity Analyses

Pivot and Gomory Cut. A MIP Feasibility Heuristic NSERC

Generalized Network Flow Programming

COLUMN GENERATION IN LINEAR PROGRAMMING

The Ascendance of the Dual Simplex Method: A Geometric View

Artificial Intelligence

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Tuesday, April 10. The Network Simplex Method for Solving the Minimum Cost Flow Problem

Introduction to Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Linear Programming. Linear Programming. Linear Programming. Example: Profit Maximization (1/4) Iris Hui-Ru Jiang Fall Linear programming

Linear programming II João Carlos Lourenço

CSE 40/60236 Sam Bailey

Graphs and Network Flows IE411. Lecture 20. Dr. Ted Ralphs

Outline. Column Generation: Cutting Stock A very applied method. Introduction to Column Generation. Given an LP problem

Column Generation: Cutting Stock

Civil Engineering Systems Analysis Lecture XV. Instructor: Prof. Naveen Eluru Department of Civil Engineering and Applied Mechanics

CS675: Convex and Combinatorial Optimization Spring 2018 The Simplex Algorithm. Instructor: Shaddin Dughmi

Fundamentals of Operations Research. Prof. G. Srinivasan. Department of Management Studies. Indian Institute of Technology Madras.

5 The Theory of the Simplex Method

Introduction. Linear because it requires linear functions. Programming as synonymous of planning.

Chapter 4: The Mechanics of the Simplex Method

Chapter II. Linear Programming

Linear Programming. Revised Simplex Method, Duality of LP problems and Sensitivity analysis

The Simplex Algorithm. Chapter 5. Decision Procedures. An Algorithmic Point of View. Revision 1.0

MATHEMATICS II: COLLECTION OF EXERCISES AND PROBLEMS

CSC 8301 Design & Analysis of Algorithms: Linear Programming

Part 1. The Review of Linear Programming The Revised Simplex Method

Math Introduction to Operations Research

Linear Optimization. Andongwisye John. November 17, Linkoping University. Andongwisye John (Linkoping University) November 17, / 25

9.4 SOME CHARACTERISTICS OF INTEGER PROGRAMS A SAMPLE PROBLEM

The simplex method and the diameter of a 0-1 polytope

The Simplex Algorithm with a New. Primal and Dual Pivot Rule. Hsin-Der CHEN 3, Panos M. PARDALOS 3 and Michael A. SAUNDERS y. June 14, 1993.

THE simplex algorithm [1] has been popularly used

4.1 Graphical solution of a linear program and standard form

NATCOR Convex Optimization Linear Programming 1

An iteration of the simplex method (a pivot )

Advanced Operations Research Techniques IE316. Quiz 1 Review. Dr. Ted Ralphs

How to Solve a Standard Maximization Problem Using the Simplex Method and the Rowops Program

Econ 172A - Slides from Lecture 8

BCN Decision and Risk Analysis. Syed M. Ahmed, Ph.D.

DM545 Linear and Integer Programming. Lecture 2. The Simplex Method. Marco Chiarandini

A PRIMAL-DUAL EXTERIOR POINT ALGORITHM FOR LINEAR PROGRAMMING PROBLEMS

A Comparative study on Algorithms for Shortest-Route Problem and Some Extensions

CSc 545 Lecture topic: The Criss-Cross method of Linear Programming

What s Linear Programming? Often your try is to maximize or minimize an objective within given constraints

A computationally stable solution algorithm for linear programs

What is linear programming (LP)? NATCOR Convex Optimization Linear Programming 1. Solving LP problems: The standard simplex method

Introduction to Mathematical Programming IE496. Final Review. Dr. Ted Ralphs

An introduction to pplex and the Simplex Method

Parallelizing the dual revised simplex method

Julian Hall School of Mathematics University of Edinburgh. June 15th Parallel matrix inversion for the revised simplex method - a study

Linear programming and duality theory

ME 391Q Network Flow Programming

Easter Term OPTIMIZATION

Primal Simplex Algorithm for the Pure Minimal Cost Flow Problem

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

The Simplex Algorithm

The Simplex Algorithm

3 INTEGER LINEAR PROGRAMMING

Linear Programming. Readings: Read text section 11.6, and sections 1 and 2 of Tom Ferguson s notes (see course homepage).

Linear Programming. Widget Factory Example. Linear Programming: Standard Form. Widget Factory Example: Continued.

DEGENERACY AND THE FUNDAMENTAL THEOREM

5. DUAL LP, SOLUTION INTERPRETATION, AND POST-OPTIMALITY

Recap, and outline of Lecture 18

3 Interior Point Method

MATLAB Solution of Linear Programming Problems

ISE203 Optimization 1 Linear Models. Dr. Arslan Örnek Chapter 4 Solving LP problems: The Simplex Method SIMPLEX

Copyright 2007 Pearson Addison-Wesley. All rights reserved. A. Levitin Introduction to the Design & Analysis of Algorithms, 2 nd ed., Ch.

Programming, numerics and optimization

Mid-term Exam of Operations Research

High performance computing and the simplex method

Homework 2: Multi-unit combinatorial auctions (due Nov. 7 before class)

Selected Topics in Column Generation

CSE 460. Today we will look at" Classes of Optimization Problems" Linear Programming" The Simplex Algorithm"

Math 414 Lecture 30. The greedy algorithm provides the initial transportation matrix.

Introduction to Linear Programming

Notes for Lecture 18

Chapter 1 Linear Programming. Paragraph 4 The Simplex Algorithm

Transcription:

Solving Linear Programs Using the Simplex Method (Manual) GáborRétvári E-mail: retvari@tmit.bme.hu The GNU Octave Simplex Solver Implementation As part of the course material two simple GNU Octave/MATLAB based simplex implementations are available for download, one for the primal and one for the dual simplex, which can be of great help in learning the use of simplex tableau and checking one s solution steps. The programs will solve a linear program, either using the primal or the dual simplex method, from a user-specified initial basis and output the sequence of simplex tableau encountered along the way. Note that the implementations are pretty rudimentary at this point as no code for finding an initial basis, checking numerical instability, preventing cycling, etc., is available at this point; contributions are welcome! The primal and dual simplex implementations are available as separate scripts: psimplex.m: primal simplex, http://lendulet.tmit.bme.hu/~retvari/courses/vitmd097/psimplex.m dsimplex.m: dual simplex, http://lendulet.tmit.bme.hu/~retvari/courses/vitmd097/dsimplex.m An experimental implementation of the two-phase primal simplex method using the artificial variables technique for searching initial basis is also available (thanks to János Beluzsár) at: http://lendulet.tmit.bme.hu/~retvari/courses/vitmd097/psimplex_mod.m The code was written for the GNU Octave numerical computation framework but, theoretically, it should work in MATLAB as well. After downloading place the scripts into the working directory or under any path where GNU Octave finds them (see: Octave info pages: addpath). Success of the installation can be checked as follows: octave> help psimplex PSIMPLEX - simplex algorithm for maximization problems in standard form [A, subs, x, z] = psimplex(c, A, b, subs, varargin) --------------------------------------------------------------------------- DESCRIPTION --------------------------------------------------------------------------- The simplex algorithm for the LP problem max z = c*x 1

Subject to: Ax = b x >= 0 The fifth input parameter is optional. If it is set to y, then the initial and final tableaux are displayed to the screen. Using the Software We show the usage of the software through the process of solving the below linear program: max x 1 + 2x 2 s.t. 3x 1 + 4x 2 12 2x 1 x 2 12 x 1, x 2 0 The scripts expect the linear program as a maximization problem written in the standard form. Correspondingly, introduce slack variables to obtain the standard form of the linear program: max x 1 + 2x 2 s.t. 3x 1 + 4x 2 + x 3 = 12 2x 1 x 2 + x 4 = 12 x 1, x 2, x 3, x 4 0 The scripts take as input the objective vector c T, the constraint matrix A, and the righthand side vector b. c T = [ 1 2 0 0 ], A = [ ] 3 4 1 0, b = 2 1 0 1 [ ] 12 12 In addition, an initial basis also needs to be specified, since currently the code does not implement a starting basis searching technique. Naturally, the primal simplex requires a primal feasible and the dual simplex requires a dual feasible initial basis, feasibility is checked upon calling. In the above example, the columns of the slack variables constitute a primal feasible initial basis: B = {3, 4}. What remained to be done is to specify these parameters in the format of GNU Octave as arguments for the psimplex function. Take note that c T is a row-vector; size constraints are explicitly enforced by the programs. octave> c = [-1 2 0 0]; octave> A = [3 4 1 0;2-1 0 1]; octave> b=[12;12]; octave> psimplex(c, A, b, [3,4], 1) Tableaux of the Simplex Algorithm Initial problem, bringing to tableau form 2

A = 3 4 1 0 12 2-1 0 1 12 1-2 -0-0 0 In the first step the script checks the size of the input parameters and prints the initial table (not necessarily a valid simplex tableau yet). The display format is special, as the objective row of the tableau (row zero) is shown as the last row of the displayed matrix due to code organization and simplicity considerations. The RHS will remain in the last column and the current objective function value is shown in the last column of the last line. The above matrix therefore corresponds to the below table. z x 1 x 2 x 3 x 4 RHS z 1 1 2 0 0 0 x 3 0 3 4 1 0 12 x 4 0 2 1 0 1 12 In the second step, the script through a sequence of pivot operations brings the table into the required form for the primal simplex tableau: basic variable columns will form an identity matrix and the corresponding reduced costs in the objective row will all be zeroed out. During this process, the script checks whether the initial basis is nonsingular and primal feasible. A = 3 4 1 0 12 2-1 0 1 12 1-2 0 0 0 Initial tableau subs = 3 4 Initial basis In our case the initial table does not change since our basis was already an identity matrix and the corresponding reduced costs were zero. During the next steps the script iteratively computes the optimal simplex tableau through a sequence of improving pivots using Dantzig s pivot rule. 3

A = 2 enters, 3 leaves the basis 0.75000 1.00000 0.25000 0.00000 3.00000 2.75000 0.00000 0.25000 1.00000 15.00000 2.50000 0.00000 0.50000 0.00000 6.00000 subs = current basis: 2 4 In every iteration the script determines the entering and the leaving variables and performs the pivot. Recall that the display format is special; the above matrix as the conventional simplex tableau form is as follows: z x 1 x 2 x 3 x 4 RHS z 1 2.5 0 0.5 0 6 x 2 0 0.75 1 0.25 0 3 x 4 0 2.75 0 0.25 1 15 During the iteration the script checks whether the current pivot is valid and halts if unboundedness is encountered. Degeneration and cycling are not checked, therefore the script may enter an infinite loop during the iteration. Finally, if the current tableau is primal optimal then the script terminates and outputs the optimal tableau. Optimal tableau, end ans = 0.75000 1.00000 0.25000 0.00000 3.00000 2.75000 0.00000 0.25000 1.00000 15.00000 2.50000 0.00000 0.50000 0.00000 6.00000 In our case the optimal objective function value is 6 and the optimal solution can be read from the displayed matrix: the value of nonbasic variables x 1 and x 3 is, by assumption, zero, while the indices of the basic variables are B = {2,4}, so reading the RHS column in the corresponding rows yields x 2 = 3, x 4 = 15. If only in the solution is interesting but not the steps of the iteration and the intermediate simplex tableau, then simply omit the last argument when calling psimplex: psimplex(c, A, b, [3,4]) 4

If the results should be saved in variables for further use: octave> [T, subs, x, z] = psimplex(c, A, b, [3,4]); In this case the script stores the optimal tableau in T, the column indices of the optimal basis in subs, the optimal solution in x, and the optimal objective function value in z. The script implementing the dual simplex method, dsimplex, works similarly. (Note: contributions are welcome, you can get a better grade at the exam! You may write code to improve the display format for the simplex tableau, implement cycling prevention, etc., write me an email if you d like to contribute!) 5