gmpl 2008, GLPK

[ Pobierz całość w formacie PDF ]
ModelingLanguageGNUMathProg
Language Reference
Draft Edition, for GLPK Version 4.34
December 2008
AndrewMakhorin
Moscow Aviation Institute, Moscow, Russia
 The GLPK package is part of the GNU Project released under the aegis of GNU.
Copyright c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Andrew Makhorin,
Department for Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All rights
reserved.
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
Permission is granted to make and distribute verbatim copies of this manual provided the
copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modied versions of this manual under the
conditions for verbatim copying, provided also that the entire resulting derived work is
distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another lan-
guage, under the above conditions for modied versions.
i
TableofContents
1Introduction
...............................
1
1.1 Linear programming problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1.2 Model objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
1.3 Structure of model description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
2Codingmodeldescription
..................
4
2.1 Symbolic names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
2.2 Numeric literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
2.3 String literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
2.4 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
2.5 Delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
2.6 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
3Expressions
...............................
7
3.1 Numeric expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
3.2 Symbolic expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
3.3 Indexing expressions and dummy indices . . . . . . . . . . . . . . . . . . . . .
12
3.4 Set expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
3.5 Logical expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
3.6 Linear expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
4Statements
...............................
23
4.1 Set statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
4.2 Parameter statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
4.3 Variable statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
4.4 Constraint statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
4.5 Objective statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
4.6 Solve statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
4.7 Check statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
4.8 Display statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
4.9 Printf statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
4.10 For statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
5Modeldata
...............................
33
5.1 Coding data section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.2 Set data block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
5.3 Parameter data block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
AppendixADateandtimefunctions
........
41
A.1 Obtaining current calendar time . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
A.2 Converting character string to calendar time . . . . . . . . . . . . . . . . .
41
A.3 Converting calendar time to character string . . . . . . . . . . . . . . . . .
42
ii
AppendixBSolvingmodelswith
glpsol.....
45
AppendixCExamplemodeldescription
.....
46
Chapter 1: Introduction
1
1Introduction
GNU MathProg is a modeling language intended for describing linear mathematical pro-
gramming models.
1
Model descriptions written in the GNU MathProg language consist of a set of statements
and data blocks constructed by the user from the language elements described in this
document.
In a process called translation, a program called the model translator analyzes the model
description and translates it into internal data structures, which may be then used either
for generating mathematical programming problem instance or directly by a program called
the solver to obtain numeric solution of the problem.
1.1Linearprogrammingproblem
In MathProg it is assumed that the linear programming (LP) problem has the following
statement:
minimize (or maximize)
z = c
1
x
1
+ c
2
x
2
+ ::: + c
n
x
n
+ c
0
(1)
subject to linear constraints
L
1
a
11
x
1
+ a
12
x
2
+ ::: + a
1n
x
n
U
1
L
2
a
21
x
1
+ a
22
x
2
+ ::: + a
2n
x
n
U
2
: : : : : : : : : : : : : :
L
m
a
m1
x
1
+ a
m2
x
2
+ ::: + a
mn
x
n
U
m
(2)
and bounds of variables
l
1
x
1
u
1
l
2
x
2
u
2
: : : :
l
n
x
n
u
n
(3)
where:
x
1
, x
2
, . . . , x
n
are variables;
z is the objective function;
c
1
, c
2
, . . . , c
n
are coecients of the objective function;
c
0
is the constant term (\shift") of the objective function;
a
11
, a
12
, . . . , a
mn
are constraint coecients;
L
1
, L
2
, . . . , L
m
are lower constraint bounds;
U
1
, U
2
, . . . , U
m
are upper constraint bounds;
l
1
, l
2
, . . . , l
n
are lower bounds of variables;
u
1
, u
2
, . . . , u
n
are upper bounds of variables.
1
TheGNUMathProglanguageisasubsetoftheAMPLlanguage.ItsGLPKimplementationismainly
basedonthepaper:RobertFourer,DavidM.Gay,andBrianW.Kernighan,\AModelingLanguage
forMathematicalProgramming."ManagementScience36(1990)pp.519-54.
[ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • radiodx.htw.pl
  •