Citation
Study of optimum number, sizes, and locations of wastewater treatment facilities in Alachua County, Florida

Material Information

Title:
Study of optimum number, sizes, and locations of wastewater treatment facilities in Alachua County, Florida
Series Title:
Economics report - University of Florida Food and Resource Economics Dept. ; 91
Creator:
Lee, Jonq-Ying
Bartilson, Stan
Zepp, G. A.
Place of Publication:
Gainesville, Fla.
Publisher:
University of Florida Agricultural Experiment Station
Publication Date:
Language:
English

Subjects

Subjects / Keywords:
Linear programming ( jstor )
Commodities ( jstor )
Supply ( jstor )

Record Information

Source Institution:
University of Florida
Rights Management:
All applicable rights reserved by the source institution and holding location.
Resource Identifier:
51317121 ( OCLC )

Downloads

This item has the following downloads:


Full Text






A User's


Manual for the LCRAND


Mathematical Programming


System


ad and Resource Economics Department
)ride Agricultural Experiment Stations
titute of Food and Agricultural Sciences
Ivrsnity of Florida, Gainesville 32611
I cooperation with
mmodity Economics Division
onomics, Staistics & Cooperative Service
ited States Department of Agriculture


Sta


G. A. Zepp

T. Takayama













ABSTRACT


This manual provides basic instruction in the use of the LCRAND
mathematical programming software. LCRAND, a modified version of
RANDQP, provides an efficient methodology for solving linear comple-
mentarity programming problems arising from economic models involving
international trade and other problems requiring optimization of a
non-linear objective function subject to a set of linear constraints.
LCRAND is unique in that it can handle problems in which the inter-
action terms between activities are not symmetric--a limitation of
quadratic programming solution algorithms. Experience to date indicates
LCRAND is efficient and reliable in solving small and intermediate
size problems.



Key words: Linear programming, Quadratic programming, Linear
complementarity programming.













TABLE OF CONTENTS


ABSTRACT . . . . .

LIST OF TABLES. . . . .

LIST OF FIGURES . .. . .

INTRODUCTION . . . .

DESCRIPTION OF LINEAR AND NONLINEAR MODELS..

General Non-Linear Programming . .
Linear Programming . . .
Quadratic Programming. . . .
Linear Complementarity Programming .

CONTROL PROGRAM AND DATA PREPARATION. .

Basic Structure of the Card Deck ..
Input Format . . . .
Control cards . . .
Row data cards. . . .
Matrix data cards.. . .
RHS data cards. . . .
Problem Dimension. . . .

SAMPLE PROBLEM NUMBER ONE . . .

A Single Commodity, Three Region Model .
Model description .. . .
Input data . . .

OUTPUT . . . . .
Short Output . . . .
Row Output . . . .
Primal-Dual Variable Solution Output .

SAMPLE PROBLEM NLUBER TWO . . .

A Two Commodity, Three-Region Model. .

DETAILED DESCRIPTION OF PROGRAM CONTROL CARDS

Type 0 Control Cards . . .
BEGIN . . . .


Page

i


rr






TABLE OF CONTENTS--Continued

Page

END .. . . . . . .41
EOF . . . . . . 41
ERRORS . . .. . . ... 42
EXIT. .. . . ........ 42
GO . . . . . .. 42
INVERT. . . . 42
OUTPUT.. . . . . . . 42
PARAME. . . . '. * 42
PUNCH . . . . . . 42
SETINV . . . . . 42
SOLVE . . . . . . 43
TAPE. . . .. . . .. 43
(blank card) . . . . .. 43
comment card .... .. ... .. . 43
TYPE 1 Control Cards ..... ... . . 43
PRiIODE. . . . . . . 43
L(o) . . .. . . . 45
LI IT . . . . . ... 45
TYPE N Control Cards . . . . .. 45
ALTERA. ........ .. .. . ... 45
ALTERB. .. .... . . 45
BASIS ... . 46
BASIS*. . . . . .. 46
FREQUE. . . . . . 46
MATRIX. . .. . . . 47
RHS . . . . . 47
ROWS. . . . . .............. 47
TOLERA . . . . . . 47
PIVOT . . ..... ......... 47
REJECT . . . . * *47
COST. . . . .* . 48
RESET ... ... . . . 48
ENTRY . . . * 48
TMULT ... . ..... . 48

MULTIPLE SOLUTION PROCEDURES. .. .. ........ 48

APPENDIX A--PSRAND DOCUMENTATION . . . . 58

APPENDIX B--JCL USED TO CREATE LCRAND AT THE UNIVERSITY OF
FLORIDA . . ............ 64

APPENDIX C--USE OF RANDQP . . .. ..... 67

APPENDIX D--LCRAND-RANDQP SOLUTION ALGORITHM ....... 69

APPENDIX E--EXPANDING PROBLEM DIMENSIONS.. . .. ... 71

REFERENCES ......... ................ 73





iii












LIST OF TABLES


Table Page

1 Demand and supply functions for Regions 1, 2, and 3. 15

2 Transportation cost matrix . . . ... 16

3 Asymmetric Q matrix coefficients for 3 region, 2 product
Sample Problem Number 2 . . . 28

4 Transportation cost matrices. . . .. 30





LIST OF FIGURES

Figure Page

1 Tableau--sample problem number 1 . ... .. . 18

2 Sample problem number 1: Input deck listing . 19

3 Printed output, sample problem number 1. . ... 22

4 Tableau--sample problem number 2 . . .. 31

5 Input deck listing: Sample problem number 2 . .. 36

6 Printed output, sample problem number 2. . 38

7 Multiple solution program deck . . .. 50

8 Multiple solution version sample problem number 1. ... 53

9 Solution results multiple run problems . .. 55

10 Basis* input deck. .... . . . 56

11 Example input program for batched problems . .. 57

12 Source listing for MPSRAND documentation . 60

13 Internal matrix structure . . ... 70













A USER'S MANUAL FOR THE
LCRAND MATHEMATICAL PROGRAMMING SYSTEM


Stan Bartilson, G.A. Zepp, T. Takayama



1. INTRODUCTION


The purpose of this document is to provide basic instruction in
the use of the LCRAND (and RANDQP) mathematical programming software.
It is assumed that the reader has some familiarity with linear pro-
gramming (LP) but would like to develop the ability to use the quadratic
programming (QP) and linear complementarity programming (LCP) method-
ologies made available through LCRAND. In keeping with this assumption,
the following specific objectives were sought in the preparation of
this manual.
1. To explain briefly the differences and similarities between
the LP, QP, and LCP approaches.
2. To provide meaningful sample problems in the LCP area that
capture its representative features.
3. To provide input and programming instructions that are comp-
lete and clear.
An effort has been made to make this manual accessible to the
beginner in this area by providing extra information which an experienced
programmer probably would know. At the same time, more complete docu-


STAN BARTILSON was a Research Assistant for T. Takayama in the Food
and Resource Economics Dept. at the time this manuscript was written. He
is currently a Computer Programming Consultant at the University of Illinois
at Urbana-Champaign. G.A. ZEPP is with the Economic Research Service and
is an Assoc. Professor in the Food and Resource Economics Dept. T. TAKAYAMA
was a Visiting Professor in the Food and Resource Economics Dept. and is
a Professor of Economics at the University of Illinois at Urbana-Champaign.
Appreciation is extended to Sheryl Arroyo and Arlene Malick for numerous
suggestions and assistance in preparing the final draft of this manual.







