Академический Документы
Профессиональный Документы
Культура Документы
Written by
Janos D. Pinter
Pinter Consulting Services, Inc.
Contributions by
David M. Gay
AMPL Optimization, Inc.
Current document version: 2015-01-09
(C) COPYRIGHT NOTICE
AMPL - A Modeling Language for Mathematical Programming
(C) AMPL Optimization, Inc., www.ampl.com
LGO Solver Suite for Global and Local Nonlinear Optimization
(C) Pinter Consulting Services, Inc., www.pinterconsulting.com
All rights reserved.
Please contact Janos D. Pinter at janos.d.pinter@gmail.com if you wish
to cite or use the contents of this document in any form.
1) AMPL
AMPL is a language for mathematical programming that greatly facilitates
the formulation of optimization models and the generation of the requisite
computational data structures. AMPL enables optimization model development
in a natural, concise, and scalable fashion; it also supports the seamless
invocation of various solver engines to handle the resulting optimization
models.
AMPL integrates a modeling language for describing a model consisting of
variables, objectives, and constraints, all of which may involve sets and
parameters that can be supplied separately; facilities for supplying data
(values for sets and parameters in the model); a command language for
browsing models and analyzing results; and a scripting language for
gathering and manipulating data and for implementing iterative optimization
schemes. All listed language components use the same concepts and syntax
for streamlined application development, testing, deployment, and
maintenance.
AMPL has been extensively documented elsewhere. Therefore here we refer
only to the AMPL book by Fourer, Gay, and Kernighan (2003) - as the
primary source of information - and to the website of AMPL Optimization,
Inc., www.ampl.com.
From this website you can download a fully functional free AMPL trial
version, with model size limitations set by AMPL Optimization, as well
as all chapters of the AMPL book (in PDF file format).
Let us note that the AMPL trial version already supports the development
and exploration of non-trivial nonlinear optimization models.
The AMPL software product is supported by AMPL Optimization, Inc. To
branin1.mod
An illustrative global optimization model from the GOMODEL Library
Original AMPL code development (branin.mod) by Elena Bobrovnikova
Added modifications and explanatory notes by Janos D. Pinter
#
#
#
#
#
Key model
Number of
Number of
Number of
Objective
#
#
#
#
#
#
characteristics
variables: 2
(lower and upper) bound constraints: 4
general constraints: 1, see note below
function: nonconvex
param pi := 4*atan(1);
var x{1..2};
minimize ObjFct: (x[2] - 5.1*x[1]^2/(4*pi*pi) + 5*x[1]/pi - 6)^2
+ 10*(1 - 1/(8*pi))*cos(x[1]) + 10;
s.t. Box1: -5 <= x[1] <= 10;
s.t. Box2: 0 <= x[2] <= 15;
_var
3.14159
2.275
:=
_conname _con.slack
Box1
6.85841
Box2
2.275
UniqueSoln 0.583407
:=
Let us point out that in the above summary result LGO's default (most
thorough, and - as a rule, especially when solving difficult models most successful) global solver mode has been applied. This solver option
leads to global scope search before switching to local search. There
are also two other global search options which can precede local search.
These can serve as alternative optimization strategies, used as needed
in difficult models.
The local search option of LGO on its own handles uni-modal (e.g. convex,
or quasi-convex) and even mildly non-convex models. As a rule, local
search on its own requires significantly less search effort (in terms of
the number of model objective and constraint function evaluations used
by LGO).
Note furthermore that LGO uses direct model function evaluations, also
to approximate gradients (this is done only in its local search mode).
We plan to use also other methods available in AMPL to calculate gradients.
However, the currently used approach supports also the invocation and use
of arbitrary - including non-smooth, and even external black box - model
functions.
Let us also remark that the 'Maximum constraint violation 0' message
appears only when the model includes some general constraint(s) such as
UniqueSoln above. The value 0 or a sufficiently small value indicates
that the solution found is numerically feasible. There is no need to
display such a message in (merely) box-constrained models, since the
variable range constraints are automatically satisfied by LGO's search
methods.
Users can also send results to a designated text output file such as
branin1lgo.out as shown below by the commands added to branin1.mod:
# Send results to
display ObjFct >>
display _varname,
display _conname,
output file
braninlgo.out;
_var >> braninlgo.out;
_con.slack >> braninlgo.out;
_var
-1.84653e-07
-1
:_conname _con.slack
;
:=
:=
Notice that here we receive an empty list of constraints, since the box
constraints were simply defined as variable bounds (see the model)
_var
0.089842
-0.712656
:=
_conname _con.slack
UniqueSoln 0.802498
:=
ampl: reset;
ampl: model griewank1.mod;
ampl: solve;
LGO 2014-12-04: Feasible solution from global search;
function evaluation limit reached
(affected by g_maxfct = 800).
Objective 0
1601 function evaluations.
Runtime = 0 seconds
Obj = 0
: _varname
1 'x[1]'
2 'x[2]'
;
_var
1.45216e-12
3.11743e-13
:_conname _con.slack
;
:=
:=
jdp1.mod
An illustrative global optimization model from the GOMODEL Library
AMPL code development by Janos D. Pinter
2015-01-08
#
#
#
#
#
Key model
Number of
Number of
Number of
Objective
characteristics
variables: 1
(lower and upper) bound constraints: 2
general constraints: 0
function: nonconvex
# Global solution:
# Optimum value:
f* = -2.85006480
# Optimal argument value: x* = 17.29903524
# Variables
var x{1..1}; # 1-variable model
# Objective function
minimize ObjFct: log(x[1])*sin(x[1]);
# Bound constraint[s]
s.t. Box1: 1 <= x[1] <= 20;
# General constraints
# s.t. ... Absent
# Solver settings
option solver lgo;
# Solve model;
solve;
ampl: model jdp1.mod;
LGO 2014-12-04: Feasible solution from global search;
function evaluation limit reached
(affected by g_maxfct = 450).
Objective -2.8500648
901 function evaluations.
Runtime = 0 seconds
ObjFct = -2.85006
If we use solver MINOS instead of LGO, then it returns the (suboptimal)
solution x=1, f(1)=0. The same happens when we invoke the solvers KNITRO
or SNOPT, while LOQO reports an evaluation error at the initial solution.
Needless to say, this 'negative performance' due to the stated local
search scope (mandate) of these solver options: hence, it is definitely
not cited here as a deficiency in itself. In fact, LGO's local solver
option would also fail to find the global optimum - unless started from
a 'sufficiently good' solution guess... However, this model example
indicates the advantages of using a global solver when such need arises.
The second example presented here is a 3-variable constrained nonlinear
optimization model with a non-smooth objective function: for more details,
see jdp3.mod in the GOMODELS directory.
The presence of general non-convex constraints often causes difficulties
for local solvers, even if the objective happens to be a linear or convex
function.
For brevity, only the core model formulation is cited below.
# jdp3.mod
# An illustrative global optimization model from the GOMODEL Library
# Variables and bounds
var x in [1,8];
var y in [2,5];
var z in [3,10];
# Objective function
minimize objective: abs(x^2 + y^2 - z^2);
# Constraints
s.t. eq1: x^2 + y^2 + z^2 + x - y - z - 44 == 0;
s.t. eq2: x*y*z + x*y - 3*x - y - 2*z - 49 == 0;
s.t. eq3: x*z + 2*x*y + x + z - 47 <= 0;
Using, e.g., the solver MINOS, we receive
# MINOS 5.51: infeasible problem (or bad starting guess).
objective = 6.33862
: _varname
_var
1 x
3.56759
2 y
5
3 z
5.60259
: _conname _con.slack
:=
1 eq1
-18.0817
2 eq2
-41.8687
3 eq3
-17.8338
;
Using LGO in its default global solver mode, the correct (global)
solution is obtained.
objective = 3.79785e-12
: _varname _var
1 x
3.0000000000
2 y
4.0000000000
3 z
5.0000000000
: _conname _con.slack
1 eq1
-6.6791e-13
2 eq2
-8.66862e-13
3 eq3
-7.10543e-15
;
:=
Again, this - still rather simple - example points towards the potential
need for global scope search in many applications of nonlinear optimization.
Further global optimization model examples are available in the GOMODELS
collection. Model suggestions (preferably in coded form) are welcome and all
adapted models will be properly acknowledged. (Models will be added on an
ongoing basis, at the discretion of Pinter Consulting Services.)
Let us mention again that numerous further examples - including real-world
case studies by LGO users - are discussed by Pinter (1996, 2002, 2006, 2009),
and in many other professional publications. The LGO manual (Pinter Consulting
Services, 2014) also cites a range of LGO applications.
6) LGO Option Settings
Users can control LGO operations by setting the AMPL environment variable
lgo_options appropriately. This can be done either by using AMPL's option
command, or by using the shell's set and export commands before you invoke
AMPL. The resulting settings will override the default solver options.
To see first all current options and their possible changes, invoke the
command lgo -= (as shown) in the AMPL command window or in the scrolling
window (sw) environment.
In the command window of the AMPL IDE, type
ampl: shell 'lgo -=';
Currently, this command returns the following output (slightly edited for
better readability and consistency):
con_tol
fi_tol
flog
irngs
kt_tol
logfile
objective number:
default setting: objno = 1
objrep
Whether to replace
minimize obj: v;
with
minimize obj: f(x)
when variable v appears linearly
in exactly one constraint of the form
s.t. c: v >= f(x);
or
s.t. c: v == f(x);
Possible objrep values:
0 = no
1 = yes for v >= f(x)
2 = yes for v == f(x)
3 = yes in both cases (default)
opmode
outfile
outlev
output level:
0 ==> no output
1 ==> write sumfile (summary result file)
2 ==> also outfile (more detailed result file)
3 ==> also logfile (all model function arguments
and resulting function values)
default setting: outlev = 0
penmult
search
search kind:
0 = only local scope optimization done
1 = global branch-and-bound + local optimization
2 = global adaptive random + local optimization
3 = multi-start + local optimization
default setting: search = 3
sumfile
timelim
timing
ubound
wantsol
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
1e-8
1e-8
<BLANK>
50*(m+n+2)^2
-1e10
0
1e-8
50*(m+n+2)^2
-1e10
-1e4
"LGO.LOG"
50*(m+n+2)^2
1
3
3 (LGO internal name for option search)
"LGO.OUT"
0
1
3 (identical with opmode)
"LGO.SUM"
300
1
1e4
8
_var
3.14159
2.275
:=
_conname _con.slack
Box1
6.85841
:=
2
3
;
Box2
UniqueSoln
2.275
0.583407
Notice that the solution received is, in fact, globally optimal. This
may well be the case in many 'mildly non-convex' nonlinear models
(especially since LGO's local search mode is optionally supplemented by
a quick global presolver mode).
In general it is always advisable to use a global scope search option unless either we know that the optimization model is uni-modal (e.g.,
it has a provably convex structure), and/or we have a sufficiently high
quality initial solution estimate which can be directly used to find the
global optimum.
In difficult models, it may also be advisable to conduct runs with various
solver choices (if available). To illustrate this point, consider the
model cited below in a concise form, without added comments (cf. jdp4.mod
in the GOMODELS directory):
# jdp4.mod;
var x in [-5,5];
var y in [-5,5];
minimize obj: sin(x^2 - y^2);
s.t. c1: y^2 + cos(x-y) >= 0.5;
s.t. c2: x*(y + sin(y)) == 2;
Again, LGO finds the global solution in local search mode, see below.
(The global optimality of this solution can be directly verified by
inspection; there could be also other global solutions.)
ampl: model jdp4.mod;
LGO: opmode = 0
LGO 2014-12-04: Feasible solution from local search.
Objective -1
172 function and constraint evaluations.
Maximum constraint violation 1.36e-12
Runtime = 0 seconds
objective = -1
: _varname
1 x
2 y
;
_var
-0.804509
-1.48931
: _conname _con.slack
1 c1
2.49258
2 c2
-1.35691e-12
;
:=
:=
: _varname
1 x
2 y
;
_var
1.89948
0.539345
: _conname _con.slack
1 c1
0
2 c2
-2.22045e-16
;
:=
:=
Message
0
100
120
110
200
300
400
410
420
510
520
practically means that the reported solution has been found by a seamless
combination of global and local scope searches conducted by LGO, using
the given option settings. Therefore the result returned by LGO is expected
to be a global search based high-quality feasible solution that meets at
least the local optimality conditions. Under normal circumstances - except
in difficult models - the solution referred to above is actually the global
optimum. This statement is generally valid, assuming suitably chosen solver
option settings, without some unexpected failure caused by the model itself,
or some numerical issue.
This has been practically verified by solving many thousands of test problems
and real-world challenges by LGO. Note however that there is no theoretical
or even numerical guarantee that LGO - or any other NLO solver - will handle
'all possible' nonlinear models successfully, when using a limited set of
options with 'default' or 'arbitrary' user-defined settings. (Recall the
solver limitations demonstrated on very small-size, yet already non-trivial
models, as discussed earlier in this document.)
2. Analogously to remark 1, the message "Feasible solution from local search"
means that the solution has been found by LGO's local scope search - again,
with given option settings. With suitable settings (and keeping in mind
similar caveats to those given in remark 1), the result returned by LGO is
expected to be at least a local search based feasible solution. In many
optimization problems - but definitely not always - even the global solution
can be found by using LGO's local search option initiated from a reasonable
starting point.
3. The message "Unbounded objective" indicates some model related error,
since under the stated analytical assumptions regarding model (1)-(2)
this situation should never occur.
4. The message "Infeasible problem" also could indicate some model
related error, since under the stated analytical assumptions regarding
model (1)-(2) this situation should not occur. In practice, it could
happen however that an actual model does not meet the postulated
feasibility requirement indeed. To check whether this is the case
indeed, it may be advisable to allocate a significant search effort
and then to re-run the solver without considering the objective function,
in order to find just a feasible solution. Of course, the model itself
should also be verified; and it could also happen that the solver fails
to find a feasible solution in some unusually difficult problem - at least
within the resources allocated to the solver to handle the problem.
5. The "Interrupted by control-C (SIGINT)" feature is supported by all
AMPL solver platforms.
8) Technical Support
AMPL-LGO is supported regarding its basic functionality and integration
with AMPL by AMPL Optimization, contact: support@ampl.com.
The core LGO solver suite is supported by Pinter Consulting Services and
its developer partners.
Contact: Janos D. Pinter, PhD, DSc
Pinter Consulting Services, Inc.
Email: janos.d.pinter@gmail.com
Web: http://www.pinterconsulting.com/
9) Illustrative References
AMPL Optimization, Inc. (2014) The AMPL Modeling System. See www.ampl.com.
Fourer, R. Gay, D.M. and Kernighan, B.W. (2003) AMPL: A Modeling Language
for Mathematical Programming. (Second Edition) Brooks/Cole-Thomson
Learning, Pacific Grove, CA. See ampl.com/resources/the-ampl-book/ .
Pinter, J.D. (1996) Global Optimization in Action. Kluwer Academic
Publishers, Dordrecht. (Now distributed by Springer Science + Business
Media, New York)
Pinter, J.D. (2002) Global optimization: software, test problems, and
applications. In: Pardalos, P. M. and Romeijn, H. E., Eds. Handbook of
Global Optimization, Volume 2, pp. 515-569. Kluwer Academic Publishers,
Dordrecht, 2002. (Now distributed by Springer Science + Business Media,
New York)
Pinter, J.D., Ed. (2006) Global Optimization - Scientific and Engineering
Case Studies. Springer Science + Business Media, New York.
Pinter, J.D. (2009) Software development for global optimization. In:
Pardalos, P.M. and T. F. Coleman, eds. Global Optimization: Methods and
Applications, pp. 183-204. Fields Institute Communications Volume 55.
Published by the American Mathematical Society, Providence, RI, 2009.
Pinter Consulting Services, Inc. (2014) LGO - A Model Development and Solver
System for Global-Local Nonlinear Optimization. User's Guide. (Available
upon request by licensed AMPL-LGO users) www.pinterconsulting.com.