The NEOS Server is a free internet-based service for solving numerical optimization problems. It is able to take models specified in a variety of formats (including AMPL, GAMS and MPS) and pass them to a range of both free and commercial solvers (including Gurobi, CPLEX and Cbc). See here for the full list of solvers and input formats that NEOS supports.
NEOS is particularly useful if you need to trial a commercial solver to determine if it meets your needs.
As part of the NEOS Server terms of use, the commercial solvers CPLEX, MOSEK, and Xpress are to be used solely for academic, non-commercial research purposes.
You can install NEOS.jl by running
Pkg.add("NEOS")
This package contains an interface for the NEOS XML-RPC API.
The following example shows how you can interact with the API.
using NEOS
# Some solvers require the user to supply a valid email address
neos_server = NEOSServer(email="me@mydomain.com")
# Prints the NEOS Welcome message
println(welcome(neos_server))
# Get an XML template
xml_string = getSolverTemplate(neos_server, "milp", "Cbc", "AMPL")
#
# Modify template with problem data
#
# Submit the XML job to NEOS
job = submitJob(neos_server, xml_string)
# Get the status of the Job from NEOS
status = getJobStatus(neos_server, job.number, job.password)
results = getFinalResults(neos_server, job.number, job.password)
JuMP is a mathematical modelling language for Julia. It provides a solver independent way of writing optmisation models. To use NEOS via JuMP set the solver to NEOSSolver(solver=<solver>, format=<:MPS | :NL>)
where <solver>
is one of :CPLEX
, :MOSEK
, :SYMPHONY
, or :Xpress
, and format
is either :MPS
or :NL
. For example:
using JuMP, NEOS
m = Model(solver=NEOSSolver(solver=:CPLEX, format=:MPS))
# Model definition
solve(m)
The MathProgBase interface is a lowerlevel interface than JuMP that is also solver independent. To use NEOS in MathProgBase:
using MathProgBase, NEOS
mixintprog(..., NEOSSolver(solver=:CPLEX, format=:MPS))
We currently support a limited range of the available NEOS Solvers due to the need to write a separate parser and submission form for each.
Here is a summary of the solvers and the features they currently support
Solver | Format | Requires Email | Type | Special Ordered Sets |
---|---|---|---|---|
:CPLEX |
:MPS |
yes | MILP | yes |
:CPLEX |
:NL |
yes | MILP | no |
:MOSEK |
:MPS |
no | MILP | no |
:SYMPHONY |
:MPS |
no | MIP | no |
:Xpress |
:MPS |
yes | MIP | yes |
Note: both :CPLEX
and :Xpress
require the user to supply a valid email address. i.e:
s = NEOSSolver(solver=:CPLEX, email="me@domain.com")
# or
s = NEOSSolver(solver=:CPLEX)
addemail!(s, "me@domain.com")
You can initialise the solver using a number of common, and solver-specific keyword arguments. The common parameters are:
email
: valid email address. For example:email="me@mydomain.com"
gzipmodel
: settrue
to gzip to MPS model. This reduces bandwith but takes a little longer to create. This defaults totrue
. i.e.gzipmodel=false
print_results
: settrue
to print the NEOS results toSTDOUT
. This defaults tofalse
. i.e.print_results=true
result_file
: the full filename save NEOS results to. i.e.result_file = "~/neos_results.txt"
Some examples include
# An interface to the CPLEX solver on NEOS via the MPS format
NEOSSolver(solver=:CPLEX, email="me@mydomain.com")
# An interface to the CPLEX solver on NEOS via the NL format
NEOSSolver(solver=:CPLEX, format=:NL, email="me@mydomain.com")
# An interface to the MOSEK solver on NEOS
NEOSSolver(solver=:MOSEK)
# An interface to the COIN-OR SYMPHONY solver on NEOS
NEOSSolver(solver=:SYMPHONY)
# An interface to the XpressMP solver on NEOS
NEOSSolver(solver=:Xpress, gzipmodel=false, print_results=true)
NEOS currently limits jobs to an 8 hour timelimit, 3Gb of memory, and a 16mb submission file. If your model exceeds these limits, NEOS.jl may be unable to return useful information to the user.
You can set solver specific parameters using
addparameter!(solver, param::String, value)
or by using keyword arguments.
Solver specific examples include:
A list of parameters can be found here
# these are the commands that you would type into the interactive optimiser
# "set <param> <value>"
s = NEOSSolver(solver=:CPLEX)
addparameter!(s, "timelimit", 60)
# or
s = NEOSSolver(solver=:CPLEX, timelimit=60)
A list of parameters can be found here
s = NEOSSolver(solver=:MOSEK)
addparameter!(s, "MSK_DPAR_OPTIMIZER_MAX_TIME", 60)
# or
s = NEOSSolver(solver=:MOSEK, MSK_DPAR_OPTIMIZER_MAX_TIME=60)
A list of parameters can be found here
# these are often of the form
# "<param> <value>"
s = NEOSSolver(solver=:SYMPHONY)
addparameter!(s, "time_limit", 60)
# or
s = NEOSSolver(solver=:SYMPHONY, time_limit=60)
A list of parameters can be found here
# these are often of the form
# "<param>=<value>"
s = NEOSSolver(solver=:Xpress)
addparameter!(s, "MAXTIME", 60)
# or
s = NEOSSolver(solver=:Xpress, MAXTIME=60)