This Julia package is an interface between MathProgBase.jl and COIN-OR Optimization Services (OS), translating between the Julia-expression-tree MathProgBase format for nonlinear objective and constraint functions and the Optimization Services instance Language (OSiL) XML-based optimization problem interchange format.
.osil files and using the
driver, this package allows Julia optimization modeling languages such as
JuMP to access any solver supported by
OSSolverService. This includes the COIN-OR solvers Clp
(linear programming), Cbc (mixed-integer
linear programming), Ipopt (nonlinear
programming), Bonmin (evaluation-based
mixed-integer nonlinear programming), Couenne
(expression-tree-based mixed-integer nonlinear programming), and several others.
Note that Clp, Cbc,
and Ipopt already have Julia packages
that interface directly with their respective in-memory C API's. Particularly
for Clp.jl and Cbc.jl, the existing packages should be faster than the
CoinOptServices.jl approach of going through an OSiL file on disk.
Initial comparisons show that Ipopt.jl is also substantially faster than
CoinOptServices.jl. For nonlinear problems
automatic differentiation in C++ using CppAD,
which has different performance characteristics than the pure-Julia
used for nonlinear programming in JuMP. TODO: determine why CppAD is slower than expected
.osil files is implemented using the
LightXML.jl Julia bindings to
libxml2 to construct XML files from element trees.
.osil files will be done later, to provide a (de-)serialization
format for storage, archival, and interchange of optimization problems between
various modeling languages.
You can install the package by running:
On OS X, this will automatically download precompiled binaries via Homebrew.jl.
On Windows, this will automatically download precompiled binaries via WinRPM.jl. Currently these are packaged in @tkelman's personal project on the openSUSE build service, but these will be submitted to the official default repository eventually.
On Linux, this will compile the COIN OS library and its dependencies from
source if they are not found in
DL_LOAD_PATH. Note that OS is a large
C++ library with many dependencies, and it is not currently packaged for
any released Linux distributions. Submit a pull request to support using
the library from a system package manager if this changes. It is
recommended to set
ENV["MAKEFLAGS"] = "-j4" before installing the
package so compilation does not take as long.
The current BinDeps setup assumes Ipopt.jl and Cbc.jl have already been
successfully installed in order to reuse the binaries for those solvers.
You will need to have a Fortran compiler such as
in order to compile Ipopt. On Linux, use your system package manager to
gfortran. You will also need to have
This package builds the remaining COIN-OR libraries OS, CppAD, Bonmin, Couenne, and a few other solvers (DyLP, Vol, SYMPHONY, Bcp) that do not yet have Julia bindings.
CoinOptServices is usable as a solver in JuMP as follows.
julia> using JuMP, CoinOptServices julia> m = Model(solver = OsilSolver())
Then model and solve your optimization problem as usual. See
JuMP's documentation for more
OsilSolver() constructor takes several optional keyword
arguments. You can specify
OsilSolver(solver = "couenne") to request
a particular sub-solver,
OsilSolver(osil = "/path/to/file.osil") or
osrl keyword arguments to request non-default
paths for writing the OSiL instance file, OSoL options file, or OSrL
results file. The default location for writing these files is under
Pkg.dir("CoinOptServices", ".osil"). The
printLevel keyword argument
can be set to an integer from 0 to 5, and corresponds to the
command line flag for
OSSolverService. This only controls the print
level of the OS driver, not the solvers themselves.
Note that if you want to solve multiple problems simultaneously, you
need to set the
osrl keyword arguments to
independent file names for each problem. See
issue #1 for details.
All additional inputs to
OsilSolver are treated as solver-specific
options. These options should be input as Julia
Dict objects, with
keys corresponding to OSoL
A convenience function
OSOption(optname, optval, kwargs...) is provided
to automatically set
"type" based on the Julia type of
CoinOptServices should also work with any other MathProgBase-compliant linear or nonlinear optimization modeling tools, though this has not been tested. There are features in OSiL for representing conic optimization problems, but these are not currently exposed or connected to the MathProgBase conic interface.
3 months ago