SolverStudio & NEOS

SolverStudio allows models built using AMPL & GAMS to be solved in the cloud using the free NEOS server. These companies very generously make their full systems available on NEOS, and so you do not need to have AMPL or GAMS (not even the free student versions) installed on your own computer.

The NEOS Server is a fantastic collaborative project of the optimization community that allows users to easily experiment with different solvers for their problem. Unlike the free student version of AMPL & GAMS, AMPL on NEOS and GAMS on NEOS have no problem size limitations, other than limits on the size of the model and data files that are exchanged with NEOS. Note that all jobs submitted to NEOS are logged and available for downloading, and so using SolverStudio with NEOS results in your model and data becoming public. You should make yourself aware of the NEOS Terms of Service.

If you choose “AMPL on NEOS” or “GAMS on NEOS” as your modelling language in SolverStudio, then when you click Solve, SolverStudio will take your model and the associated data from your spreadsheet and send these off to the NEOS server at neos-server.org. The NEOS server will then run your files. SolverStudio waits for NEOS to report that the run has finished. SolverStudio then takes the model results and writes them back into your spreadsheet.

Your AMPL or GAMS model and data are created in SolverStudio in exactly the same way as if you were using SolverStudio with a local copy of AMPL/GAMS installed on your own machine. This includes you including commands to choose a solver (see next), solve the problem and then write result to the spreadsheet using (in AMPL) the  display <variable> > Sheet; commands.

SolverStudio automatically makes a small number of changes required for your model to work on NEOS. SolverStudio assumes you only have one command per line; putting multiple commands on the same line may cause problems. In particular, please ensure that the param, set and var commands (and the GAMS equivalents) are each on their their own line, and similarly that the following AMPL commands (if included) are also each on their own line:
option solver <solver>;
solve;
display <variable1>;
display <variable2>;

NEOS has a wide range of solvers available that work with AMPL and GAMS. The full list is available on NEOS. (SolverStudio supports all solvers available on NEOS as at 11 October 2012.) You use the standard AMPL option solver <solver> command (or SolverStudio’s AMPL menu) to choose your Solver, such as: option solver CBC; or option solver Minos;. For GAMS, the solver is selected using the SolverStudio GAMS menu.

Note that if you cancel your optimisation run using SolverStudio’s Cancel button, then SolverStudio oes the right thing and also tells NEOS to cancel the problem.

Technical Implementation Notes:

SolverStudio includes Python code that uses the NEOS XML-based API to send a model and data file to NEOS, and then get back the progress reports and final results.

You can view the XML file sent by SolverStudio to NEOS by choosing SolverStudio’s File menu, selecting View Working Files, and opening NEOSJob.xml with a text editor. The raw NEOS results are in the Sheet file. (Note that these files are automatically deleted when you quit Excel.)

NEOS runs AMPL with a single input file that is created on NEOS by merging model, data and run files. NEOS checks the run file, and if this run file does not have a solve; command, then NEOS adds one in. SolverStudio’s model file already includes both a data command and a solve command entered by the user. The user’s data command fails on NEOS as the NEOS data file is called ampl.dat, not Sheet.dat as used by SolverStudio. The solve command results in the model being solved twice! To avoid these difficulties, SolverStudio changes the user’s “data Sheet.dat” command to the NEOS-compatible  “data ampl.dat”, and adds an “end;” at the end of the user’s model file to stop any further AMPL processing. SolverStudio provides an empty run file to NEOS.

SolverStudio changes the “display <variable> > Sheet;” commands in the model to “_display <variable>;”. (Piping output to a file is not permitted on NEOS, and thus the “display <variable> > Sheet” command fails on NEOS.)  SolverStudio then parses the NEOS output to find data written by AMPL by the “_display” command.

The GAMS implementation is similar to that for AMPL, but uses GDX files to send and receive data.

SolverStudio’s code is based on the excellent NEOS example code in Python.

6 thoughts on “SolverStudio & NEOS

  1. Comments are closed on the download and installation page. It contains old information about the NEOS server: AMPL on NEOS makes the following IP connection: NEOS_HOST=”www.neos-server.org” NEOS_PORT=3332 This was address in Paul John's February 25, 2017 at 6:16 pm post in the comments and feedback section. changes in RunAMPLNEOS.py http to https and port from 3332 to 3333 I used this correction and was then able to get access to the NEOS server without an error. FYI.
  2. You may find that SolverStudio (v 0.09.02 or earlier) is not working with NEOS. NEOS have recently tweaked their systems, and so you need to edit RunGAMSNEOS.py or RunAMPLNEOS.py and change all lines with "time.sleep(1)" into "time.sleep(5)". This will be fixed in the next release. Andrew
  3. I hope NEOS can provide us with larger RAM to run our models, because real optimization problems are usually require more than 3 GR RAM, which makes NEOS less attractive for me. I will be very grateful for your improvement, thanks.
  4. Pingback: NIMo References « Pink Iguana

Leave a Reply to yongxiang zhang Cancel reply

Your email address will not be published. Required fields are marked *