This action might not be possible to undo. Are you sure you want to continue?

http://www.mathworks.com/help/toolbox/optim/ug/linprog.html

linprog

Solve linear programming problems

Equation

Finds the minimum of a problem specified by

f, x, b, beq, lb, and ub are vectors, and A and Aeq are matrices.

Syntax

x = linprog(f,A,b) x = linprog(f,A,b,Aeq,beq) x = linprog(f,A,b,Aeq,beq,lb,ub) x = linprog(f,A,b,Aeq,beq,lb,ub,x0) x = linprog(f,A,b,Aeq,beq,lb,ub,x0,options) x = linprog(problem) [x,fval] = linprog(...) [x,fval,exitflag] = linprog(...) [x,fval,exitflag,output] = linprog(...) [x,fval,exitflag,output,lambda] = linprog(...)

Description

linprog solves linear programming problems. x = linprog(f,A,b) solves min f'*x such that A*x ≤ b.

1 of 13

14/03/2011 9:38 PM

lb. the output x is x0 and the output fval is [].beq. [x.lb. as described in Exporting to the MATLAB Workspace.com/help/toolbox/optim/ug/linprog.lambda] = linprog(.ub) defines a set of lower and upper bounds on the design variables. x = linprog(f. Set Aeq = [] and beq = [] if no equalities exist.Aeq.b.b.lb. [x.output] = linprog(.A.fval] = linprog(. Use optimset to set these options.ub.exitflag. x = linprog(f...beq.output.fval. Note If the specified input bounds for a problem are inconsistent.) returns a value exitflag that describes the exit condition.exitflag] = linprog(..) returns a structure lambda whose fields contain the Lagrange multipliers at the solution x. so that the solution is always in the range lb ≤ x ≤ ub.x0. x = linprog(problem) finds the minimum for problem. Set A = [] and b = [] if no inequalities exist.mathworks. The default large-scale algorithm and the simplex algorithm ignore any starting point.A...Aeq.fval.b.ub.A. x = linprog(f. Input Arguments Function Arguments contains general descriptions of arguments passed into linprog.. [x.x0) sets the starting point to x0..b.exitflag. where problem is a structure described in Input Arguments.beq. This option is only available with the medium-scale algorithm (the LargeScale option is set to 'off' using optimset).html x = linprog(f.fval.MATLAB http://www.Aeq.) returns a structure output that contains information about the optimization.. [x. Options provides the functionspecific details for the options values.options) minimizes with the optimization options specified in the structure options.) returns the value of the objective function fun at the solution x: fval = f'*x.A. x.Solve linear programming problems .Aeq.beq) solves the problem above while additionally satisfying the equality constraints Aeq*x = beq. 2 of 13 14/03/2011 9:38 PM . Create the structure problem by exporting a problem from Optimization Tool.

This section provides functionspecific details for exitflag. lambda. active set algorithm only 'linprog' Options structure created with optimset Output Arguments Function Arguments contains general descriptions of arguments returned by linprog.MATLAB http://www.Solve linear programming problems .com/help/toolbox/optim/ug/linprog. and output: 3 of 13 14/03/2011 9:38 PM .mathworks.html problem f Aineq bineq Aeq beq lb ub x0 solver options Linear objective function vector f Matrix for linear inequality constraints Vector for linear inequality constraints Matrix for linear equality constraints Vector for linear equality constraints Vector of lower bounds Vector of upper bounds Initial point for x.

No feasible point was found. Both primal and dual problems are infeasible.com/help/toolbox/optim/ug/linprog. No further progress could be made. Number of iterations exceeded options. The fields of the structure are: lower upper ineqlin Lower bounds lb Upper bounds ub Linear inequalities 4 of 13 14/03/2011 9:38 PM . 1 0 -2 -3 -4 -5 -7 Function converged to a solution x. The following lists the values of exitflag and the corresponding reasons the algorithm terminated.mathworks. NaN value was encountered during execution of the algorithm. Problem is unbounded.Solve linear programming problems .html exitflag Integer identifying the reason the algorithm terminated.MaxIter. Search direction became too small.MATLAB http://www. lambda Structure containing the Lagrange multipliers at the solution x (separated by constraint type).

html eqlin output Linear equalities Structure containing information about the optimization.com/help/toolbox/optim/ug/linprog. You can use optimset to set or change the values of these fields in the options structure.mathworks. See Optimization Options for detailed information. Some options apply to all algorithms. options. and others are only relevant when using the large-scale algorithm. Medium-Scale and Large-Scale Algorithms Both the medium-scale and large-scale algorithms use the following options: 5 of 13 14/03/2011 9:38 PM . The fields of the structure are: iterations algorithm cgiterations Number of iterations Optimization algorithm used 0 (large-scale algorithm only.MATLAB http://www. included for backward compatibility) Exit message Maximum of constraint functions First-order optimality measure message constrviolation firstorderopt Options Optimization options used by linprog.Solve linear programming problems .

The default is: MaxIter 85 for the large-scale algorithm 10*numberOfVariables for the simplex algorithm 10*max(numberOfVariables. Level of display. Use a medium-scale algorithm when set to 'off' (see Simplex in Medium-Scale Algorithm Only). The 'iter' option only works with the large-scale and medium-scale simplex algorithms. The choices are 'on' or the default 'off'. Display 'off' displays no output.html Diagnostics Display diagnostic information about the function to be minimized or solved.mathworks. 'iter' displays output at each iteration. The default is: 1e-8 for the large-scale algorithm 1e-6 for the simplex algorithm The option is not used for the medium-scale active-set algorithm Medium-Scale Algorithm Only 6 of 13 14/03/2011 9:38 PM . 'final' (default) displays just the final output. a positive scalar.MATLAB http://www. numberOfInequalities + numberOfBounds) for the medium-scale active-set algorithm TolFun Termination tolerance on the function value.Solve linear programming problems . For information on choosing the algorithm. LargeScale Use large-scale algorithm when set to 'on' (default). see Choosing the Algorithm. a positive integer. Maximum number of iterations allowed.com/help/toolbox/optim/ug/linprog.

0 ≤ x2. A = [1 -1 1 3 2 4 3 2 0]. lb = zeros(3. Next. 42.fval.1). [x. The simplex algorithm uses a built-in starting point. b = [20.mathworks.[].MATLAB http://www.[]. call a linear programming routine.exitflag. -4.A. meaning linprog uses an active-set algorithm. subject to x1 – x2 + x3 ≤ 20 3x1 + 2x2 + 4x3 ≤ 42 3x1 + 2x2 ≤ 30 0 ≤ x1. enter the coefficients f = [-5. ignoring the starting point x0 if supplied. 30].com/help/toolbox/optim/ug/linprog. linprog uses the simplex algorithm. 7 of 13 14/03/2011 9:38 PM .lambda] = linprog(f. 0 ≤ x3.output. See Medium-Scale Optimization for more information and an example.lb).html The medium-scale algorithms use the following option: Simplex If 'on'. First. Examples Find x that minimizes f(x) = –5x1 – 4x2 –6x3.b.Solve linear programming problems . The default is 'off'. -6].

a primal-dual interior-point method.ineqlin) and the first lower bound constraint (in lambda..lambda.0000 ans = 0.0000 15. Algorithm Large-Scale Optimization The large-scale method is based on LIPSOL (Linear Interior Point Solver.0000 0. Medium-Scale Optimization linprog uses a projection method as used in the quadprog algorithm.mathworks.5000 ans = 1. The algorithm finds an initial feasible solution by 8 of 13 14/03/2011 9:38 PM .0000 3.0000 Nonzero elements of the vectors in the fields of lambda indicate active constraints at the solution. In this case. the second and third inequality constraints (in lambda.lambda.lower) are active constraints (i.ineqlin.e.MATLAB http://www.lower x = 0.com/help/toolbox/optim/ug/linprog. A number of preprocessing steps occur before the algorithm begins to iterate.5000 0.Solve linear programming problems . the solution is on their constraint boundaries).0000 0. [3]).0000 1. which is a variant of Mehrotra's predictorcorrector algorithm ([2]).html Examine the solution and Lagrange multipliers: x. See Large Scale Linear Programming. linprog is an active set method and is thus a variation of the well-known simplex method for linear programming [1].

'off'. The simplex algorithm returns a vertex optimal solution. the exitflag argument returned by linprog is set to a negative value to indicate failure.MATLAB http://www. Note You cannot supply an initial point x0 for linprog with either the large-scale method or the medium-scale method using the simplex algorithm. In either case. Alternatively. If a row of all zeros is detected in Aeq but the corresponding element of beq is not zero. 'Simplex'. the associated value in x is called a singleton variable. the exit message is Exiting due to infeasibility: An all-zero row in the constraint matrix does not have a zero in corresponding right-hand-side entry. In this case. by entering options = optimset('LargeScale'. In each case.html first solving another linear programming problem. the value of that component of x can be computed from Aeq and beq. linprog ignores x0 and computes its own initial point for the algorithm. if you pass in x0 as an input argument. the exit message is Exiting due to infeasibility: Objective f'*x is unbounded below. you can use the simplex algorithm.mathworks. the exit message is 9 of 13 14/03/2011 9:38 PM .com/help/toolbox/optim/ug/linprog. 'on') and passing options as an input argument to linprog. If the value computed violates another constraint. described in Medium-Scale linprog Simplex Algorithm. Several possible conditions might occur that cause linprog to exit with an infeasibility message. If one of the elements of x is found not to be bounded below. Diagnostics Large-Scale Optimization The first stage of the algorithm might involve some preprocessing of the constraints (see Large Scale Linear Programming). If one of the rows of Aeq has only one nonzero element.Solve linear programming problems .

Note The preprocessing steps are cumulative. one of the two following termination messages is displayed. One or more of the residuals. the exit message is Exiting due to infeasibility: Singleton variables in the equality constraints are not within bounds.html Exiting due to infeasibility: Singleton variables in equality constraints are not feasible. (The dual residual < TolFun. even if your constraint matrix does not have a row of all zeros to begin with.MATLAB http://www. the dual problem. The messages differ according to how the infeasibility or unboundedness was measured. or the residuals are neither growing nor shrinking.com/help/toolbox/optim/ug/linprog.mathworks.(The primal residual < TolFun. respectively. other preprocessing steps may cause such a row to occur. If the singleton variable can be solved for but the solution violates the upper or lower bounds.) If the residuals are growing instead of getting smaller. and the related stopping criteria. The dual appears to be infeasible (and the primal unbounded).(The primal residual < 10*TolFun. the primal problem.Solve linear programming problems . or total relative error has grown 100000 times greater than its minimum value so far: or One or more of the residuals. or total relative error has stalled: After one of these messages is displayed. the primal. Once the preprocessing has finished. duality gap. For example. duality gap.) 10 of 13 14/03/2011 9:38 PM . the iterative part of the algorithm begins until the stopping criteria are met. it is followed by one of the following six messages indicating that the dual.) The dual appears to be infeasible (and the primal unbounded) since the dual residual > sqrt(TolFun).) The primal appears to be infeasible (and the dual unbounded). (See Large Scale Linear Programming for more information about residuals. or both appear to be infeasible.

MATLAB http://www.Solve linear programming problems . When the equality constraints are inconsistent. linprog produces a result that minimizes the worst case constraint violation. can be small.(The dual residual < 10*TolFun. Note that. there is no feasible solution.html The primal appears to be infeasible (and the dual unbounded) since the primal residual > sqrt(TolFun). Limitations Medium-Scale Optimization 11 of 13 14/03/2011 9:38 PM . which is a measure of primal constraint satisfaction. The primal appears to be infeasible and the dual unbounded since the dual objective > 1e+10 and the primal objective > -1e+6. Medium-Scale Optimization linprog gives a warning when the problem is infeasible. Warning: The constraints are overly stringent. In this case. there is no feasible solution. the primal (objective) can be unbounded and the primal residual.com/help/toolbox/optim/ug/linprog. In this case. linprog gives Warning: The equality constraints are overly stringent. Unbounded solutions result in the warning Warning: The solution is unbounded and at infinity. for example. Both the primal and the dual appear to be infeasible. the constraints are not restrictive enough. linprog returns a value of x that satisfies the constraints.) The dual appears to be infeasible and the primal unbounded since the primal objective < -1e+10 and the dual objective < 1e+6.mathworks.

575–601. pp. Y. G.com/help/toolbox/optim/ug/linprog.B." Technical Report TR96-01. "Generalized Simplex Method for Minimizing a Linear Form Under Linear Inequality Restraints. 1955. the only levels of display. "On the Implementation of a Primal-Dual Interior Point Method. References [1] Dantzig. S.. See Also quadprog.Solve linear programming problems .. [3] Zhang. MD. University of Maryland. [2] Mehrotra. and P. 5." Pacific Journal Math. 183–195. see Linear Programming Examples.. "Solving Large-Scale Linear Programs by Interior-Point Methods Under the MATLAB Environment. July 1995.MATLAB http://www. For more examples of linear programming. Vol. iterative output using 'iter' is not available. Vol. Department of Mathematics and Statistics. Baltimore. Orden.. 1992.html At this time. Wolfe. are 'off' and 'final'." SIAM Journal on Optimization. 12 of 13 14/03/2011 9:38 PM . Baltimore County.mathworks. 2. optimtool For more details about the linprog algorithms. see Linear Programming. A. pp. using the Display option in options. Large-Scale Optimization Large-Scale Problem Coverage and Requirements For Large Problems A and Aeq should be sparse.

mathworks.Solve linear programming problems .The MathWorks. - Site Help .RSS Trademarks - Privacy Policy - Preventing 13 of 13 14/03/2011 9:38 PM .Patents Piracy . or optimize system performance.com/help/toolbox/optim/ug/linprog. fit models to data.MATLAB http://www. Get trial software © 1984-2011.html Free Optimization Interactive Kit Learn how to use optimization to solve systems of equations. Inc. Get free kit Trials Available Try the latest version of optimization products.

Sign up to vote on this title

UsefulNot useful- Op Tim Matlab
- Linear Programming With Matlab
- 1 Linear Programming Problems 2010
- Wiley_ Deter Minis Tic Operations Research_ Models and Methods in Linear Optimization
- Linear Programming
- lec15
- Chvatal Linear Programming
- Syllabus_162_Spring2014
- Junior 0 (1)
- AVU - Linear Programming
- Operations Research
- Interior Point Method
- MAT 401 ModuleDescriptor WS14
- Draft Ujian 1 (Teknik Kuantitatif
- QUANTITATIVE TECHNIQUESIN MANAGEMENT -.pdf
- Linear Programming Ppts
- Equivalent
- Lecture 3
- Describe the Transporation Problem and Give Its Mathematical Model. Explain by Taking an Illustration the North-West Corner Rule the Least Cost Method and The
- Chapter22.pdf
- Exam+3 Sample (1)
- Lecture 1
- Simplex Method - Maximisation Case
- Opt Mef344
- Simplex Method
- Application of QT in Mgmt
- Or 2marks Ans
- Or Lecture1
- MB0048 Operation Research Assignments Feb 11
- MB0048 Winter Drive Assignment 2011
- Solve Linear Programming Problems - MATLAB