Algebraic Modeling Languages
Algebraic Modeling Languages
A Quick Preview on Algebraic Generation Languages.
Algebraic, or constraint oriented, languages describe the MP matrix as a set of
equations, a form favored by the academic and engineering communities. The description of the
matrix is algebraic in that a statement is an equation or inequality comprised of summations of
products between model activities and coefficient bearing data tables. A single statement will
describe a collection of similar constraints and activities. The structure of the language
parallels the mathematical summation notation used to formulate the model.
DICTIONARY
CLASS V Set of vegetable oils
VEG1,VEG2
CLASS O Set of non-vegetable oils
OIL1,OIL2,OIL3
CLASS P Set of final product
Y
DATA
TABLE A Maximum production quantities
VEG OIL
MAXM 200 250
*
TABLE B Cost per ton of vegetable oils
VEG1 VEG2
COSTV 100 120
*
TABLE C Cost per ton of non-vegetable oils
OIL1 OIL2 OIL3
COSTN 130 110 115
*
TABLE D Hardness of vegetable oils
VEG1 VEG2
HARDV 8.8 6.1
*
TABLE E Hardness of non-vegetable oils
OIL1 OIL2 OIL3
HARDN 2.0 4.2 5.0
*
TABLE F Selling price per ton of final product
PRICE
Y 150
*
COPY
NAME BLEND
FORM ROW ID
PROF = OBJ
VVEG(V) = MAX
NVEG(O) = MAX
UHAR(V,O) = MAX
LHAR(V,O) = MIN
CONT(V,O) = FIX
COPY
COLUMNS
FORM VECTOR X(V)
PROF = TABLE B((V), COSTV)
VVEG(V) = 1
UHAR(V) = TABLE D((V), HARDV)
LHAR(V) = TABLE D((V), HARDV)
CONT(V) = 1.0
FORM VECTOR X(O)
PROF = TABLE C((O), COSTN)
NVEG(O) = 1
UHAR(O) = TABLE E((O), HARDN)
LHAR(O) = TABLE E((O), HARDN)
CONT(O) = 1.0
FORM VECTOR X(P)
PROF = TABLE F(PRICE, (P))
UHAR(P) = -6.0
LHAR(P) = -3.0
CONT(P) = -1.0
COPY
RHS
FORM VECTOR RHSIDE
VVEG(V) = TABLE A(VEG, MAXM)
NVEG(O) = TABLE A(OIL, MAXM)
COPY
ENDATA
END
Figure 2.3 The Oil-Blending Problem in MAGEN
Algebraic Generation Languages
- are not restricted by conforming to MPS format
- describe the mathematical programming matrix as a set of equations or inequalities
- use index expressions such as "i OVER raw" and "t from 1 to time" to describe the sets
over which collection of items are indexed
- use arithmetic expressions with powerful indexed-sum such as "SIGMA" notation that
corresponds to the algebraic use of S
Examples: ALPS
GAMS
LPMODEL
MAGIC
AMPL
GAMS is the best known, most widely used and most capable of the current algebraic
modeling systems. It was originally developed on a CDC mainframe, has been migrated to the
IBM mainframe, UNIX based workstations and can be run on an ordinary PC. GAMS uses two-
dimensional data tables as its principle input medium. GAMS has no data management capability.
Data tables and model description both appear in a fixed order in the GAMS symbolic input file.
GAMS automates the generation of matrix names while allowing the user to describe data with
names of up to 10 characters. GAMS is written in PASCAL and interfaces to multiple optimizers
via the MPS standard files. Thus the user is free to mix and match model managers, optimizers,
operating systems and hardware platforms. AMPL is a more recent modeling language with
design and objective similar to that of GAMS. In an AMPL representation, the data values are
specified in a separate section and are not combined with the problem specifications as in GAMS.
This separation of data in the AMPL model makes it more maintainable.
GAMS and AMPL will be described in more details in PART 2.
Prepared by Tay Kim Pin.