Models Linear Programming Problems: lp prob

From TomWiki
Jump to navigationJump to search

Notice.png

This page is part of TOMLAB Models. See TOMLAB Models.

In lp_prob there are 54 linear programming test problems with sizes to nearly 700 variables and 500 constraints. In order to define the 22'nd problem and solve it execute the following in Matlab:

n	= 22;
Prob	= probInit('lp_prob',n); 
Result  = tomRun('',Prob);

The general formulation in TOMLAB for a linear programming problem is:


where , , and . Equality constraints are defined by setting the lower bound to the upper bound.

Equality constraints are defined by setting the lower bound to the upper bound.

An example of a problem of this class, (that is also found in the TOMLAB Quickguide) is lpQG:

File: tomlab/quickguide/lpQG.m

%   lpQG is a small  example problem  for defining and solving
%   linear programming problems  using  the  TOMLAB  format.

Name	= 'lpQG';	%   Problem name, not  required.
c 	= [-7  -5 ]'; 	%   Coefficients in linear objective function
A	= [ 1	2
            4	1 ];	%   Matrix defining linear  constraints
b_U	= [ 6  12 ]';	%   Upper bounds on the  linear inequalities 
x_L	= [ 0	0 ]';	%   Lower bounds on x

% x_min and x_max are  only  needed if doing  plots 
x_min = [ 0	0 ]';
x_max = [10    10 ]';

%   b_L,  x_U and x_0 have default values  and need not  be defined.
%   It is possible to  call  lpAssign with  empty [] arguments instead 
b_L	= [-inf -inf]';
x_U	= [];
x_0	= [];

%   Assign  routine for defining  an LP problem.  This  allows   the  user

%   to  try any solver, including  general  nonlinear solvers. 
Prob = lpAssign(c, A,  b_L,  b_U, x_L,  x_U, x_0,  Name,...
               [], [], [], x_min,  x_max,  [], []);

%   Calling driver routine  tomRun  to  run  the  solver.
%   The 1 sets  the  print level after optimization.
%   Result.x_k contains the  optimal decision variables.
%   Result.f_k is the  optimal  value. 

Result  = tomRun('pdco',  Prob,  1);

%Result = tomRun('lpSimplex', Prob,  1);
%Result = tomRun('minos',  Prob,  1);
%Result = tomRun('snopt',  Prob,  1);
%Result = tomRun('conopt',  Prob,  1);
%Result = tomRun('knitro',  Prob,  1);
%Result = tomRun('cplex',  Prob,  1);
%Result = tomRun('xpress-mp', Prob,  1);