50.0 LPMAX Command
The LPMAX command allows solution of LP maximization problems. A special
feature allows sensitivity analysis to be performed that illustrates
the effect of changing assumptions of the model on the profit, the
primal solution and the dual solution. This command ONLY handles
maximization problems with constraints LE or EQ to a value. If your
problem involves GE constraints, multiply through by -1 to convert the
constraint. Likewise any minimization problem can be converted. Note:
AX le B
Max CX
all X GE 0
implies a dual
A'W ge C'
min B'W
In economics usually X = the production of a good, B = production
constraint and C = price product is sold for and W = shadow price or
the value of removing a constraint. Note the solution of the
maximization problem gives rise to vector of optimum production (X)
and a vector of shadow prices (W) or the value of removing the
constraint. The LPMAX command contains modified versions of routines
obtained from the 8th edition of the IMSL library. The B34S MATRIX
facility contains more options than are available here.
In the MATRIX facility the range of X can be set to include negative
numbers & the constraints can be set as
BLEFT LE AX LE BRIGHT
AX GE BRIGHT
AX EQ BRIGHT
or some combination of the above
Quadratic programming is supported as is nonlinear programming where the
objective function and the constraints can be nonlinear. The LPMAXC
command may be easier to use for simple problems.
Form of LPMAX command.
B34SEXEC LPMAX options parameters$
AMATRIX $
BVECTOR $
CVECTOR $
SIMULATE $
B34SEEND$
The AMATRIX, BVECTOR and CVECTOR sentences are required unless
AUNIT, BUNIT or CUNIT are set.
Options of LPMAX sentence.
NPRINT - Suppress printing of input.
Pamameters on LPMAX sentence.
N=n1 - Sets number of cols of A and number of elements in
C vector.
M1=n2 - Sets number of inequality constraints.
The inequality constraints are listed first
in the A matrix.
Either or both of M1 and M2 must be gt 0.
M2=n3 - Sets number of equality constraints.
AUNIT=n4 - Sets unit to read A matrix in free form.
BUNIT=n5 - Sets unit to read B vector in free form.
CUNIT=n4 - Sets unit to read C vector in free form.
AMATRIX sentence.
The AMATRIX sentence provides the means to input the production
coefficients. Unless AUNIT is set, the AMATRIX sentence is required.
Parameters on AMATRIX sentence.
AMATRIX( ) - Passes values by row into A matrix. The number of
columns = N. The number of rows = M1+M2.
BVECTOR sentence.
The BVECTOR sentence provide a means to input the constraints.
Unless BUNIT is set, the BVECTOR sentence is required.
Parameters on BVECTOR sentence.
BVECTOR( ) - Passes values into B vector. The number of
elements = M1+M2.
CVECTOR sentence.
The CVECTOR sentence provides a means to input the costs or
prices. Unless CUNIT is set, the CVECTIR sentence is required.
Parameters on CVECTOR sentence.
CVECTOR( ) - Passes values into C vector. The number of
elements = N.
SIMULATE sentence.
The simulate sentence allows user to test how the model would
perform over a range of values.
SIMULATE sentence options
NOPRINT - Turns off printing of results
REWINDDMF - Rewinds DMF file prior to saving
simulation.
DMF - Uses unformatted DMF for save.
FDMF - Uses formatted DMF for save.
SIMULATE sentence parameters
SIMULATE=key - Key must be set as A, B or C.
I=n1 - Sets index number for column or element to
study. I is a required parameter.
J=n2 - Sets index number of row to study. J is
required if SIMULATE=A.
BEGIN=r1 - Sets beginning value to simulate. BEGIN is
required.
END= r2 - Sets ending value to simulate. END is required.
NSTEPS=n3 - Sets number of steps. Default = 20.
DMFUNIT = n3 - Sets DMF unit to save results. Variables saved
are VALUE OBJ PRIM0001 ... PRIM00n, DUAL0001 ....
DUAL000m where m=m1+m2.
DMFNAME=key - Sets DMF name. Default = SIM.
Example # 1.
User wants to solve
Max x1 + 3*x2
Such that
x1 le 1
x2 le 1
x1 + x2 le 1.5
-x1 - x2 le -.5
x1 ge 0
x2 ge 0
b34sexec lpmax n=2 m1=4 m2=0$
amatrix(1.0 0.
0. 1.
1. 1.
-1. -1.)$
bvector(1. 1. 1.5 -.5)$
cvector(1 3.)$
b34srun$
This problem will produce a maximum of 3.5.
A primal solution vector of ( .5, 1.0).
A dual solution vector of (0. 2 1. 0).
Example # 2.
User wants to problem 1 and look at how solution would change if
a(1,1) were changed from 1.0 to .5 to 1.5 in 10 steps.
b34sexec lpmax n=2 m1=4 m2=0$
amatrix(1.0 0.
0. 1.
1. 1.
-1. -1.)$
bvector(1. 1. 1.5 -.5)$
cvector(1 3.)$
simulate=a i=1 j=1 begin=.5 end=1.5 nsteps=10$
b34srun$
Notes: If the problem contains
min z = 20x + 4y
the appropriate max is
max -z = -20x -4y
If the problem contains
10x + 20y ge 10
it can be replaced with
-10x -20y le -10