Your driver is an executable that will run your solver. This can be a script (Perl, Python, bash, etc.) or a compiled binary. The input from the NEOS user will be stored as files in the local directory. For example, if in your solver XML description you had the section:
<neos:input TYPE="textarea">
<neos:token>mytext<neos:token>
<neos:filename>mytextfile<neos:filename>
<neos:prompt>Enter some text<neos:prompt>
<neos:input>
then there will be a file in the local directory named mytextfile
which has the text that the NEOS user entered into the text box. If the text box is left blank, then the file will not exist.
Anything written to standard out will be sent back to NEOS and forwarded to the client in
real-time. Anything written to the file job.results
will be sent to the
client as the final results. If nothing is written to this file, then the user will only
receive what was sent to standard out. Any standard error will also be sent to the client
with the the prefix 'Error:'
.
DRIVER_FILE
entry in the
SolverTools/config.py
file. The syntax of this file is one entry per line of
Category:SolverName:InputMethod /path/to/driver
lp:MyAwesomeSolver:AMPL /home/me/ampldriver
lp:MyAwesomeSolver:MPS /home/me/mpsdriver
If your solver uses AMPL, then you can use the provided Python base class to
simplify the driver. To do this, you must use the filenames ampl.mod
, ampl.dat
, and ampl.com
in the XML solver description (see tron-ampl.txt).
To use the base class, you must set the AMPL executable in the SolverTools/config.py
file and the solver executable must be accessible from AMPL (either in the $PATH
environment variable or in the same directory as AMPL).
#!/usr/bin/env python
import sys
import os
sys.path.append('/path/to/neos-5')
import SolverTools.AMPL
tron = SolverTools.AMPL.AMPLSolver("tron")
tron.execute()
The argument to sys.path.append
should be the directory where
you downloaded or unzipped NEOS (This value should be the parent directory of SolverTools
), and the argument to SolverTools.AMPL.AMPLSolver
should the name of the executable
@NEOS_WEB_DISCLAIMER@