AmplNLReader.jl documentation

This package provides an interface to optimization problems modeled in the AMPL modeling language.

Currently, only smooth problems are supported.

This package implements the NLPModels.jl API.

Interaction with AMPL models is realized by way of the AMPL Solver Library (ASL) as implemented by David Gay.

Most, but not all, AMPL models come in the form of a model file (problem.mod) and a data file (problem.dat). For this reason, AmplNLReader assumes that an nl file is available. An nl file is the result of decoding a model and, possibly, a data file to instantiate a concrete problem. One can be generated from the command line using

ampl -ogproblem problem.mod problem.dat

where problem should be replaced with your problem's name.

For an introduction to the AMPL modeling language and background on the ASL, see

Installing

The following command should automatically download and install AmplNLReader.jl and its dependencies (Use ] to enter pkg> mode):

pkg> add AmplNLReader
pkg> build AmplNLReader
pkg> test AmplNLReader

Usage

julia> using AmplNLReader

julia> hs33 = AmplModel("hs033.nl")
Minimization problem hs033.nl
nvar = 3, ncon = 2 (0 linear)

julia> print(hs33)
Minimization problem hs033.nl
nvar = 3, ncon = 2 (0 linear)
lvar = 1x3 Array{Float64,2}:
 0.0  0.0  0.0
uvar = 1x3 Array{Float64,2}:
 Inf  Inf  5.0
lcon = 1x2 Array{Float64,2}:
 -Inf  4.0
ucon = 1x2 Array{Float64,2}:
 0.0  Inf
x0 = 1x3 Array{Float64,2}:
 0.0  0.0  3.0
y0 = 1x2 Array{Float64,2}:
 -0.0  -0.0

There is support for holding multiple models in memory simultaneously. This should be transparent to the user.

Check the NLPModels API for details on the complete API.

Contents