mentation has been provided than was previously available for RANDQP
(LCRAND's predecessor) [4].


2. DESCRIPTION OF LINEAR AND NONLINEAR MODELS


Both linear and quadratic programming can be considered special
cases of the more general problem of linear complementarity programming
(LCP) [l,p. 1]. LCRAND was developed to solve an LCP type problem
arising from economic models involving international trade. Although
LCRAND will solve LP and QP problems efficiently, there are algorithmic
and economic aspects of LCP which make it distinctly different in approach
from the tradition of linear programming. We will examine briefly the
nature of LP, QP, and LCP with reference to economic and mathematical
considerations in order to illuminate the differences between them, and
to identify the common thread which runs throughout.


2.1 General Non-Linear Programming


A standard general non-linear programming (NLP) problem can be stated
as follows:
Find x that maximizes f(x) subject to g(x) > 0 and x > 0,
where
f(x) is a single valued continuous and differentiable function of
x e Rn (an n dimensional real space) and g(x) is an n vector function
of m continuous and differentiable functions gi(x), i = 1, 2, ..., m.
We know that by the Kuhn-Tucker theory of NLP, if the following
saddle value problem (SVP) has a solution as stated, the x part of the
saddle point is a solution of the NLP [5, Chapt. 2]:

Find a saddle point (x, p) that satisfies the saddle value property
that


LCRAND is actually a modified version of the RANDQP program. The
specific differences are described in Appendix C.







<(x, p) (O(x, p) <(x, p)
for x > 0 and p > 0,
where
O(x, p) E f(x) + p'g(x).

Thus, instead of approaching NLP per se, (whose solution algorithms
are known to be"quite restricted), it will be worthwhile to approach it
from the SVP side.
The necessary conditions (usually called the Kuhn-Tucker conditions)
for (x, p) to be a saddle point are as follows:


(NL1) < 0 and ix = 0
i- x

(NL2) 4> 0 and 41p = 0
p

(NL3) R > 0 and p> 0,

where
( and >. are an (n x 1) vector, [ao/ax ...1D/ax b] -
P=P
and an (m x 1) vector, [/apl... /p' 1p x= respectively.
P=P
Thus, if x and F are found to satisfy (NL1), (NL2) and (NL3), we
have to check if R is actually a maximizing solution of the NLP. This
is guaranteed if

(NL4) each of f(x) and gi(x), i = 1, 2, ..., m, is a concave
function of x.

Another natural condition for the existence of a solution for the
NLP problem is

(NL5) the feasibility set X = {xjg(x) > 0 and x > 0} is non-empty,

Sometimes the uniqueness of a solution may be of interest. The
following condition (along with NL4 and NL5) will answer this question:


f(x) is strictly concave in x E X.


(NL6)







With this general background, let us investigate the properties of
LP and QP problems.


2.2 Linear Programming


A linear programming problem is commonly:stated in the following
manner.
Maximize
(Ll) c'x

subject to the restriction that


Ax < b
(L2)
(L2) x >0


where c and b are known vectors, A is a known matrix, and x is a vector
of variable activities which are controlled by a decisionmaker. The
constraints Ax < b and x > 0 mark off a set of points in a product space
which represent the set of choices available to the decisionmaker due to
technological, economic, and institutional constraints. The objective
of the problem is to choose one point R which is in this set and which
makes the product c'x as large as possible. The term c'x is the objective
function which may, for example, represent net profit associated with the
set of activities chosen.
The necessary conditions for the saddle value solution of this LP
problem can be stated as follows:


(L3) c A 0 and (c A ) x = 0; (NL1)

(L4) b Ax > 0 and (b- Ax) = 0; (NL2)
and

(L5) x> 0 and 5 > 0; (NL3).

Condition (L4) states that the primal constraints must be satisfied
and that for each non-binding constraint, the shadow price or dual
activity associated with it must be zero. This concept is central to our
discussion and should be considered carefully. In the context of LP,








each row generally represents a 'resource" or "flow" where the bi assoc-
iated with that row is the fixed exogenous quantity available of the
"resource." If that "resource" is not exhausted (i.e. strict equality
does not hold for a given row) then the resource is assigned a zero
"price" because it is in excess supply.

The condition (L3) is less transparent than (L4) but has a similar
interpretation. Each element of c represents the cost associated with
an input or the revenue associated with an output. In the first part of
condition (L3) we can interpret each row as follows. For a given row of
AT we can consider each element to be the amount by which a primal act-
ivity adds to or subtracts from the availability of a resource or flow.
For inputs, this means that the cost should be allocated so that the
shadow prices reflect the amount that the input adds to each "resource"
or "flow." For outputs, it means that the shadow prices should reflect
the value of the output and the contribution of each resource to the
output.
The second part of (L3) merely states that if the price relation-
ships do not hold with equality, then the input is not economical to use
or the output is not profitable enough to produce, so the associated
activity should be zero.
Condition (NL3) is a natural condition and trivially met. Condition
(NL4) is trivially met in this case since f(x) E c'x is a concave
n
function and b. a..x. E g.(x), i = 1, 2, ..., m, is also a concave
1 j=l 13 3 1
function. Condition (NL5) is not trivial in practice as one can easily
formulate an LP problem which has an empty X. Since (NL6) is not met in
this case, the uniqueness of a solution is not guaranteed.


2.3 Quadratic Programming


Quadratic programming has been used for some time in engineering
applications, but has only recently come into use with problems which
are fundamentally economic in nature. For economic modeling purposes,
the landmark work in the use of quadratic programming is the book Spatial
and Temporal Price and Allocation Models [5]. This volume contains an
exhaustive treatment of a broad range of models which use mathematical







programming in general and quadratic programming and linear complementary
programming in particular.
The fundamental concern which motivates alternatives to linear pro-
gramming is the concern of the economist to develop models which repre-
sent a market situation rather than merely the perspective of"an indiv-
idual decisionmaker. In particular, there is no way in LP to include
both market prices and quantities as continuous endogenous variables,
The reality of spatially distinct markets separated by a transportation
cost with each market having its own set of continuous demand and supply
functions can not be represented.
Quadratic programming provides a method for handling the above pro-
blems in a convenient manner. The mathematics of the approach is non-
trivial and is fully covered in [5]. Conceptually and practically,
however, the approach is fairly simple.
The general QP problem has the following form:

Maximize


(Ql) c'x l/2x'Qx

subject to

Ax < b
(Q2)
C( 2)x > 0


As in the LP problem, c and b are known (fixed) vectors, and A is a
known matrix. The vector x is a set of unknown variables, and in this
case, Q is a known symmetric, positive semi-definite matrix.
In the case of market-oriented QP models, the objective function is
created by generating the sum of consumers' and producers' surplus, and
subtracting any fixed costs associated with transportation or production.
The c'x portion of the objective function consists of the linear costs
for production and transportation and the intercepts of the demand and
supply functions. The quadratic terms of the objective function arise
from the integration of linear demand and supply functions done to
measure consumer's plus producer's surplus.
The Ax < b constraint set describes the material availability and
requirement balance relationships, capacity constraints, etc. in the
model.







The solution of a quadratic programming problem is straightforward
because of the fact that the optimality conditions, the counterparts of
(NL1) and (NL2), for a quadratic program are linear. Applying the Kuhn-
Tucker theorems, the sufficient, (NL4), and necessary, (NL1), (NL2), and
(NL3), conditions for an optimal solution can be reduced to:

(Q3) the Q matrix be positive semi-definite (sufficiency condition)

and
T-
T T-) x= 0
(Q4) c Qx Ap < 0 and-(c -Qx A

-T
(Q5) b Ax i 0 and (b Ax) p = 0

where x > 0 is the equilibrium set of quantities and p > 0 is the
Lagranigian and can be interpreted as the equilibrium set of market
prices in the context of [5].
The positive semi-definiteness condition, (Q3) is generally met as
long as the demand and supply functions are well-behaved (downward sloping
and upward sloping respectively). The condition (Q5) is essentially the
same as for the linear programming situation and has the same interpre-
tation. The relationships (Q4) are the same as for LP in rows where the
Q matrix coefficients are zero. In the case of non-zero Q coefficients,
the row will have the following form.

n n
S- x and (c ..x.)p
S ji i 1 j=l 13 i1

If the first part holds with equality, it means that the demand (or supply)
function is satisfied with equality and the particular commodity can have
a positive price. If it does not hold with equality, this implies that
there is not a positive price that will clear the market and thus price
has to be zero.
It should be clear that the economic rationality which prevailed in
the LP problem carries into QP, with the added benefits of endogenous,
market prices and quantities. The quadratic programming approach suffers
a major deficiency, however, as a result of the requirement that the Q
matrix be symmetric. The off diagonal elements of Q represent substitution
and complementary relationships between different commodities in the







model. Symmetry of Q implies that these commodity relationships be
exactly equal between two commodities. For example, if we have two
commodities and two demand functions of the following form:


P1 1 11l 12 2

P2 2 '21x! W22x2

then w12 must equal ',i if the interaction between the two commodities
is to be correctly specified by QP.
In practical econometric work, the chances of such interaction
coefficients arising naturally from statistical estimation are very remote
unless one superimposes the symmetry condition stated above in the esti-
mator. Thus, we are left with a need for a modeling procedure which
allows a more general set of demand and supply functions (i.e. an asym-
metric Q matrix), and still preserve the economic rationality of the model
(chapters 14 and 18 of [5]).


2.4 Linear Complementarity Programming


Solution of QP problems involves a simplex type algorithm, however,
the basis change decisions cannot be made with direct reference to the
objective function as in linear programming. QP type algorithms proceed
to find an optimal solution by finding a solution which satisfies the
conditions (Q4) and (Q5) (i.e. the Kuhn-Tucker necessary conditions for
solving a quadratic programming problem). The problem may be stated in
the following manner.
Find x, p, w,' w2

which satisfy


(LCP2) 1 +
w2 -A Q x

(LCP2) w'p = 0 and w x 0


x, p, w1, w2 non-negative.


(LCP3)







In this problem, we have an unknown vector of slack variables formed by

wl and w2; a constant vector formed by the right hand side values, -b;
and the linear part of the objective function, c; a square matrix made
up of the A matrix, the negative transpose of A and the Q matrix; and
finally another unknown vector composed of the prices p, and quantities
x. This type of problem is known as a linear complementarity programming
problem, and has a wide range of applications.
The general LCP problem is stated as follows.

Find w, z

such that

(LCP4) w = q + Mz

(LCP5) w'z = 0
and
(LCP6) w > 0 and z > 0.

In such a problem w and z are unknown vectors (of dimension n), q is
a fixed vector, and M is a known square matrix. The correspondence
between (LCP1) and (LCP2) and between (LCP2) and (LCP5) should be clear.
In terms of the model approach used here,


q [ M= T and z =
c -A -Q x


with w a slack vector. It is called a complementarity programming pro-
blem because a "complementary" relationship must hold between the unknown
vectors, w and z. In particular, w.z = 0 for all i. wi and z. are said
to be complements of each other. Only one of them can be positive. If
the reader will recall our previous arguments, it will be noted that this
is exactly the kind of relationship expressed by the second part of
conditions (L3) and (L4) or (Q4) and (Q5). Aside from this being a purely
mathematical curiosity, it was pointed out previously how this kind of
relationship is inherent in an equilibrium solution to an economic model-
ing problem.








The solution to an LCP problem of the special type in (LCP1), (LCP2)
and (LCP3) with the matrix structure discussed above, will be the optimal
solution to the corresponding quadratic programming problem. Also, if
Q is a zero matrix, the problem reduces to a linear programming problem.
There are a number of algorithms for solving an LCP problem [6], [3], [1].
The reader is referred to [1] for the conditions for solvability of LCP.
The algorithm used in LCRAPD (and RANDQP) is described in Appendix D.
Typically, LCP algorithms'work by creating an initial basic solution
that violates w > 0 or in which a nearly complementary solution is
2 -
created with the introduction of another artificial vector. Then the
algorithm proceeds by carrying out a series of simplex like pivot opera-
tions until a non-negative fully complementary solution is reached.
It was mentioned above in the discussion of quadratic programming
that the symmetry restriction on Q sometimes creates a serious problem
in applied research (see chapters 14 and 18 of [5]). It is apparent
that a solution to (LCPI), (LCP2), and (LCP3) with an asymmetric Q
represents a true market equilibrium soltuion in the Marshallian sense
and still preserves all the relationships discussed above. The only
difference is that the solution is not "optimal" in the sense of
quadratic programming, since a welfare function involving producers
and consumers surplus cannot be formed because the integration used to
create such an objective function requires the symmetry restriction
[5, p. 116]. For purposes of analyzing market behavior or making pro-
jections for the future, an objective function is sometimes really
unnecessary and everything which is needed is present in a general LCP
problem. In conclusion, LCP modeling represents a market oriented
approach which:

1. Allows endogenous prices and quantities,
2. Meets conditions for a Marshallian market equilibrium,
3. Has the freedom to include technical and political
constraints explicitly; also both prices and quantities
can be constrained in a model which is impossible in
LP formulation,
4. Has an efficient solution procedure.







3. CONTROL PROGRAM AND DATA PREPARATION


3.1 Basic Structure of the Card Deck


The standard program deck which is submitted to the computer for
processing by LCRAND has the following form.
(ID and JOB cards)
1 // EXEC PGM=LCRAND
2 //STEPLIB DD DSN=A0011225.SEQ1.LCRAND,DISP=0LD
3 //FT06F001 DD SYSOUT=A
4 //FT07F001 DD SYSOUT=B
5 //FTO5F001 DD *
6 BEGIN
7 ROWS
tow data caAdc
8 END
9 MATRIX
matr/ x data c.aWcd
10 END
11 RHS
Alvght hand side data card
12 'iD
13 SOLVE
14 EXIT
15 /*


The statements numbered 1 through 5 are JCL (Job Control Language)
cards. The user need not be concerned with the details of these state-
ments since they typically do not change from one run to the next.2
Briefly, card 1 instructs the computer to execute a program called LCRAND.
Card 2 defines the data set where the program is to be found. Card 3



2This JCL will be different at different installations. In particular
the data set name (DSN) for the program data set will probably be different.
In some instances the program may be executed as an object module rather
than a load module. (See Appendix B). A catalogued procedure might exist
which would reduce the number of JCL cards.







defines the printed output data set. Card 4 defines the punched output
data set. Card 5 introduces the user specified input data set which is
coming from cards and immediately follows.
The section including cards 6-14 is the input file prepared by the
user which directs LCRAND as to what actions are to be performed and
what data to use in constructing the problem matrix. This input file is
composed of control cards and data cards. The control cards tell the
program to carry out certain actions and alert the program about what
type of data is to follow. Data cards describe the problem itself.
The BEGIN card is a control card which indicates the beginning of
a problem and causes a set of program parameters to be initialized. The
ROWS card indicates that a set of data cards follow which will define
the rows of the problem. The END card signals the end of the row data
cards. The MATRIX card indicates that the coefficient data cards for
the problem matrix are to follow. The next END card signals the end of
the matrix data cards. The RHS card indicates that right hand coefficient
data cards are to follow. END again has the same function. The SOLVE
statement calls the solution algorithm which solves the problem and prints
out the solution results. The EXIT statement causes LCRAUD to terminate
and the /* card signals the end of the user input deck.


3.2 Input Format


3.2.1 Control cards--All control cards must begin in column 1.


3.2.2 Row data cards--Each row data card defines a row in the A matrix
of the problem to be solved. The name of the row is punched in
columns 13 to 18 (left-justified with no embedded blanks). The
name is made up of any combination of alphanumeric symbols with
a maximum of 6 characters per name. The row type is punched as
a single character in column 12 according to the following code.
$ indicates that this row is actually the c-vector of our problem.
This is considered to be a non-constrained row and is the linear
part of the objective function for a QP (or LP) problem (corres-
ponds to N in the MPS system). See the following sample card.










$OBJ
0800000000000000000000000000000000 o oo000o0n00a0anon0o0000000oo800 o800
1 2 3 4 5 I S 9 10 11 12 3 14 1 16 I 11 1 281 22 233 24 25 26 11 22 2 3 2 31 32 33 34 35 36 31 3 39 40 41 42 3 4 45 46 47 4 49 5U 51 52 3 53 54 55 56 52 5 59 60 61 2 2 E3 t4 65 8 I 12 1 1 IS 121 18 25 to
111111 1 111111111111111 1 1 11 )111111~tl11 11 11 111 1111 111 1 1111 1111 1 11111




(blank) or 0 (zero) indicates an "equality" constraint.
(corresponds to E in the MPS system).
& (the "and" symbol or ampersand) indicates a "less than or
equal to" constraint. (In some versions, a + is used instead
of an &). (corresponds to L in the MPS system).
-(minus sign) indicates a "greater than or equal to" constraint
(corresponds to G in the MPS system).


3.2.3 Matrix data cards--Each non-zero coefficient in the A matrix and
the Q matrix must be specified. A data entry of zero is usually
omitted: however, a zero or a non-zero value must be input for a
position that is going to be changed later by using the "ALTERA"
control card (see section 7.3.1). The column name (also of six
characters or less and left justified with no embedded blanks) is
punched in columns 7 to 12. The row name is punched in columns
13 to 18 of the data card. The coefficient value is punched in
columns 19 to 30. See the following sample card.



XDC1 RDC1 -1.
000000000000000000000000000000000000000000000000000000000000000000000000000000
1 2 3 4 5 2 1 2 9 10 11 12 3 4 IS 15 12 0 2 1 221 2252324 2 6 2 t 28 202 3 31 323 3 36 3 3 3 31 48 2 1 4243 44 45 4 44 9 5 51 52 13 4 5 354 55 9 605 60 1 2 314 ( 66 10 1 2 2 3 14 7516 7 18 1
11111111111111111111111111111111111111 111 11111111 11 111111 11111111 11111111




The following rules must be followed in specifying matrix coefficient
data.
1) If a decimal point is not specified explicitly, it will be
assumed to be between columns 24 and 25. This in in contrast
to MPSX and MPS III which allow integers to be specified
without decimal points. To be safe, it is best to always use
decimal points.







(2) The set of column names for the A matrix must be completely
different from the set of row names for the A matrix. This
is because the row names for the Q matrix are the same as
the column names of the A matrix.
(3) All coefficients that lie in a single column must appear
together in the input file. This includes the Q matrix
coefficients and the c-vector coefficients associated with
each column of A.
LCRAND does not assumethe symmetry of Q as in the RANDQP, therefore
all non-zero Q matrix coefficients must be included explicitly even if
they are symmetric. Conventions for ensuring that demand and supply
function coefficients are inserted properly, are discussed in the next
section.


3.2.4 RHS data cards--The format for each right hand side element
follows the same pattern. The row name is punched in columns 13
to 18 and the element value is placed in columns 19 to 30. As
above, only non-zero coefficients need be specified unless the
value is going to be changed later using the "ALTERB" control
card (see section 7.3.2). A decimal point is assumed between
columns 24 and 25 if none is inserted explicitly. See the
following sample card.


RDC1 20.
U00000000000 00g00000000000000 Dg00B00800l00000000000008000g0000000000000i
S2 3 4 I 1 I I 1o 1 4 15 I6 1 1 21 21 22 23 24 1 2 3222 34 6 321224 3 3113 31 313 3 4 3 41 4243 (445 4 4714 4 459 153 54 2I SI9 4 Is2 (6 I5 7 4 I I 1 2e 1 s T12T 14
1111111111111111111111111111111111111111111111111111111111111 111 111111111




3.3 Problem Dimension


The standard versions of LCRAND and RA11DQP installed on disk at the
North Florida Regional Data Center can handle problems in which the sum
of the number of rows and columns in the A matrix is < 500. There also
is a limit of approximately 6000 non-zero Q and A matrix elements that
can be stored. The problem dimensions can be expanded if necessary (see
Appendix E).







4. SAMPLE PROBLEM NUMBER ONE


4.1 A Single Commodity, Three Region Model


This first sample problem is fairly simple and should make clear
the process of moving from a model specification to a computer solution.
This example can be considered a quadratic programming problem as the Q
matrix is a diagonal matrix (and therefore symmetric). Although small,
the problem does demonstrate the essential features which are common among
LCP models, especially when they are used for market oriented, economic
modeling purposes.


4.1.1 Model description--In the interest of simplicity with this first
example, we will only consider a single commodity. There are three
consuming and producing regions in the model, with supply and demand
represented by linear functions. The function coefficients for regions
1, 2, and 3 are shown in Table 1. Note that these are in inverse form
since a quantity formulation is used in the model, i.e., the primal
variables are quantities, (see Takayama and Judge [5, p. 129]).





Table l.--Demand and supply functions for Regions 1, 2, and 3

Demand Supply


Region 1 Pi = 25 .ly1 p = 4 + .2x1
2
Region 2 P2 = 30 .5y2 p = 5 + .3x2

Region 3 P3 = 35 .7y3 p3 = 3 + .4x3





Trade is allowed between any two regions of the model and the cost
of transporting a single unit of the commodity between two regions is
given by Table 2.







Table 2.--Transportation cost matrix

Destination region
Source 1
1 2 3
region

1 0 2.1 2.5
2 2.1 0 3.0
3 2.5 3,0 0


In this case, and in many cases, the matrix is symmetric and has
zeros along the diagonal. The inclusion of items such as marketing mar-
gins, import tariffs, etc. can result in a very different cost of trading
being entered in the model.
All possible flows of trade between the three regions are allowed
in the model. Often, many trade flow possibilities can be left out of
the model based on previous knowledge.
The monetary unit can be dollars, yen, or whatever you like. It
does not affect the presentation here. Choice of monetary units, deflator
etc. is a problem in modeling of the type done with LCRAND but is not
considered in this manual.


4.1.2 Input data--As in the MPS programming systems, we must choose names
for the rows and columns of the A matrix. It is desirable that the names
chosen be meaningful to the user, as a well chosen "system" for naming
can save unnecessary confusion and mistakes. Frequently, a workable
scheme involves assigning a certain meaning to each position in the name
and then establishing a letter code to signify different regions, commodity:
etc. For this problem, we will use the following system.
R regional (signifies a row name)
X quantity (signifies a column name)
D demand
S supply
C commodity
T trade
1,2,3 region







From this, all the names needed can be formed. For example, quantity
demanded of commodity "C" in region 2 is "XDC2"; quantity traded of com-
modity C from region 1 to region 2 is XTC12.
The expanded LCP tableau for the problem has the form shown in
Figure 1. The rows here are expressed as ">" greater than or equal to
constraints. The first three rows express the requirement that the total
amount supplied to each region (including domestic supply and net inflows
from trade) is greater than or equal to the quantity demanded in that
region. The second set of 3 rows express the relationship that the quantity
produced in each region is at least as great as the amount supplied to
all regions. These rows comprise the "A matrix". The next six rows are
the demand and supply functions. Each of these rows will normally hold
with strict equality as the complementarity conditions assure this as
long as positive quantities are produced and demanded.
The final nine rows, along with their complementarity conditions,
assure that for each trade flow the associated demand and supply prices
will differ by no more than the transport cost for that particular flow*
In summary, the whole matrix describes an economic equilibrium or market
clearing condition for the commodity sector with which we are concerned.
The input for this particular problem is shown in Figure 2. The
reader should note the difference between the matrix tableau and the
original economic data with regard to the signs (- or +) attached to Q-
matrix and C-vector (OBJ) values. There are two reasons for this
difference. First of all, the LCRAND and RANDQP work in a tableau
expressed in terms of less than or equal to constraints. The second reason
lies in that a QP problem may be defined with c'x 1/2x'Qx as the objec-
tive function or as c'x + 1/2x'Qx. LCRAND and RANDQP use the latter.
Confusion can be avoided by closely abiding by the following rules:
1) For demand functions, insert both slope and intercept coefficients with
the opposite signs from what they actually have.
2) Supply function coefficients are inserted with the same signs which
they actually have.
3) All cost data is inserted with a positive sign.
4) All profit data is inserted with a negative sign.
Inspection of our sample input problem should reveal that these rules
have been followed.















XDC1 XDC2 XDC3 XSC1 XSC2 XSC3 XTCII XTC12 XTC13 XTC21 XTC22 XTC23 XTC31 XTC32 XTC33 R HS


-1 -1 -1


__ __ __ __ __ __11-1 -. -1 -1 -I .


> 30

> 35

> -4
> -5

>-3

>0

>-2.1

>-2.5

>-2.1

>0

>-3.0

>-2.5

>-3.0
2


1

I

-1 1


Figure 1.--Tableau--sample problem number 1.




19

Card Column

1 7

BEGIN
ROWS
$0BJ
-RDCl
-RDC2
-RDC3
-RSCl
-RSC2
-RSC3
END
MATRIX
XDC1 RDC1 -1.
XDC1 XDC1 .1
XDC1 OBJ -25.
XDC2 RDC2 -1.
XDC2 XDC2 .5
XDC2 OBJ -30.
XDC3 RDC3 -1.
XDC3 XDC3 .7
XDC3 OBJ -35.
XSC1 RSC1 1.
XSC1 XSC1 .2
XSCl OBJ h.
XSC2 RSC2 1.
XSC2 XSC2 .3
XSC2 OBJ 5.
XSC3 RSC3 1.
XSC3 XSC3 .4
XSC3 OBJ 3.
XTC11 RDC1 1.
XTC11 RSC1 -1.
XTC12 RDC2 1.
XTC12 RSC1 -1.
XTC12 OBJ 2.1
XTC13 RDC3 1.
XTC13 RSCL -1.
XTC13 OBJ 2.5
XTC21 RDC1 1.
XTC21 RSC2 -1.
XTC21 OBJ 2.1
XTC22 RDC2 1.
XTC22 RSC2 -1.
XTC23 RDC3 1.
XTC23 RSC2 -1.
XTC23 OBJ 3.0
XTC31 RDC1 1.
XTC31 RSC3 -1.
XTC31 OBJ 2.5
XTC32 RDC2 1.
XTC32 RSC3 -1.
XTC32 OBJ 3.0
XTC33 RDC3 1.
XTC33 RSC3 -1.
END
RHS
END
SOLVE
EXIT


Figure 2.--Sample problem number 1: Input deck listing.








5. OUTPUT


5.1 Program Iessages--Output for the first sample problem is shown in
Figure 3. The output begins with a set of program messages. These
messages are produced automatically at various points in the execution
of the program without any direct instruction by the user. First, there
is a listing of the control cards as they are executed. Note that after
the matrix is read in, there is a statement of the dimensions of the prob-
lem and the number of entries specified. The row dimension is the actual
size of the square LCP matrix plus 3 extra rows used for computational
purposes. The column dimenison is the number of columns in the A matrix,
i.e. the quantity variables in our sample problem.
After the SOLVE statement, a two line message is printed for each
inversion. This indicates the iteration number, the number of trans-
formations and the number of entries in the transformation matrix and the
inversion type prior to performing the inversion. The inversion type is
an indication of the reason for re-inverting at that particular moment.
A type "0" inversion, which is the case in the sample problem, is the
usual type of inversion, and is caused by a request from the algorithm
for a new inverse. The two inversions that occur in this program are
generated when: a) work is initiated to find a feasible solution for
the primal subproblem Ax = b; and b) when upon reaching a feasible
solution, the basis is extended to include dual variables (See Appendix
D for further explanation). The algorithm may also call for an invert
if it has difficulty in identifying a proper pivot element. There are
two other types of inversions: a) type "1" which is caused by reaching
a multiple of the inversion frequency set by the user or the program
(default is every 10000 iterations). For a large problem requiring
considerable time, it is advisable to invert routinely in the interest of
maintaining computational accuracy; b) type "2" inversion is the result
of running out of available storage for the transformation matrix. A new
inverse will generally be more compact, and thus the program can be
allowed to proceed.
After the inversion is carried out, a message is printed to that
effect, the number of slack variables in the current basis is indicated,
followed by a "poor column" count and an update of the transformations








and transformation entry counts. A "poor column" is a column for which
all the possible pivot entries are below the pivot tolerance. This means
that an inverse for the current basis cannot be produced with confidence
for computational reasons. Therefore, all such columns are removed from
the basis before proceeding.
After the first inversion, a message indicating feasibility is
printed and the iteration at which feasibility was reached is printed
also.
The next inversion message is the result of extending the basis after
feasibility as mentioned above. Following this is a "row error" message
which indicates the amount by which the constraints fail to satisfy exact
equality. This is printed automatically after feasibility, optimality or
unboundedness is reached. The user can order this to be printed at certain
points with the use of the ERRORS control card (see section 7).
In addition to error messages and messages regarding optimality, etc.
there are three other major types of printed output: Short Output, Row
Output, and Primal-Dual Variable Solution Output. These are controlled
by the user with the PRMODE control card described in Section 7. At this
point, we will describe and interpret them with reference to Sample
Problem Number 1.


5.2 Short Output


The Short Output consists of the four lines printed below the "optimal
solution" message on the initial page of Figure 3. The (3) is the output
condition which caused this output to be printed. The meaning of this is
explained in the PRMODE discussion also. The next two names, "MATRIX"
and "RHS", are the names for the current matrix and right hand side. They
are problem identification parameters that can be set by the user by
including the desired identifiers in columns 1 to 6 of the card preceding
MATRIX and/or RHS. The names in Figure 3 are the default names.
The rest of the line contains the following information:
--current iteration count
--number of pivots performed
--number of infeasibilities
--the determinant of the matrix formed by the basis vectors














.Program "'..ss.s


BEGIN
ROWS
MATRIX
PROBLEM HAS 24 ROWS, 15 COLUMNS, and
RHS
SOLVE


42 :1RJX "TRRIE3.


3Ei.'L.Ti:rG AFTER ITERATION 0,
*INVERSION COMPLETED 6 SLACKS,


*FFr.SIELE AT ITERATION 0,


ESIT '?'II :;. AFTER ITERATION 0,
*IRi:F.Si:; COMPLETED 21 SLACKS,


O TRANSFORMATIONS WITH 0 ENTRIES,
0 POOR COLS, 0 TRANSFOiMATIONS WITH


0 STEPS


O TR;Sr.'.:L'.TID;T?. WITH 0 O -ITrIES,
0 POOR COLS, O :-.A'.?F'-AT0c:'.- WITH


MAXIMUM ERROR IS ON ROW


= 0.0


SUM OF ABSOLUTE ERRORS ON ROWS = 0.0




Short Output


=OPTIMAL SOLUTION


( 3) MATRIX R.H.S.
5IX


ITER PIVS 0 INFEAS
19 19 0.0


OBJECTIVE TOTAL
-1596.008415


E2.-033I -2
2.03330:G-- -2


= L *
1.000000 *


NEW COLUMN
XTC31


LINEAR (PX)
-3192.016830


OLD C:L'L'I PIVOT ROW
XTC31 ..DUAL ::c31


+ QUADRATIC (X'QX)
+ 1596.008415


Figure 3.--Printed output, sample problem number 1.


TYPE 0
0 ENTRIES


TYPE 0
0 ENTRIES









VALUE


XDC1
XDC2
XDC3
XTC11
XTC22
XTC33
?'iFf ..DUAL
BDC2 ..DUAL
E" c3 ..DUAL
XSC1
XSC2
XSC3
XTC13 ..DUAL
ITC12 ..DUAL
ESCI ..DUAL
XTC21
ESC2 ..DUAL
XTC23 ..DUAL
XTC31
XTC32 ..DUAL
ESC3 ..DUAL


3192.016830
74.750736
29.150147
28.535819
67.624632
29.150147
28.535819
17.524926
15.424926
15.024926
67.624632
34.749755
30.062316
5.000000
4.200000
17.524926
5.599607
15.424926
3.400000
1.526497
2.600000
15.024926


Figure 3.--Printed output, sample problem number 1--continued.


Row Output


XTC31


NAME


ROW

OBJ
RDC1
RDC2
RDC3
RSol
RSC2
RSC3
XDC1
XDC2
XDC3
XSC1
XSC2
XSC3
XTC11
XTC12
XTC13
XTC21
XTC22
XTC23
XTC31
XTC32
XTC33


RES

0.0
0.0
0.0
0.0
0.0
0.0
0.0
-25.000000
-30.000000
-35.000000
4.000000
5.000000
3.000000
0.0
2.100000
2.500000
2.100000
0.0
3.000000
2.500000
3.000000
0.0


-0.463636
-0.491803
-0.098361
0.363636
0.245902
-0.098361
0.363636
0.049180
0.049180
-0.254545
0.245902
0.163934
-0.636364
0.303726
0.0
0.049180
0.262295
0.049180
0.303726
-0.303726
-0.303726
-0.254545














Primal-Dual Variable Solution Output


PRIMAL VARIABLES SOLUTION
NAMIV VALUE


XDC2
XDC3
XSC1
XSC2
XSC3
XTCI!
XTC21
XTC22
XTC31
XTC33


74.750736
29.150147
28.535819
67.624632
34.749755
30.062316
67.62L2:
5.599607
29.150147
1.526497
28.535819


DUAL VARIABLES SOLUTION
FAME VALUE


XTC12
XTC13
XTC23

RDC1
RDC2

RSCI
RSC2
'323


4.200000
5.000000
3.400000
2.600000
17.524926
15.42,4926
15.024926
17.524926
15.424926
15.024926


Row Errors Output


MAXIMUM ERROR IS ON ROW OBJ
SUM OF ABSOLUTE ERRORS ON ECOW


= 1.88D-13
= 2.16D-13


EXIT


Figure 3.--Printed output, sample problem number 1--continued.








--the "old column" which is the last column to leave the basis
--and finally, the pivot row for the last basis change.
The last two lines give objective function information about the
solution. This information is only meaningful if the problem is an LP
or QP problem as defined above. For general LCP problems, this should
be ignored.
The information items given are the total objective function value,
the X or L value (always 1 unless the risk programming parametric feature
is in use--see section 7.2.2) the value of the linear part of the objective
function, and the value of the quadratic part of the objective function.


5.3 Row Output


The next section of printed output is the Row Output. The first
column is merely a list of the names of the variables in the basis. A
"..DUAL" marker indicates that that particular variable is a dual vari-
able. The VALUE column gives the value of each basis variable. The
column labeled ROWS is a list of the rows of the problem in its expanded
LCP tableau form. The next column labeled RHS is a list of the right
hand side values associated with each row of the expanded LCP matrix. In
T
the previous notation, this corresponds to the [-b c] vector. The final
column is only used for certain types of debugging problems and can be
ignored..


5.4 Primal-Dual Variable Solution Output


The fourth type of output section is the "PRIMAL-DUAL VARIABLE
SOLUTION." It is broken up into a primal variable section and a dual
variable section and each section has a list of variables and their
associated values. If a primal variable appears in the dual variables
section, this is an indication that the primal variable with this name
has a value of zero and the value given is actually the artificial or
slack (or complementary) variable value. Conversely, if a dual variable
appears in the primal section, it is an indication that the named dual
variable is zero and its associated artificial has the given value.







The final section shown in Figure 3 is another output of the row
errors after the solution is printed and c'piiri.:1'i y is declared.
Now that the format and content of the pr-ilcidl output for LCRAUD has
been fully described, something should be said about the meaning of the
solution results.
The most important information for most priiposcs is presented concisely
in the Primal-Dual Variable Solution Output. In market-oriented economic
modeling, a quantity formulation of the model implies that primal vari-
ables represent the equilibrium quantities produced, traded, and sold,
and the dual variables represent the market prices under conditions of
equilibrium. In our particular example, the solution indicates the follow-
ing conclusions:
--the quantity of the indicated commodity consumed (or demanded)
in region 1 for the given time period is about 74.75;
--both regions 2 and 3 export to region 1;
--region 1 does not export anything and ;:'?ion:; 2 and 3 do not trade
between themselves at all;
--the demand and supply prices are equal in each region, therefore
each domestic market clears;
--the difference between the market prices in regions 1 and 2 is
exactly 2.1 which is the transportation cost between the two regions.
An analgous situation holds for regions 1 and 3. No trade is
profitable between regions 2 and 3 because the rice differential
of .4 is less than the transportation cost of 3.
The above statements should give the reader an understanding of the
interpretation.of this type of modeling approach. For a different
problem, e.g. miinimizing a quadratic cost finmcc. -:n, the interpretation will
be unique to the application. The interpri'c:ati.-o of quantities is
strictly up to the modeler and is generally straightforward. With regard
to prices, one can generalize in so far as the following:
1) If demand and/or supply functions are used the prices will
represent market, valuations
2) In other cases, prices will represent imputed values in a
similar sense to shadow prices in linear programming.








6. SAMPLE PROBLEM NUMBER TWO


6.1 A Two Commodity, Three-Region Model


This problem is similar to the one above except that it is expanded
to include two commodities and has the asymmetric Q property. It will
demonstrate the structure of a general LCP market oriented problem and
clarify the input strategy. To recap from the last section, there are
essentially four steps to model development.
1) Model specification--Deciding on commodities, regions, time
periods, and functional relationships for the model. Formulating
data tables with actual coefficients to be used.
2) Tableau formulation--Making matrix "tableaus" of the model either
as a whole or in sections to organize the data, clarify the matrix
structure, identify errors, and allow for straightforward prepar-
ation of computer input.
3) Preparation of computer input--This involves the coding and
punching of computer statements which give model coefficients
and represent the model structure. This is the most tedious of
the four steps and therefore is usually the source of most errors.
It should be done systematically and carefully.
4) Solving the model--This step includes inputting the model into the
computer system properly, identifying and correcting errors,
analyzing solution results, and developing and implementing a
strategy for generating model scenarios based on different para-
meter assumptions.
The tangible results of these particular steps in creating sample
problem number 2 will now be duplicated.
Consider two products, A and B with three spatially distant regions
separated by constant transportation costs. Commodities A and B are
considered to be substitutes for each other. Both producers and consumers
make decisions regarding each commodity on the basis of the current price
of the other. The demand and supply functions are shown in Table 3.
These again have quantities as the independent variables to fit into our
quantity formulated model. The inverse forms which are more familiar can
be derived from this set but will not be presented here.










Table 3.--Asymmetric Q matrix coefficients for 3 region, 2 product Sample Problem Number 2

Price Intercept Quantiy Cross product Quantity
o Qe coefficient coefficient

a
RDAI = 20 .1 XDA1 .005 XDB1
RDA2 = 25 .2 XDA2 .02 XDB2
RDA3 = 22 .125 XDA3 .006 XDB3
RDB1 = 30 .1 XDB1 .01 XDA1
RDB2 = 35 .2 XDB2 .04 XDA2
RDB3 = 27 .1 XDB3 .012 XDA3
RSA1 = 5 + .1 XSAI .004 XSB1
RSA2 = 2.4 + .05 XSA2 .002 XSB2
RSA3 = 4.5 + .1 XSA3 .007 XSB3
RSBI = 4 + .07 XSB1 .003 XSA1
RSB2 = 2.3 + .04 XSB2 .001 XSA2
RSB3 = 3.8 + .07 XSB3 .008 XSA3


aRead

of commodity


D D = D
as P = 20 .1X .005X', whereP = price of commodity A in region 1; XM1 = quantity
A Al
A consumed in demand re ion l1;i and = quantity of commodity B consumed in demand region 1.








The transportation costs for each product and source-destination
combination are shown in Table 4. They have a similar form to sample
problem 1. All possible transportation flows will be allowed, and the
same naming scheme will be followed as that used in the first problem.
The model tableau can now be generated from the above information,
see Figure 4. Note in particular the asymmetry of the Q matrix, the
organization of the matrix for two commodities, and the repetition of
the basic transportation flow scheme in the A matrix.
The input data and control cards for the problem are shown in
Figure 5. The scheme here also is analogous to problem 1, although
the deck is significantly larger. Pay particular attention to the strict
arrangement of the data going from left to right, column by column.
Within each column, the order proceeds from top to bottom. It is only
necessary that the elements in a given column be together, but this
systematic arrangement imposes a discipline that tends to prevent errors
and brings them to the surface if they do occur.
Finally, the solution results are given in Figure 6. The solution
output description will not be repeated here, but several comments are
in order. The objective function should be ignored since this is a more
general LCP that does not fit into the quadratic or linear programming
framework. In this solution, the only exporting is done by region 2 and
this is the case for both commodities A and B. Regions 1 and 3 both
import from region 2 in addition to consuming all of their domestic
production. Price differentials for each commodity again reflect trans-
portation cost differentials.


7. DETAILED DESCRIPTION OF PROGRAM CONTROL CARDS


All control cards must start in column 1 and use only columns 1
through 6 to specify the instruction. Comments may appear in columns 7
through 80. There are three types of control cards: TYPE 0, TYPE 1,
and TYPE N.
A TYPE 0 control card does not have any data following it.
A TYPE 1 control card has a single data card following it.
A TYPE N control card has one or more input data cards that follow.









Table 4.--Transportation cost matrices


Destination region
Commodity, Source region Destination
1 2 3

Product A
Source region
1 0 1.0 2.0

2 1.0 0 3.0

3 2.0 3.0 0





0

Product B
Source region
1 0 3.0 1.0

2 3.0 0 2,0

3 1.0 2.0 0




31




RDA1 RDA2 RDA3 RSA1 RSA2 RSA3 RDB1 RDB2 RDB3 RSB1 RSB2 RSB3
1. RDA1
2. RDA2
3. RDA3
4. RSA1
5. RSA2
6. RSA3
7. RDB1
8. RDB2
9. RDB3
10. RSB1
11. RSB2
12. RSB3
13. XDA1 1
14. XDA2 1
15. XDA3 1
16. XSA1 -1
17. XSA2 -1
18. XSA3 -1
19. XDB1
20. XDB2
21. XDB3
22. XSB1
-1
23. XSB2
-1
24. XSB3
-I

25. XTA11 -1 1
26. XTA12 -1 1
27. XTA13 -1 1
28. XTA21 -1 1
29. XTA22 -1 1
30. XTA23 -1 1
31. XTA31 -1 1
32. XTA32 -1 1
33. XTA33 -1 1
34. XTB11 -1 1
35. XTB12 -1 1
36. XTB13 -1 1
37. XTB21 -1 1
38. XTB22 -1 1
39. XTB23 -1 1
40. XTB31 -1 1
41. XTB32 -1 1
42. XTB33 -1 1


Figure 4.--Tableau--sample problem number 2.









XDA1 XDA2 XDA3 XA1 XSA2 XSA3 XDB1 XDB2 XDB3 XSB1
1. RDAl -1
2. RDA2 -1
3. RDA3 -1
4. RSA1
5. RSA2 1
6. RSA3
7. D)B1 -1
8. RDB2
9. RDB3
-1

10. RSB1
1

11. RSB2
12. RSB3
13. XDA1 .1 .005
14. XDA2 .2 .02
15. XDA3 .125 .006
16. XSA1 -.004
-,004
17. XSA2 .05
18. XSA3 .1
19. XDB1 .01 .1
20. XDB2 .04 .2
21. XDB3 .012
22. XSB1 -.003 .07
23. XSB2 .001
24. XSB3 -.008
25. XTA11
26. XTA12
27. XTA13
28. XTA21
29. XTA22
30. XTA23
31. XTA31
32. XTA32
33. XTA33
34. XTBI1
35. XTB12
36. XTB13
37. XTB21
38. XTB22
39. XTB23
40. XTB31
41. XTB32
42. XTB33


Figure 4.--Tableau--sample problem number 2--continued.









XSB2 XSB3 XTAl1 XTA12 XTA13 XTA21 XTA22 XTA23 XTA31


-1 -1 -1


-1 -1 -1


1. RDA1
2. RDA2
3. RSA3
4. RSA1
5. RSA2
6. RSA3
7. RDB1
8. RDB2
9. RDB3
10. RSBI
11. RSB2
12. RSB3
13. XDA1
14. XDA2
15. XDA3
16. XSA1
17. XSA2
18. XSA3
19. XDB1
20. XDB2
21. XDB3
22. XSB1
23. XSB2
24. XSB3
25. XTA11
26. XTA12
27, XTA13
28. XTA21
29. XTA22
30. XTA23
31. XTA31
32. XTA32
33. XTA33
34. XTB11
35. XTB12
36. XTB13
37. XTB21
38. XTB22
39. XTB23
40. XTB31
41. XTB32
42. XTB33


-.007


Figure 4.--Tableau--sample problem number 2--continued.


-,002










XTA32 XTA33 XTB11 XTB71 XTB13 XTB21 XTB22 XTB23


1


1. RDA1
2. RDA2
3. RDA3
4. RSAI
5.. RSA2
6. RSA3
7. RDBi
8. RDB2
9. RDB3
10. RSB1
11. RSB2
12. RSB3
13. XDA1
14. XDA2
15. XDA3
16. XSA1
17. XSA2
18. XSA3
19. XDB1
20. XDB2
21. XDB3
22. XSB1
23. XSB2
24. XSB3
25. XTA11
26. XTA12
27. XTA13
28. XTA21
29. XTA22
30. XTA23
31. XTA31
32. XTA32
33. XTA33
34. XTB1
35. XTB12
36. XTB13
37. XTB21
38. XTB22
39. XTB23
40. XTB31
41. XTB32
42. XTB33


-1 -1


Figure 4.--Tableau--sample problem number 2--continued.


-1 -1 -1










XTB32


1. RDA1
2. RDA2
3. RDA3
4. RSA1
5. RSA2
6. RSA3
7. RDB1
8. RDB2
9. RDB3
10. RSB1
11. RSB2
12. RSB3
13. XDA1
14. XDA2
15. XDA3
16. XSA1
17. XSA2
18. XSA3
19. XDB1
20. XDB2
21. XDB3
22. XSB1
23. XSB2
24. XSB3
25. XTA1l
26. XTA12
27. XTA13
28. XTA21
29. XTA22
30. XTA23
31. XTA31
32. XTA32
33. XTA33
34. XTB11
35. XTB12
36. XTB13
37. XTB21
38. XTB22
39. XTB23
40. XTB31
41. XTB32
42. XTB33


Figure 4.--Tableau--sample problem number 2--continued.


XTB31


XTB33


RHS
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 20
> 25
> 22
S- 5
> -2.4

> -4.5
*> 30
> 35
* 27
> 4
> -2.3
> -3.8
> 0
> 1
- 2
- 1
0
S- 3
S- 2
S- 3
> 0
> 0

S- 3
> 1
S- 3
> 0
S- 2
>-- 1
- 2
> 0







Card Column

1 7

BEGIN
ROWS
$OBJ
-RDA1
-RDA2

-B8A1
-RSA2
-ESA3
-RDB1
-RDB2
-RDB3
-RSB1
-RSB2
-RSB3
END
MATRIX
XDA1 RDA1 -1.
XDA1 XDA1 .1
XDA1 XDB1 .01
XDAI OBJ -20.
XDA2 RDA2 -1.
XDA2 XDA2 2 .2
XDA2 XDB2 .04
XDA2 OBJ -25.
XDA3 RDA3 -1.
XDA3 XDA3 .125
XDA3 XDB3 .012
XDA3 OBJ -22.
XSA1 RSA1 1.
XSA1 XSA1 .1
XSA1 XSB1 -.003
XSAI OBJ 5.
XSA2 RSA2 1.
XSA2 XSA2 .05
XSA2 XSB2 -.001
XSA2 OBJ 2.4
XSA3 RSA3 1.
XSA3 XSA3 .1
XSA3 XSB3 -.008
XSA3 OBJ 4.5
XDB1 RDBI -1.
XDBl XDAI .005
XDB1 XDB1 .1
XDB1 OBJ -30.
XDB2 RDB2 :-1.
XDB2 XDA2 .02
XDB2 )DB2 .2
XDB2 OBJ -35.
XDB3 RDB3 -1.
XDB3 XDA3 ,006
XDB3 XDB3 .1
XDB3 OBJ -27.
XSBI RSB1 1.
XSBI XSA1 -.004
XSB1 XS1B .07
XSB1 OBJ 4.
XSB2 RSB2 1.
XSB2 XSA2 -.002
XSB2 XSB2 .04
XSB2 OBJ 2.3
XSB3 RSB3 1.


Figure 5.--Input deck listing: Sample problem number 2.










XSB3 XSA3 -.007
XSB3 XSB3 .07
XSB3 OBJ 3.8
XTA11 RDAL 1.
XTA11 RSA1 -1.
XTA12 RDA2 1.
XTA12 RSAl -1.
XTA12 OBJ 1.
XTA13 RDA3 1.
XTA13 RSA1 -1.
XTA13 OBJ 2.
XTA21 RDAl 1.
XTA21 RSA2 -1.
XTA21 OBJ 1.
XTA22 RDA2 1.
XTA22 RSA2 -1.
XTA23 RDA3 1.
XTA23 RSA2 -1.
XTA23 OBJ 3.
XTA31 RDAl 1.
XTA31 RSA3 -1.
XTA31 OBJ 2.
XTA32 RDA2 1.
XTA32 RSA3 -1.
XTA32 OBJ 3.
XTA33 RDA3 1.
XTA33 RSA3 -1.
XTB11 RDB1 1.
XTB11 RSB1 -1.
XTB12 RDB2 1.
XTB12 RSB1 -1.
XTB12 OEJ 3.
XTB13 RDB3 1.
XTB13 RSB1 -1.
XTB13 OBJ 1.
XTB21 RDB1 1.
XTB21 RSB2 -1.
XTB21 OBJ 3.
XTB22 RDB2 1.
XTB22 RSB2 -1.
XTB23 RDB3 1.
XTB23 RSB2 -1.
XTB23 OBJ 2.
XTB31 RDB1 1.
XTB31 RSB3 -1.
XTB31 OBJ 1.
XTB32 RDB2 1.
XTB32 RSB3 -1.
XTB3.2 OBJ 2.
XTB33 RDB3 1.
XTB33 RSB3 -1.
END
RHS
END
SOLVE
EXIT


Sample problem number 2--continued.


Figure 5.--Input deck listing:














Program Messages


BEGIN
ROWS
MATRIX


PROBLEM HAS 45 ROWS, 30 COLUMNS, AND
RHS
Si L'.'U


96 MATRIX ENTRIES.


REINVERTING AFTER ITERATION 0,
*I-NVERSION COMPLETED 12 SLACKS,


*FZ..:LE AT ITERATION 0,


?- : .l'(I;jG AFTER ITERATION 0,
*IHVERSION COMPLETED 42 SLACKS,


O TRANSFOPRATIONS WITH 0 ENTRIES,
0 P':? COLS, 0 IP.;;70F!ATI:;;. WITH


O STEPS


O TRANSFOPMATIONS WITH 0 ENTRIES,
0 POOR COLS, 0 IPA;:L'iF:T:T:l WITH


MAXIMUM ERROR IS ON ROW


= 0.0


SUM OF ABSOLUTE ERRORS ON ROWS = 0.0





Short Output


( 3) MATRIX R.H.S.
IX


ITER PIVS
38 38


OBJECTIVE TOTAL
-7939.739078


0 .;0:FAS DETERMINANT
0.0 2.3L95 -9


L*
1.000000 *


N7W COLUMO OLD COLUMN PIVOT ROW
XTA23 XTA23 ..DUAL XTA23


LINEAR (PX)
-15879.478157


+ QUADRATIC (X'QX)
+ 7939.739078


Figure 6.--Printed output, sample problem number 2.


TYPE 0
0 ET:TIF:E


TYPE 0
0 !iNTIE;








Row Output
IME VALUE ROW RHS -XTA23
15879.478157 OBJ 0.0 -0.073665
XDAI 98.734101 RDA1 0,0 0.222128
XDA2 72.183876 BDA2 0.0 0.112652
XDA3 78.603495 RDA3 0.0 -0.444201
XTAil 47.927374 RSAI 0.0 -0.221866
XTA22 72.183876 RSA2 0.0 0.112652
XTA33 76.289788 RSA3 0.0 0.555799
XDB1 165.327254 RDB1 0.0 -0.017839
XDB2 113.163557 RDB2 0.0 -0.020344
XDB3 145.768245 BDB3 0.0 0.057678
XTB11 123.195939 RSB1 0.0 -0.015757
XTB22 113.163557 RS32 0.0 -0.020344
XTB33 118.432170 RSB3 0.0 0.057271
RDA! ..DUAL 9.299954 XDA1 -20.000000 -0.022124
RDBI ..DUAL 12.479934 XDB1 -30.000000 -0.000437
RDA2 ..DUAL 8.299954 XDA2 -25.000000 -0.022124
RDB2 ..DUAL 9.479934 XDB2 -35.000000 -0.000437
RDA3 ..DUAL 11.29995' XDA3 -22.000000 0.055179
RjB3 ..DUAL 11.479934 XDB3 -27.000000 -0.000437
XSA1 47.927374 XSA1 5.000000 -0.221866
XSB1 123.195939 XSB1 4.000000 -0.015757
XSA2 125.30L310 XSA2 2.400000 -0.443353
7SB2 182.630947 XS22 2.300000 -0.022019
XSA3 76.289788 XSA3 4.500000 0.555799
XSB3 118.432170 XSB3 3.800000 0.057271
XTA12 ..DUAL 2.000000 XTA11 0.0 0.0
RSAl ..DUAL 9.299954 XTA12 1.000000 -0.022124
XTA13 ..DUAL 0.0 XTA13 2.000000 -0.077303
XTA21 50.806727 XTA21 1.000000 0.443995
RSA2 ..DUAL 8.299954 XTA22 0.0 -0.022124
XTA23 2.313707 XTA23 3.000000 -0.077303
XTA31 ..DUAL 4.000000 XTA31 2.000000 0.077303
XTA32 ..DUAL 6.000000 XTA32 3.000000 0.077303
RSA3 ..DUAL 11.299954 XTA33 0.0 0.055179
RSB1 ..DUAL 12.479934 XTB11 0.0 -0.000437
XTB12 ..DUAL 6.000000 XTB12 3.000000 0.0
XTB13 ..DUIAL 2.000000 XTB13 1.000000 -0.000000
XTB21 42.131315 XTB21 3.000000 -0.002082
RSB2 ..DUAL 9.479934 XTB22 0.0 -0.000437
XTB23 27.336075 XTB23- 2.000000 0.000407
XTB31 ..DUAL 0.0 XTB31 1.000000 -0.000000
F.R3 ..DUAL 11.479934 XTB32 2.000000 -0.000437
XTB32 ..DUAL 4.000000 XTB33 0.0 0.0


Figure 6.--Printed output, sample problem number 2-continued.











Primal-Dual Variable Solution Output


RLEAL VARIABLES S,."TI.':
NAKE VALUE


XDA1
XDA2
XDA3
XSA1
XSA2
XSA3
XDB1
XDB2
XDB3
XSB1
XSB2
XSB3
IXTA11
XTA21
XTA22
XTA23

XTB11
XTB21
XTB22
XTB23
XTB33


98.734101
72.183876
78.603495
47.927374
125. :,2313
76.289788
165.2272
113.163557
145.-1225
123.195939
182.630947
113.L7,1T0
47.927374
50.806727
72.183876
2.313707
76.2 9788
123.195939
42.131315
113.163557
27.336075
118.432170


DUAL VAPI'ULE SOLUTION
NMM'F VALUE


XTA12
XTA13
XTA31
XTA32
XTB12
XTB13

XTB32
RDA1


RSA1
RSA2
RSA3
RDB1
RDB2
RDB3
RSBI
RSB2
RSB3


2.000000
0.0
4.000000
6.000000
6.ooooo0
2.000000
0.0
4.000000
9.2? "?5
8.299954
11.299954
9.299954
8.29295'
11.299954
12. 479
9.479934
11.479934
12.479934
9.h79)93
11.479934


Row Errors Output


MAXIMUM E~OR IS ON ROW XDA2 = 4.53D 00
SUM OF ABSOLUTE ERRORS ON ROWS = 1.28D 01

EXIT


Figure 6.--Printed output, sample problem number 2--continued.







We have so far looked at seven different control cards, BEGIN, END,
SOLVE, and EXIT are all TYPE 0 control cards. ROWS, MATRIX, and RHS are
all TYPE N control cards. We will discuss examples of TYPE 1 control
cards below.
The "END" statement is used to terminate the data following a TYPE N
control card. In fact, any card with a punch in columns one through six
will end such a TYPE N control, however, the END statement makes the
program clear. For the above reason, it is imperative that data cards do
not have any punching in columns 1 to 6 or an error will occur.
The following is a listing of each control card and its function.


7.1 TYPE 0 Control Cards


7.1.1 BEGIN--This is always the first card for any problem. (More than
one problem may be solved in a single run). BEGIN causes the
storage areas for the problem to be zeroed out and sets the tol-
erance and frequency parameters to their default values. It is
somewhat analogous to "INITIALZ" in MPSX.


7.1.2 END--This statement should be used to terminate the data that
follows a TYPE N control card.


7.1.3 EOF--This statement instructs LCRAND to read the next card from
FORTRAN input unit 5. This unit number is the default for the
program and thus if it was placed in a card input stream, it
would typically cause no change. It is used in conjunction with
the control card "TAPE". "TAPE" causes the program to read from
FORTRAN unit 11 which could be a disk or tape file. Thus the
problem data (ROWS, MATRIX, RHS) could be stored on a secondary
storage device and read in from there. In this case, EOF would
be placed at the end of this data set defined as FORTRAN unit 11
to instruct the program to return to reading control statements
from the card input stream (see section 8).






7.1.4 ERRORS--This statement causes the program to compute the row
errors where "row error" is defined as the amount by which the
current solution fails to satisfy the equations exactly. Three
pieces of information are printed out: 1) the sum of the absolute
values of the errors, 2) the largest absolute error, and 3) the
row in which this occurs.


7.1.5 EXIT--This results in a page eject and then termination of the
program.


7.1.6 GO--This control card calls the solution algorithm, but assumes
that a basis already exists. Normally, this is used only after
INVERT.


7.1.7 INVERT--This statement causes the inverse of the current basis to
be created. This is typically only called after a preliminary
basis is read in.


7.1.8 OUTPUT--This causes a "short output" to be printed and a BASIS*
to be punched. (See PPRODE below).


7.1.9 PARAME--Solves the "long form problem" for all values of X. This
is particularly useful in portfolio selection and risk programming
problems. (See section 7.2.2 and [4).3


7.1.10 PUNCH--Punches out the current basis according to BASIS* format.
Restart information is also provided if the current solution is
feasible.


7.1.11 SETINV--This control sets the inversion frequency to (M/10) + 6,
where M is the number of rows in the full problem. This should
appear only after the matrix data has been read in.



The objective function for the portfolio selection and risk pro-
gramming problems is set up as minimize XPx + X'QX where Q is a symmetric
(n x n) positive definite or semi-definite variance-covariance matrix.







7.1.12 SOLVE--This is the normal control statement for solving a problem.
A starting basis is formed, the inverse created, and then the
solution algorithm is initiated.


7.1.13 TAPE--This statement instructs the program to read input from
FORTRAN unit 11. It will then continue to do so until an EOF
control card is encountered in the data set. (See EOF description
above).


7.1.14 (blank card)--If a totally blank card appears where a control card
is expected, the program will print an error message and skip to
the next BEGIN card.


7.1.15 comment card--If something appears in columns 1 through 6 that is
not an acceptable control statement, and a control statement was
expected, the card is treated as a comment card. If this card
precedes "MATRIX" or "RHS", anything that appears in columns 1
through 6 will be used to identify the problem in the output.


7.2 TYPE 1 Control Cards


7.2.1 PRMODE--This statement ("Print mode") and the data card which
follows it determine the kind of output produced at different
stages in the program. The stages at which output may optionally
appear are as follows: 1. after every pivot step
2. when feasibility is declared
3. when optimality is declared
4. when no feasible solution exists
5. when infinite solution exists
6. when OUTPUT control read, or frequency
given by OUTPUT following FREQUE
control card
7. when inverse is too big for core
8. when iteration limit is exceeded
9. after every step in parametric run
10. when limit for L is reached







There are four different types of output produced by LCRAND: short output,
row output, primal-dual output and BASIS*. The first three are types of
printed output and BASIS* is a basis for the problem punched on cards.
The PRIODE data card specifies what combination of the set of output choice
should be printed out for each of the ten possible stages listed above.
The data card for PRMODE contains a numeric code in each of the first ten
columns which describe the output desired for each of the ten conditions.
This numeric code and its interpretation is as follows:
0. no output
1. short output
2. short and row output
3. short and primal-dual output
4. short, row, and primal-dual outputs
5. card output for BASIS*
6. short output and BASIS*
7. short and row output and BASIS*
8. short and primal-dual output and BASIS*
9. short, row, and primal-dual output and BASIS*
Therefore, if the statements
PRMODE
0099944444
appear in the input stream, output will be performers as follows:
--no output after every pivot step or when feasibility is declared
--short, row, primal-dual and basis when optimality is declared, no
feasible solution exists, or when an infinite solution exists
--short, row, and primal-dual for the other five conditions (stages).
The default settings by the program if the user does not include a
PRMODE card are
0099969939
There are two other special purpose type 1 control cards which
are used for parametric programming on the linear part of the objective
function in a QP model. This capability was built into the original
IRADQP and not discarded when the RANDQP was revised to create the LCRAND,
This particular type of parametric programming facility is useful in
RISK programming, but does not really apply in the market-oriented type
of economic modeling which is the focus of the examples in this manual.







However, in the interest of completeness, a description of these control
cards will be included, (see Takayama and Batterham [4]).


7.5.2 L(o)--This statement causes the value of X (the parametric scalar)
to be initialized to the value appearing on the data card following
it. The format of the data card is blank in columns 1-18 with
the value appearing in columns 19 to 30. Again, a decimal point
is assumed between columns 24 and 25. The default value is 1.0.
(See Appendix C).


7.2.3 LIMIT--This statement set the upper limit for A. The default
20
value for LIMIT is 10.


7.3 TYPE N Control Cards


7.3.1 ALTERA--This control card is used to change data in the matrix.
Each data card specifies a coefficient value in the same format
as the matrix data. The control card cannot be used to add a new
entry to the matrix. Therefore, if an entry is likely to be
altered at some point, an initial value for it must be specified
in the matrix section (even is zero). Despite this restriction,
the ALTERA control is quite useful for many problems in market-
oriented LCP models. ALTERA will be ignored if it appears before
a MATRIX has been read in. ALTERA cannot be used to alter
coefficients to create a revised problem after the initial problem
has been solved. This limitation can be circumvented by creating
a copy of the model on disk or tape and re-entering the problem
for each ALTERA. See section 8 and the "EOF" and "TAPE" controls
for accomplishing this.


7.3.2 ALTERB--This statement changes or adds a new entry in the right
hand side (b-vector in our previous analysis). Each change, one
per card, is input according to the same format as the RHS data.







7.3.3 BASIS--This control pennits a basis to be read in with hand punched
cards that are represented by a series of names of primal struc-
tural vectors (column names) and primal artificial vectors (row
names). The program then extends this to create a basis for the
entire problem under the assumption that the associated solution
is feasible. The code will ignore any name that does not represent
a matrix column. INVERT and GO should be used after this for the
solution. The basis vector names are punched in the following
format allowing from 1 to 10 per card:
columns 1-6 should be blank
columns 7-12
13-18
19-24 Each of these fields can contain one
25-30 name or be a blank field

61-66
If the names on the card are all primal structural names (actual
column names of the A matrix), then columns 67-80 should be blank.
If the names are artificial vectors (A matrix row names) then the
six characters "ARTIF." must be punched in columns 67-72.


7.3.4 BASIS*'--This control permits a program punched basis to be read
in. A basis, all of its data, and the "END" card are punched by
the LCRAND program when a "PUNCH" control card is encountered or
when an output condition of five or greater is used (see section
7.2.1). All of the basis names are included with the expression
"DUAL.." in columns 67 to 72 of cards containing dual vectors.
A special data card with restart information is punched if the
current solution is feasible.


7.3.5 FREQUE--TIlis control is used to establish frequencies with which
certain actions are to be performed. The FREQUE card is followed
by any subset of the following three cards:
OUTPUT sets a frequency for performing special output (condition 6)
INVERT sets the inversion frequency
CUTOFF sets a maximum number of iterations to be allowed for
working on this problem.







The format for the data cards which follow FREQUE is as follows.
The keyword (OUTPUT, INVERT, or CUTOFF) goes in columns 7 to 12.
(Columns 1 to 6 must be blank). Columns 13 through 20 contain a
right justified integer value which gives the desired frequency.
The program initializes these frequencies to 10,000.


7.3.6 L\TRIX--This statement begins the problem matrix data section.
The format for the data is discussed in Section 3.


7.3.7 RHS--This control card zeroes out the RHS vector and reads in the
right hand side data cards following it. The format is described
in Section 3.


7.3.8 ROWS--This control card introduces the cards which name the rows
of the A matrix and give their types. The format for these is
also given in Section 3.


7.3.9 TOLERA--This statement is used to control the floating point
tolerances which are used in the solution algorithm. These
tolerances are set to default values when BEGIN is encountered,
however, the user may wish to set his own. The values involved
here affect the computational efficiency of the algorithm and
only merit special concern with large problems or problems in
which the coefficient values has a wide range, are very large or
are very small. Any subset of the six data cards listed below
may follow the TOLERA control card. Columns 1 through 6 of each
card must be blank, columns 7 through 12 contain the name of the
particular tolerance, and columns 13 through 20 contain the
tolerance value. The value has a FORTRAN format of E8.1.


Name Meaning Default value
7.3.10 PIVOT minimum element size considered l.OE-05
for a pivot


pivot rejection tolerance


7.3.11 REJECT


I.OE-03







7.3.12 COST reduced cost is considered negative -l.OE-05
if below this value


7.3.13 RESET x. is set to zero if less than l.OE-05
1
this value


7.3.14 ENTRY minimum element size in new 1.OE-07
transformation


7.3.15 TMULT minimum element size for applying 1.OE-10
transformation


8. MULTIPLE SOLUTION PROCEDURES


Most LCP models, particularly of the economic projection variety are
not created to be used just once and discarded. They are run many times
with different parameter assumptions and variable combinations. In fact,
many models are valuable, not because of the exact numbers they generate,
but because of the insight they give into the behavioral aspects of some
system. As a result, any software that is written for solving models of
this type, should have some facility for changing model coefficients in
a convenient manner. It should, in fact, be possible to do this many
times in a single computer "JOB" or "RUN".
Unfortunately, the RANDQP and LCRAND will not allow such coefficient
changes after a model has been read in and solved. It must be read in
again completely and then changed before a new model solution can be
generated. The RANDQP was designed so that the user could read the
problem from a disk or tape file, however, it could only be read from
there once.
In order to develop a coefficient change procedure that meets the
requirements outlined above, without performing major surgery on the
RANDQP code, the following method was developed. A minor modification
was made to the code which causes the unit 11 data set (disk or tape) to
be automatically rewound (re-initialized) after it is read. By placing
the user's problem on a scratch data set defined as FORTRAN unit 11, the
problem can be read in, modified, and solved as many times as the user







desires. The JCL and control cards for accomplishing this are shown in
Figure 7.
This strategy involves a two step job. The first step executes an
IBM utility program called IEBGENER which merely copies the problem data
onto a disk file. The second step is the LCRAND program which reads the
problem, makes any indicated changes, and solves it. It will continue to
do this as many times as the user indicates.
In Figure 7, line 1 indicates the program to execute. Lines 2
through 7 define the data sets necessary for IEBGENER. Line 2 is the
print data set; line 3 defines SYSIN as a Dummy Data Set which means we
are not using it; lines 4, 5, and 6 create the scratch disk data set
which is the output file for our copy operation; and line 7 defines our
input data set coming from cards. Lines 8 through 13 and the indicated
data are exactly the same as lines 7 through 12 in the sample program at
the beginning of Section 3. They define the problem in its initial or
standard form. Line 14 is the "EOF" or ("end of file") statement which
indicates the end of the problem file, and directs the LCRAND program to
return to sending from the card input stream for the LCRAND program,
(The data set defined by line 20 and consisting of lines 21 through 29).
This latter data set can be thought of as a control program in this
context.
After the copy operation is performed, the LCRAND is executed as
indicated in line 15. Lines 16, 17, 18 and 20 are as defined in Section 3.
Line 19 defines the data set created in step 1 (by TEBGENER) so that
LCRAND knows where to find the problem. Line 21 is the standard BEGIN
statement which initializes program parameters. The "TAPE" statement in
line 22 causes the LCRAND to read the problem from our scratch data set
(FORTRAN unit 11). Then the problem is solved (unchanged), as indicated
in line 23. Lines 24 and 25 begin the same sequence, only this time the
problem is changed by ALTERA before SOLVE in line 28. This sequence of
statements consisting of lines 24 through 28 is then repeated for each
change that is desired. Note that these coefficient changes are not
cumulative. With each new "BEGIN"-"TAPE" sequence, the data returns to
the initial problem structure. Finally, the program terminates when it
reaches the exit statement in line 29.
The control ALTERB could be used in place of, or in addition to, the




50






Card Column

1

1 // EXEC PGM=IEBGENER
2 //SYSPRINT DD SYSOUT=A
3 //SYSIN DID DUMMY
4 //SYSUT2 DD D.II-=.T.'. Y ,liII]'=SYSDA,
5 // DI;.P=(,PASS), FAr TLE'T tH:,(3,1)),
6 // ri'= LCL-.80,FL.KIT 0--O,.LCI irFB)
7 //SYSUT1 DD *
8 Rows
[row data]
9 END
10 MATRIX
[matrix data]
11 END
12 RHS
[right hand side data]
13 END
14 EOF
15 // EXEC PGM=LCRAND
16 /'. t.rPLib DD DSN=A0011225.SEQ1.LCRAND,DISP=OLD
17 /,'ri', .F(,,ll DD SYSOUT=A
18 //FTOTF001 DD CEf.:lu;T=-b
19 //FT11FOO1 DD DSN=&&CARDS,DISP=(OC0,DFL.iF.)
?0 //f'O0i0 DD *
21 BEGIN
22 TAPE
23 SOLVE
24 BEGIN
25 TAPE
26 ALTERA
[coefficient changes]
27 END
28 SOLVE
BEGIN
TAPE
ALTERA
(coefficient changes]
END
ALTER
[coefficient changes]
END
SOLVE



BEGIN
TAPE
ALTERA
[coefficient changes]
END
29 ,'.-T
29 EXIT


Figure 7.--Multiple solution program deck.







ALTERA control card. Thus, right-hand side and matrix elements can both
be changed. It is important to remember that any matrix coefficient
including zero, must be entered explicitly in the original matrix section
to be modified by ALTERA.
A sample input deck for using this strategy is shown in Figure 8.
This is SAMPLE PROBLEM NUMBER 1 from Section 4 that is used. In this
example we assume that region 1 places a tariff on the commodity C
that is imported from region 2. We want to project what the impact will
be on trade, production, consumption, and prices if tariffs of different
amounts are applied. In particular, we are seeking solutions for tariffs
of .2, .4, and .6 in monetary units.
The solution results are shown in Figure 9. We will just consider
the Primal-Dual Solution Output since this gives us the information we
are really interested in. Several observations can be made. First of
all, an export tariff of the magnitude considered here did not change
the composition of the set of activities which come into the solution at
a positive level. It does, however, change the numerical values of all
of these variables, including both prices and quantities. This demonstrates
the high degree of interdependency in an international trade market such
as this. As one would expect, the amount imported by region 1 declines
with each increase in the tariff. Also, the domestic equilibrium price
increases in region 1 according to standard theory. A discriminating
tariff such as this, against region 2 has the effect of increasing the
level of imports from region 3. As a general conclusion, it would take
a much stiffer tariff to change the pattern of international trade
altogether, but the changes investigated by the model do have an impact
on the magnitudes of the market variables.
The above demonstrates the kind of analysis that can be done with
this coefficient change procedure. In addition to tariffs, such things
as import quotas, fixed exogenous supplies of resources, fixed demands,
and even whole demand or supply functions can be established and changed.
Thus, we have a fairly comprehensive tool for model analysis to restart
a problem from a basis created by the user or generated by a previous
run. Experience with the RANDQP-LCRAND program, suggests that restarting
from a previous basis may not be as much a time saver as it is with
traditional linear programming algorithms. The control program used in







starting from a pre-defined basis is shown in Figure 10. Note that SOLVE
should not be used after a BASIS is read in. The "INVERT"-"GO" sequence
must be used. The concurrent use of the BASIS feature and the TAPE
feature shown in Figure 7 can provide a useful programming strategy.
Figure 11 demonstrates that problems can also be batched in a single
LCRAND job. BEGIN must appear before starting each new problem.
In conclusion, the options available with the LCRAND-RANDQP programs
are not extensive, although they do provide the basics that are necessary.
It is possible to get solutions and create numerous scenarios in a
convenient and efficient manner. In fact, the computational efficiency
of LCRAND has been found to be exceptionally good. This coupled with a
basically simple input procedure make the LCRAND a valuable tool, despite
the limitations on flexibility.






Card Column

1

// E;;EC PGM=IEBGENER
//SY6PRINT DD SYSOUT=A
//SYSIN DD DUMMY
//SYSUT2 DD DSN=&&CARDS'UNIT=SYSDA,
// DISP=(,PASS),SPACE=(TRK, (3,1)),
// DCB=(LRECL=80,BLKSIZE=?)) 'RECFM=FB)
//SYSUTI DD *
BEGIN
ROWS
$OBJ
-RDC1
-RDC2
-RDC3
-RSC1
-RSC2
-RSC3
END
MATRIX
:~CI RDCl -1.
XDCL XDC1 .1
XDCL. OBJ -25.
IDC2 RDC2 -1.
XDC2 XDC2 .5
XDC2 OBJ -30.
XDC3i RDC3 -1.
XDC3 XDC3 .7
XDC3 OBJ -35.
XSCI RSC1 1.
XSC1 XSC1 .2
XSCl OBJ 4.
XSC2 RSC2 1.
XSC2 XSC2 .3
XSC2 OBJ 5.
XSC3 RSC3 1.
XSC3, XSC3 .4
Xsci3 OBJ 3.
XTC11 RDC1 1.
XTC11 RSCl -1.
XTC12 RDC2 1.
XTC12 RSC1 -1.
XTC12 OBJ 2.1
XTC13 RDC3 1.
XTC13 RSC1 -1.
XTC13 OBJ 2.5
XTC21 RDC1 .1.
XTC23 R3C2 -1.
XTC21 OBJ 2.1
XTC22 RDC2 1.


,Figure 8.--Multiple solution version sample problem number 1.







XTC22
XTC23
XTC23
::TC23
XTC31
XTC31
XTC31
:XTC32
XTC32
XTC32
XTC33
XTC33


RSC2
RDC3
RSC2
OBJ
RD'C I
RSC3



OBJ
RDC3
RSC3
Rsc3


-1.
1.
-1.
3.0
1.
-1.
2.5
1.
-1.
3.0
1.
-1.


END
RHS
END
EOF

// EXEC PGM=LCRAIID
//STEPLIB DD DSN=A0011225.SEQ1. LCRAND,DISPOLD
//FT6FO001 DD SYSOUT=A
//FTOTFO01 DD SYSOUT=B
//FT11F001 DD D['Il=&&CAJiDS,DISP=((OLD,DELETE)
//FT05FO01 DD *
BEGIN
PRMODE USE 0044444444 FOR PRINT CONTROL
0044444444
TAPE
SOLVE
BEGIN
TAPE
ALTFRA


XTC21 OBJ
END
SOLVE
BEGIII
TAPE
ALTERA
XTC21 OBJ
END
SOLVE
BEGIN
TAPE
ALTERA
XTC21 OBJ
END
SOLVE
EXIT
/*


2.3





2.5





2.7


Figure 8.--Multiple solution version sample problem number 1--continued.








PRIMAL VARIABLES SOLUTION
NAME VALUE


XDC1
XDC2
XDC3
XSC1
XSC2
XSC3
x1ci1
XTC21
XTC22
XTC31
XTC33


DUAL VARIABLES SOLUTION
NAME VALUE


74.750736
29.150147
28.535819
67.624632
34.749755
30.062316
67.624632
5.599607
29.150147
1.526497
28.535819


XTC12
XTC13
XTC23
XTC32
RDC1
RDC2
RDC3
RSC1
RSC2
RSC3


4.200000
5.000000
3.400000
2.600000
17.524926
15.424926
15.024926
17.524926
15.424926
15.024926


PRIMAL VARIABLES SOLUTION
NAME VALUE


XDC1
XDC2
XDC3
XSC1
XSC2
XSC3
XTC11
XTC21
XTC22
XTC31
XTC33


DUAL VARIABLES SOLUTION
NAME VALUE


74.311089
29.462218
28.473013
67.844455
34.229637
30.172228
67.844455
4.767419
29.462218
1.699215
28.473013


XTC12
XTC13
XTC23
XTC32
RDC1
RDC2
RDC3
RSC1
RSC2
RSC3


4.400000
5.000000
3.200000
2.800000
17.568891
15.268891
15.068891
17.568891
15.268891
15.068891


PRIMAL VARIABLES SOLUTION
NAME VALUE


XDC1
XDC2
XDC3
XSC1
XSC2
XSC3
XTC11
XTC21
XTC22
XTC31
XTC33


DUAL VARIABLES SOLUTION
NAME VALUE


73.871443
29.774289
28.10206
68.0611279
33.709519
30.282139
68.064279
3.935231
29.774289
1.871933
28.410206


XTC12
XTC13
XTC23
XTC32
RDC1
RDC2
RDC3
RSC1
RSC2
RSC3


4.600000
5.000000
3.000000
3.000000
17.612856
15.112856
15.112856
17.612856
15.112856
15.112856


PRIMAL VARIABLES SOLUTION
NAME VALUE


XDC1
XDC2
XDC3
XSC1
XSC2
XSC3
XTC11
XTC21
XTC22
XTC31
XTC33


73.431796
30.086359
28.347399
68.284102
33.189401
30.392051
68.284102
3.103042
30.086359
2.044652
28.3 .739


DUAL VARIABLES SOLUTION
NAME VALUE


XTC12
XTC13
XTC23
XTC32
RDC1
RDC2
RDC3
RSC1
RSC2
RSC3


4.8oooo00000
5.000000
2.800000
3.200000
17.656820
14.956820
15.156820
17.656820
14.956820
15.156820


Figure 9.--Solution results multiple run problems.







Card Column


EC-E i l
PRI IODE
oo44444444


(use 0044444444 for print control)


ROWS

[row data]

END
ITATR IX


[matrix data]

EI1D
RHS

[right hand side data]

ElID
ALTERB

END
BASIS*

[basis* data]

END
INVERT
GO
EXIT


Figure 10.--Basis* input deck.







Card Coltimn
1

BEGIN
ROWS


END
MATRIX
Problem
END
RHS


END
SOLVE
BEGIN
ROWS


END
Problem MATRIX
2

END
RHS


END
SOLVE
BEGIN
ROWS


END
Problem MATRIX
3

END
RHS


END
SOLVE
EXIT


Figure ll.--Example input program for batched problems.













APPENDIX A


MPSRAND DOCUMENTATION


This program will convert an MPS III QUAD problem deck into a
data deck for the LCRAND package. The MPSRAND program expects as input
the standard QMATGEN input structure in the following form.
NAME PROBLEM
Table Z:Q..........


(DATA) {A matrix coefficients


Table Z:A

A matrix coefficient
(DATA) {OBJ vector coefficient
RHS vector coefficient

ENDATA
Each DATA card must be of the form: Rowname = Rowtype, Column name,
Column type, Coefficient value, All punctuation must be included as
indicated. The format is free except for the restriction that everything
(on data cards) must be within columns 18-71.
The output is a data deck acceptable to LCRAND. It has the follow-
ing form:
ROWS

{Rowdata}

END
MATRIX

{matrix coefficient data)

END
RHS

{right-hand side coefficient values}


END







The format for each data card type is the standard one discussed in
the RANDQP manuals [4,2]. MPSRAND will not, however, produce an input
deck suitable for the RANDQP even if the Q matrix is symmetric. NPSRAND
assumes that all Q-matrix coefficients are specified explicitly in the
input problem. The output file has all the coefficients in the matrix
section arranged by column. Since the standard QP problem in the
Takayama modeling approach is a maximization problem, and the original
RANDQP assumes minimization problem the Q-matrix and linear OBJ coeffi-
cients are reversed in sign by the MPSRAND program. In the more general
LCP problem, this manipulation is justifiable in terms of the economic
equilibrium conditions for the model. The source listing for MPSRAND is
presented in Figure 12.
































4LCRAND and RANDQP restrict the number of characters in row and
column names to 6. The QMATGEN allows 7 characters. Therefore, only
QMATGEN type decks that have names with < 6 characters can be success-
fully converted by the MPSRAND program.




60


PL/I OPTIMIZING COMPILER t4T- l Aii:rhiOCL Lirli OPTIONS(MAIN);

SO.UR.CE LISTING

STMT LEV NT

1 0 MPSRAND: PROCEDURE OPTiTOP',('*, 1iJ);
2 1 0 r.LiJ:(i.,:.(500);, '. .:- i );
3 1 0 DECLARE(COLUMNS(1500),RHS(500); i/UJ.ACTELi(30)VARiF'IIG;
4 1 o0 D I'-L.(L" L 'i ii A.'T '. J '/V t. i i ';
5 1 0 E-'CLAFLE(1. I],. h iF E';
6 1 0 DECLAi 0(. ,h;il .C,:.r,.J i: h i- .. :. );
7 1 0 DrECTrld (,, 'I,-",. .,;O' ;l" i i ,...' l I .fti ,VARiINJG;
8 1 0 DECLARE(POSITION,END POSITION;' '.:riD
9 1 0 DECIAL '.(C, )'I'- P'.'.' I ,. \' T- 7
10 1 0 DECLArE';F. i ) .CHARACTER(5)VARYING;
11 1 0 DECLARE (SYSPNCH) OUTPUT;

12 1 0 DROPBLANKS: PROCEDURE;
13 2 0 DO WHILE (SUBSTR(7'.AlI,lil 1)[In,) = '');
14 L2 1 POSITION = POSITION + 1;
15 2 1 END;
16 2 0 iL. POSITION = -..:.
17 2 0 END;

18 1 0 PULLFIELD:PROCEDURE(TEST I'Fr.): ii LIur i'C1ijARACTER(6)VARYING);
19 2 0 DECIArE( TEST_ ClIAR)CHARACTER( 1)
20 2 0 D CL,\ii.( .';,LIl'.'i ..'i.i...'; (6)VARYING;
21 2 0 DO WHILE (SUBSTR(CAMD,END POSITION,1) = TEST CHAR);
22 2 1 END POSITION = END POSITION + 1;
23 2 1 END;
24 2 0 VALUE = I-.: li'('c.-. POSITION,END POSITION POSITION);
25 2 0 END POSITION = CND POSITION + 1;
26 2 0 POSITION = END POSITION;
27 2 0 RETURN(VALUE);
28 2 0 END;

29 1 0 SETQFLAG:PROCEDURE;
30 2 0 POSITION 16;
31 2 0 CALL I',"-L!.,..- ,
32 2 0 IF (,lI.l 'i,(CAi-. ,,-. 1- 'Tli ,1)= 'Q') THEN
QFLAG = 'TRUE';
33 2 0 ELSE IF :.;.!. '[I (.-'r r.,,POSITION+2,1) = 'A') THEN
QFLAG = 'FALSE';
34 2 O ELSE PUT LIST ('ERROR ON TABLE CARD');
35 2 0 END;

36 1 0 REVERSE COEF SIGN:PROCEDURE;
37' 2 0 IF'SUBSTR(COEF',1 ..I = '-' THEN
COEF = 'I i.ii- Fc')lI ,2);
38 2 0 ELSE IF SUBSTR(COEF,1,1) = '+' THEN
COEF = '-'IISUBSTR(COEF,2);
39 2 0 ELSE COEF '-' JISUBSTH(COEF,1);
4l0 2 0 END;

41 0 DECIMAL POINT':PROCEDURE;
42 2 0 DECLA- F (LEN)FIXED;
43 2 0 DECLARE (DECIMAL TEST) CHARACTER (5) VA!iYIIIG;
44 2 0 DECLAE (I,J) .i-r-:L.;
45 2 0 DECIMAL TEST = 'FALSE';
46 2 0 LEN = LE5GTH(COEF);
47 2 0 DO I = I to LEN;
48 2 1 IF SUBSTR(COEF,I,1) = '.' THEN
ir:Cu.l;-I.._ TEST = 'TRUE';
49 2 1 IIm,
50 2 0 IF DECIMAL TEST = 'FALSE' THEN
DO;
51 2 1 J 1;
52 2 1 DO WHILE (SUBSTR(COEF,J,1) '= ');


Figure 12.--Source listing for tPSRAND documentation.




61



PL/I OPTIMIZING COMPILER MPERAND:PROCEDURE OPTIONS(MAIN);

STMT LEV NT

53 2 2 J = J + 1;
54 2 2 END;
55 2 1 COEF = SUBSTR(COEF,1,J-1) II '.';
56 2 1 END;
57 2 0 END;

58 1 0 ROWFUNC:PROCEDURE(ROITYPE)RETU.NS( CAACTER(1));
59 2 0 DECLARE(ROWTYPE)CHARACTER(*)VARYING;
60 2 0 DECLARE(TYPE)CHARACTER(1);
61 2 0 IF ROWTYPE 'OBJ' THEN
TYPE = '$';
62 2 0 ELSE IF (ROWTYPE = 'G') I (ROWTYPE = ') THEN
TYPE = '-';
63 2 0 ELSE IF BOWTYPE = 'L' THEN
TYPE= '&';
64 2 0 ELSE IF ROWTYPE = 'E' THEN
TYPE = '0';
65 2 0 RETURN(TYPE);
66 2 0 END;


67 1 0 PROCESS COEFFICIENT:PROCEDURE;
68 2 0 DECLARE(1)FIXED;
69 2 0 POSITION = 1;
70 2 0 ENDPOSITION = 1;
71 2 0 CALL DROPBLANKS;
72 2 0 ROWNAME = PULLFIELD('=');
73 2 0 CALL DROPBLANKS;
74 2 0 ROWTYPE = PULLFIELD(',');
75 2 0 CALL DROPBIANKS;
76 2 0 COLNAAlE = PULLFIELD(',');
77 2 0 CALL DROPBLAHKS;
78 2 0 COLTYPE = PULLFIELD(',');
79 2 0 CALL DOPBLAN'KS;
80 2 O COEF = SUBSTR(CARD,POSITION,10);
81 2 0 CALL DECIMAL POINT;
82 2 0 IF ROWTYPE = 'RHS' THEN
DO;
83 2 1 NR = NR + 1;
84 2 1 RHS(NR) = ROWNAM.EI iCOEF;
85 2 1 END;
86 2 0 ELSE DO;
87 2 1 IF ROWTYPE = 'OBJ' THEN
CALL REVERSECOEF SIGN;
88 2 1 NC = NC + 1;
89 2 1 COLUMNS(NC) = COLNAMEj ROWNAMEI COEF;
90 2 0 END;

91 2 0 IF (R"iT'E'= 'RIIS') & FLAGG = 'FALSE') THEN
DO;
92 2 1 I = 1;
93 2 1 DO WHILE ((I< M) & (ROWNAME SUB3''R(ROWS(I),2)));
94 2 2 1 = + 1;
95 2 2 END;
96 2 1 IF ROWNAME -= SUBSTR(ROWS(I),2) THEN
DO;
97 2 2 M = M + 1;
98 2 2 ROWS(M) = ROWFUNC(ROWTYPE)I IROWNA~E;
99 2 2 END;
100 2 1 END;
101 2 0 END;


Figure 12.--Source listing for MPSRAND documentation--continued.








PL/I Oirinit'I. COMPI'

STMr LEV NT

102 1 0
103 2 0
10o 2 0
105 2 0
I'' 2 0
107 2 1
108 2 1
109 2 1
110 2 0
11 2 0
112 2 0

113 1 0
114 2 0
115 2 0
116 2 0
117 2 0
118 2 0
119 2 1
120 2 1
121 2 1
122 2 2


2 3

2 4
2 41
2 4
2 4
2 4
2 3
2 3
2 2
2 1
2 1
2 1

1 0
2 0
2 0
2 0
2 0
2 1
2 1
2 1
2 0
2 0
2 0


fiOl.d.'J.: PhC CET.i r OPTIONS(MAIN);


WRITE ROWS SECTION:PROCEDURE;
DELCLrA.; j ) 'IXED;
PUT SKIP LIST (' ':.l');
PUT FILE (-'i,';il'CH SKIP EDIT ('ROWS') (A);
DO I=1 TO I,
PUT SKIP LPIT ()i-u.(I)) (X(ii),A(7));
PUT FILE (SYSPNCII) SKIP EDIT (ROWS(I)) (X(11),A(7));

PUT F.I:ji LIST ('END');
PUT FILE (SYSPNCH)' SKIP EDIT ('END') (A);
END;

SORTCOLUMNS:PROCEDURE;
DFC Jli, 1 I, i.(K f ) ) .'IXF D;
DECLl.Ji. r (11 1 J 1, i )Ciil".!,,ct "30)VARYING;
DECLARE(TEMPI)CIIARACTER( 30)VARYING;
Kl 1;
DO WHILE (Kl < NC);
CURRENT = SUBSTR(COLUMNS(K1),1,6);
START = K1 + 1;
DO K2 = START TO NC;
IF (SUBSTR(.'li-'l(K.?),1,6) = CURRENT) THEN
jr0;
IF (K2 > START) THEN
DO;
Kl = KI + 1;
TEMP = '.:'Li!IJ.-( :2);
COLUMNS(K2) = COLUMNS(K1);
C.,L.l'IJni '-v) = TEMP;
END;
ELSE K1 K1 + 1;
END;
END;
K1 = K1 + 1;
END;
END;


WRITE j:,'jL; LI i : CTIO N:PROCEDURE;
i['i U. ii IXED;
PUT SKIP LIST ('MATRIX');
PUT FILE (SYSPNCH) SKIP 1l IT ('MATRIX') (A);
DO I=1 TO NC;
PUT SKIP EDIT (COLUMNS(I)) (X(6),A(24));
PUT FILE (SYSPNCll) SKIP EDIT (COLUMNS(I))
END;
PUT SKIP LIST ('END');
PUT FILE (SYSPNCH) SKIP EDIT ('END') (A);
END;


(X(6),A(24))


WRITE RHS SECTION:PROCEDURE;
DrECLA 1i I)ILr,
PUT SKIP LIST ('RHS');
PUT FILE (SYSPNCH) SKIP ITF, ('EHS') (A);
DO I = 1 TO NR;
PUT SKIP EDIT (RIIS(I)) ((llI,A(18));
PUT FILE (SYSPNCH) SKIP EDIT (RHS(I)) (X(12),A(i8));
END;
PUT SKIP LIST ('END');
PUT FILE (SYSPNCH) SKIP EDIT ('END') (A);
END;


Figure 12.--Source listing for MPSRAND documentation--continued.


ILER




63



PL/I OPTIMIZING COMPILER MPBRAND:PROCEDURE OPTIONS(MAIN);

STMT LEV NT

157 1 0 M=0; /* NUMBER OF ROWS
158 1 0 NC=0; /* NUMBER OF COLUMN ENTRIES
159 1 0 NR=O; /* NUMBER OF RHS ENTRIES
160 1 0 GET SKIP EDIT (CARD) (A(80));
161 1 o DO WHILE (CARDI-.- 'ENDATA');
162 1 1 IF (SUBSTR(CARD,1,4) -= 'NAME')THEN
IF (SUBSTR(CARD,10,5) = 'TABLE' ) THEN
CALL SETQFLAG;
163 1 1 ELSE CALL PROCESS COEFFICIENT;
164 1 1 GET SKIP EDIT (CARD) (A(80));
165 1 1 END;
166 1 0 CALL WRITEROWS SECTION;
167 1 0 CALL SORT COLUMNS;
168 1 0 CALL WRITE COLUMNSSECTION;
169 1 0 CALL WRITERHS_SECTION;
170 1 0 END;


Figure 12.--Source listing for iPSRAND documentation--continued.












APPENDIX B


JCL U'SCD TO CREATE LCRAND AT THE UNIVERSITY OF FLORIDA


// EXEC .AS[I.HC,LOAD=LOI D 1
//ASM. SYSLIN DD DSIIN=&&/SI ,DDISP=( ,PASS) ,UiIT=SYSDA, 2
// DCB=(RECFM=FB, LECL=80,BLKoSI ZE=3200,DSORG=PS),
// SPACE=(6391,(76,38),,Fr,,OUIJD)
//AS-.SYSIN D 3
[Place Assembly language portion here]
// EXEC FORTHCLE 4
//FORT.SYSIN DD DSi.=DOO11271.3.EQ.1.LCRAiD,DISF=OLD 5
//LKED.SYSLIN DD DSi.H=&&Lli ,DISP=(OLD,DELETE) 6
// DD DSIN=&6AS3M,DISP=(OLD,DELETE) .
// DD DDiIAIIE=SYSIIJ 8
// DD 9
ENTRY TRICK
NAME LCRAND
//LKED.SYSLMOD DD DSN=D001i271.SEQl. LOAD(LCRANJD), 10
// DISP=GLD
/*


JCL card 1 calls up a level H assembler, which does the assembly
but does not execute it. The output from this assembly is put on the
data set specified by card 2. You may have an assembly procedure which
has this in it. Card 3 is the card which introduces the card deck
containing the assembly program. Card 4 is a call to FORTRAN compile,
link edit, and execute procedure. Card 5 is the data set for the
FORTRAN code for the LCRAND. This will be different in your case if
you are reading from tape. Adjust it accordingly. Card 6 is the
temporary storage place for the output of the compile step. Card 7
is the assembly part passed from the first step. Card 8 is just in
case additional input to the linkage editor is desired from a SYSIN file.







Card 9 introduces the ENTRY and NAME cards to the linkage editor to
indicate the main entry point and the name of the program. Card 10
specifies the entry output data set for the link edit step which is
the complete program. This is the data set where you store the LCRAND
permanently. It is a partitioned data set which is used as a program
library. You can use an existing one or create a new one.
After the LCRAND is created, execute it in the following manner.


Card Column
1
// EXEC LCRAND
//STEPLIB DD DSN=D00ll271.SEQ.LOAD,
// DISP=OLD
//FTO6F001 DD SYSOUT=A
//FT07F001 DD SYSOUT=B
//GTO5FO01 DD *
BEGIN
ROWS
[Row data]
EIJD
MLATRIX
[Matrix data]
EliD
RHS
RHS data]
END
SOLVE
EXIT
/*








If the LCRAND or RANDQP is stored as an object deck, it is then
accessed using a FORTRAN load procedure such as:



// EXEC FORTGG
//GO.OBJECT DD DSN=FRE.RA'iDQP
//GO.SYS.IN DD *
BEGIN


Program and data

EXIT
/*






The above two procedures represent the standard means of accessing
the LCRAND and RANDQP at the University of Florida as of May 20, 1977.












APPENDIX C


USE OF RANDQP


Since the basic algorithm and control cards in LCRAND have not been
altered from the original RANDQP, this manual can be used in working with
the original RANDQP code. There are several things that must be kept in
mind, however, that are different between the two programs. Aside from
the fact that the multiple run procedure described in Section6 will not
work with the RANDQP, the differences lie primarily in the conventions
for inputting the problem matrix data.
The RANDQP assumes a quadratic function of the form c'x + x'Qx
whereas the more natural one c'x 1/2x'Qx was described above. The user
should follow the sign rules as described in Section 4, however, the
following additional rules must be followed.
a) If an asymmetric Q matrix is inserted into the RANDQP, it will
use 1/2(Q + Q ).
b) All diagonal coefficients arising from demand & supply functions
(i.e. where an integration is involved) must be premultiplied by
1/2.
c) Only one triangle (upper or lower) of the Q matrix needs to be
specified explicitly. The code will generate the corresponding
symmetric part. If this option is taken (only one triangle
specified) then the off-diagonal elements should not be multiplied
by 1/2 if coming from a demand or supply function (in contrast
to diagonal elements as in b). If the entire Q matrix is entered
and it consists of demand and supply function coefficients, then
the entire matrix should be premultiplied by 1/2 before insertion.
The reasoning behind the above is as follows. Because the RANDQP
assumes the c'x + x'Qx objective function, it does the following to
ensure the Kuhn-Tucker conditions are generated in a consistent manner.








a) If only one triangle is entered, it divides the off-diagonal
elements by two and creates the Q matrix from these "halved"
coefficients.
b) The entire Q matrix is always doubled before actually storing
it, whether or not it is "generated" as above or is specified
completely by the user.
c) The final Q matrix is then multiplied by -1 before it is used.
The above does make sense if the reader cares to work the mathematics,
although this is unnecessary as long as the rules are followed. If
the Q matrix arises from cost data, the coefficients should be entered
exactly as they are, (except with positive signs) and only one triangle
of Q should be entered.













APPENDIX D


LCRAND-RANDQP SOLUTION ALGORITHM


The solution algorithm used by LCRAND (and RANDQP) uses a modified
version of the Wolfe method [6]. The tableau structure that is used
internally is depicted below. Note that the program converts everything
1 1
into "less than or equal to" constraints. The x, w w P and P
columns are kept nonnegative throughout. W2 may have negative activities
during the solution process, but must finally become all non-negative
when an "equilibrium" solution is reached. The p vectors may be non-neg-
ative at anytime because they are the dual variables associated with equality
rows in the primal problem. The following conditions are maintained
at all times:
2
xw = 0
1
w P = 0
+ +

w P =0

The algorithm proceeds as described in steps 1 through 4 below.
1. Find a feasible solution for the primal subproblem
A2x < b
1
Ax > b

A3x = b3

2. Extend the basis to include appropriate dual variables in a manner
which ensures a complementary solution. (See Figure 13).
2
a. For every non-basic x, insert the w (slack) variable associated
with it.
1 1
b. For every nonbasic w+ w insert the appropriate p+, p
variable.
c. Insert all of the unrestricted variables in the basis.










1 1 2
w w w p p p* x RHS
W+ +



I A b1



-1 -A2 -b2



A3 b3

T T T
I -A -A -A -Q 0
1 2 3


Figure 13.--Internal matrix structure.



3. Using all of the data, create the inverse and solution for the new
basis. Note, at this point we do not require w2 > 0 as in the
original Wolfe algorithm.
4. Find the optimal solution to the quadratic problem. Maintain all
1
x, w w variables non-negative.
a. Find 2 = minimum w2 for w2 < 0. If all w > 0, solution is
s
optimal.
2
b. Introduce column xs (complement of ws) into the solution. Record
2, 1 1
the name of w2. Choose pivot among rows that contain x, w w
variables and w Pivot according to smallest xi ratio > 0 or
s aij
largest aij for all xi = O; all other w2 variables and p* may be
negative.
c. If column w2 is dropped from the basis, go back to step 4a and
s
repeat.
2 2
d. Introduce a column w2 into the solution. If w is dropped from
r s
the basis, go to step 4a and repeat. If a primal variable xr is
dropped, introduce its complement w2 into the basis.
rl













APPENDIX E


EXPANDING PROBLEM DIMENSIONS


LCRAND and RANDQP have an upper limit on the size of problem matrix
they can handle. There are FORTRAN arrays defined in the XBLANK COMMON
block which establish this and several other dimension specifications
for the program. The standard versions of LCRAND and RANDQP have this
limit set to 500 rows.
The figure of 500 rows refers to the dimension of the M matrix in
an LCP problem. This is actually the sum of the number of rows and
columns in the A matrix.
There also is a limit of approximately 6000 non-zero elements that
can be stored for the matrix tableau. This figure, however, refers to
the number of non-zero elements in Q and A. The -AT section is not
included in this figure.
It is also necessary to be aware of the fact that the inverse of the
matrix must be stored. This can be a problem when the inverse becomes
too large for the amount of storage available. If an error message
occurs to this effect, it may be necessary to expand the region requested
or job size specification on the JOB card. This will generally be
sufficient to handle the problem.
If the user desires to expand the maximum dimensions of LCRAND or
RANDQP it is necessary to change lines 2 and 3 of the XBLANK COMMON in
the main program and the BEGIN subroutine. Also, the DATA statement
specifying MINDM1, MINDM2, and MINDM3 should be changed.
A formula for setting the dimensions is described below.








Set the following arr.ais as indicated:

A (number of rows in A) x numberr of non-zero elements per row
expected) + (number of elements in Q) + 25
IA same as A
KL (number of rows in M) x 2 + 104
KN (number of rows in M) x 2 + 102
KN2 same as KN
NR (number of rows in M) + 12
NR2 same as NR
B (number of rows in H) + 11
KLT same as 1i,
KNR same as KL


Set the following values using the ;ap..prl:;in': ".T' statement in the
main program:

NINDM1 dimension of A
MINDH2 2 x (number of rows in M)
MINDM3 number of rows in M













REFERENCES


1. Cottle, R.W. and G.B. Dantzig. "Complementary Pivot Theory of
Mathematical Programming." pp. 115-138 in Mathematics of the
Decision Science, Part 1 (G.B. Dantzig and A.F. Veinott, Jr.,
eds.) American Mathematics Society. Providence, R.I. 1968.

2. Cutler, L. and D.S. Pass. A Computer Program for Quadratic
Mathematical Models to be Used for Aircraft Design and Other
Applications Involving Linear Constraints. R-516-PR Rand,
Santa Monica, Ca., June 1971.

3. Lemke, C.E. "BiMatrix Equilibrium Points and Mathematical
Programming," Management Science. 11: 681-689. 1965.

4. Takayama, T. and R.L. Batterham. Portfolio Selection and Resource
Allocation for Financial and Agricultural Firms with the Rand
QP360 Quadratic Programming Code. AERR 117. Dept. Ag. Econ.
University of Illinois, Mar 1972.

5. Takayama, T. and G.G. Judge. Spatial and Temporal Price Allocation
Models. North-Holland Publishing Company. Amsterdam. 1971.

6. Wolfe, P. "The Simplex Method of Quadratic Programming,"
Econometrica. 27: 382-398. 1959.