dummy-link

AmplNLReader

Julia AMPL Models Conforming to NLPModels.jl

Readme

AmplNLReader.jl: A Julia interface to AMPL

Stable release Github release

  • Documentation: Documentation

Development version

  • Documentation: Documentation
  • Tests: Master Build Status Build status Master Coverage Status

How to Install

At the Julia prompt, clone this repository and build:

julia> Pkg.add("AmplNLReader")
julia> Pkg.build("AmplNLReader")

Testing

julia> Pkg.test("AmplNLReader")

Creating a Model

For an introduction to the AMPL modeling language, see

Suppose you have an AMPL model represented by the model and data files mymodel.mod and mymodel.dat. Decode this model as a so-called nl file using

ampl -ogmymodel mymodel.mod mymodel.dat

For example:

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.

Optimization Problems

AmplNLReader.jl currently focuses on continuous problems conforming to NLPModels.jl.

AmplModel objects support all methods associated to NLPModel objects. Please see the NLPModels.jl documentation for more information. The following table lists extra methods associated to an AmplModel. See Hooking your Solver to AMPL for background.

Method Notes
write_sol(nlp, msg, x, y) Write primal and dual solutions to file

Missing Methods

  • methods for LPs (sparse cost, sparse constraint matrix)
  • methods to check optimality conditions.

This content is released under the MIT License. MIT license

First Commit

04/13/2014

Last Touched

26 days ago

Commits

270 commits