Use MATLAB to solve linear programs LI Xiao-lei. MATLAB format for linear programs MATLAB uses the following format for linear programs: min z = f T x.

Slides:



Advertisements
Similar presentations
Integer Optimization Basic Concepts Integer Linear Program(ILP): A linear program except that some or all of the decision variables must have integer.
Advertisements

1 LP Duality Lecture 13: Feb Min-Max Theorems In bipartite graph, Maximum matching = Minimum Vertex Cover In every graph, Maximum Flow = Minimum.
IEOR 4004 Midterm review (Part II) March 12, 2014.
Linear Programming, 1 Max c 1 *X 1 +…+ c n *X n = z s.t. a 11 *X 1 +…+ a 1n *X n  b 1 … a m1 *X 1 +…+ a mn *X n  b m X 1, X n  0 Standard form.
Linear Programming Problem
Linear programming: lp_solve, max flow, dual CSC 282 Fall 2013.
Linear Programming – Simplex Method
What is GAMS?. While they are not NLP solvers, per se, attention should be given to modeling languages like: GAMS- AIMMS-
D Nagesh Kumar, IIScOptimization Methods: M4L1 1 Linear Programming Applications Software for Linear Programming.
Dragan Jovicic Harvinder Singh
Solving Equations = 4x – 5(6x – 10) -132 = 4x – 30x = -26x = -26x 7 = x.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Gaussian Elimination and Simplex.
Linear Programming Unit 2, Lesson 4 10/13.
CSCI 3160 Design and Analysis of Algorithms Tutorial 6 Fei Chen.
Spreadsheet Modeling & Decision Analysis:
1 Linear Programming Supplements (Optional). 2 Standard Form LP (a.k.a. First Primal Form) Strictly ≤ All x j 's are non-negative.
Chapter 3 An Introduction to Linear Programming
Linear Programming Old name for linear optimization –Linear objective functions and constraints Optimum always at boundary of feasible domain First solution.
1 Chapter 3 Matrix Algebra with MATLAB Basic matrix definitions and operations were covered in Chapter 2. We will now consider how these operations are.
8.2 Regular Stochastic Matrices
Introduction to Mathematical Programming OR/MA 504 Chapter 3.
Special Conditions in LP Models (sambungan BAB 1)
4.5 Solving Systems using Matrix Equations and Inverses.
3.5 – Solving Systems of Equations in Three Variables.
The Two-Phase Simplex Method LI Xiao-lei. Preview When a basic feasible solution is not readily available, the two-phase simplex method may be used as.
4.5 Solving Systems using Matrix Equations and Inverses OBJ: To solve systems of linear equations using inverse matrices & use systems of linear equations.
3.4 Linear Programming p Optimization - Finding the minimum or maximum value of some quantity. Linear programming is a form of optimization where.
Linear Programming: Data Fitting Steve Gu Mar 21, 2008.
1 1 Slide © 2005 Thomson/South-Western Chapter 2 Introduction to Linear Programming n Linear Programming Problem n Problem Formulation n A Maximization.
Introduction to Linear Programming BSAD 141 Dave Novak.
Have we ever seen this phenomenon before? Let’s do some quick multiplication…
Linear Programming – Simplex Method
To accompany Quantitative Analysis for Management, 8e by Render/Stair/Hanna 11-1 © 2003 by Prentice Hall, Inc. Upper Saddle River, NJ Chapter 11.
1 Max 8X 1 + 5X 2 (Weekly profit) subject to 2X 1 + 1X 2  1000 (Plastic) 3X 1 + 4X 2  2400 (Production Time) X 1 + X 2  700 (Total production) X 1.
Solving Linear Inequalities Remember…. “I’m bigger than you are….” > OR “The alligator eats the bigger number….”
OR Chapter 8. General LP Problems Converting other forms to general LP problem : min c’x  - max (-c)’x   = by adding a nonnegative slack variable.
Spreadsheet Modeling & Decision Analysis A Practical Introduction to Management Science 5 th edition Cliff T. Ragsdale.
Branch and Bound Algorithms Present by Tina Yang Qianmei Feng.
Linear Programming and Applications
4.7 Solving Systems using Matrix Equations and Inverses
Integer Programming, Branch & Bound Method
Prof. Anthony Petrella Musculoskeletal Modeling & Inverse Dynamics MEGN 536 – Computational Biomechanics.
3.8B Solving Systems using Matrix Equations and Inverses.
Use Inverse Matrices to Solve Linear Systems
PreCalculus Section 14.3 Solve linear equations using matrices
An Introduction to Linear Programming
An Introduction to Linear Programming Pertemuan 4
Systems of Equations and Inequalities
Linear Equations and Rational Equations
Simple linear equation
Chap 9. General LP problems: Duality and Infeasibility
Solving Linear Systems by Linear Combinations
Solving Linear Systems Algebraically
3.2 Linear Programming 3 Credits AS
Linear Programming.
Converting Repeating Decimals to Fractions
Multiplicative Inverses of Matrices and Matrix Equations
Use Inverse Matrices to Solve 2 Variable Linear Systems
8.4 Linear Programming p
Matrix Solutions to Linear Systems
7.5 – Constrained Optimization: The Method of Lagrange Multipliers
Chapter 5. The Duality Theorem
Linear Programming Problem
Lecture 19 Linear Program
Graphical solution A Graphical Solution Procedure (LPs with 2 decision variables can be solved/viewed this way.) 1. Plot each constraint as an equation.
1.6 Linear Programming Pg. 30.
1.11 Use Inverse Matrices to Solve Linear Systems
1. How do I Solve Linear Equations
Solving a System of Linear Equations
Regression and Correlation of Data
Presentation transcript:

Use MATLAB to solve linear programs LI Xiao-lei

MATLAB format for linear programs MATLAB uses the following format for linear programs: min z = f T x s. t. Ax ≤ b A eq = b eq (1) x≥ l x ≤ u

Command format A linear program in the format of equation (1) is solved using the command: x = linprog(f,A, b, A eq, b eq, l, u)

Simple example Suppose we want to solve the following linear program using MATLAB: max z=4x1 + 2x2 + x3 s. t. 2x1 + x2 ≤ 1 x1 +2x3 ≤ 2 x1 + x2 + x3 = 1 x1 ≤1 x2 ≤ 1 x3 ≤2 x1≥0;x2≥0;x3≥0

Simple example Convert the LP into MATLAB format Comparing the above LP with the format given in (1) we get:

Simple example Input the variables into MATLAB: >> f = -[4;2;1]; >> A = [2 1 0;1 0 2]; >> b = [1;2]; >> Aeq = [1 1 1]; >> beq = [1]; >> l = [0;0;0]; >> u = [1;1;2];

Simple example Solve the linear program using MATLAB: >> x = linprog(f,A,b,Aeq,beq,l,u) And you should see the following: Optimization terminated successfully. x =

What to do when some of the variables are missing ? For example, suppose there are no lower bounds on the variables. In this case define l to be the empty set using the MATLAB command: >> l = []; Do this and resolve the LP by calling the linprog command. You should see: Optimization terminated successfully. x =

What to do when some of the variables are missing ? Similarly define other matrices to be empty matrices if they do not appear in the problem. For example, if there are no equality constraints, define Aeq and beq as empty sets, i.e. >> Aeq = []; >> beq = []; So this and resolve the LP by calling linprog. You should see: Optimization terminated successfully. x =