So the first few lines of the XML file will look like:
<neos:SolverDescription xmlns:neos="http://www.mcs.anl.gov/neos"> <neos:category>test</neos:category> <neos:solver>HelloNEOS</neos:solver> <neos:inputMethod>basic</neos:inputMethod> <neos:password>hello</neos:password> <neos:contact>fakeperson@mcs.anl.gov</neos:contact>
You may need to change the name of your solver in case somebody else is also trying out the HelloNEOS solver. And of course, you should use your own email address. This will allow NEOS to send you mail if there are problems with your solver.
neos:token
tag is used to select the input when using the
email or XML-RPC interfaces to NEOS, the neos:filename
tag
indicates
the name of the file that will be created on your workstation containing the
data, and neos:prompt
will give Web users a prompt for what data
is expected.
<neos:input TYPE="textfield"> <neos:token>num1</neos:token> <neos:filename>num1</neos:filename> <neos:prompt>First Number</neos:prompt> </neos:input> <neos:input TYPE="textfield"> <neos:token>num2</neos:token> <neos:filename>num2</neos:filename> <neos:prompt>Second Number</neos:prompt> </neos:input> <neos:input TYPE="radio"> <neos:token>operation</neos:token> <neos:filename>operation</neos:filename> <neos:prompt>Which Operation</neos:prompt> <neos:option value="Multiplication" default="true">Multiplication</neos:option> <neos:option value="Addition">Addition</neos:option> </neos:input>
More information on the various input types and tags can be found here.
<neos:machine> <neos:hostname>lully.mcs.anl.gov</neos:hostname> <neos:user>neos</neos:user> </neos:machine>
If you want to run on more than one workstation, then you will need to add
another neos:machine
entry. NEOS will then select one of the
machines at random whenever it receives a job request for your solver. More information on designating machines and setting time, file, and memory limits can
be found here.
Finally, you need to close up your XML file with
</neos:SolverDescription>The entire HelloNEOS XML file can be found here.
SolverTools/register.py
Python script:
register.py HelloNEOS.txt
This should give you a confirmation message like 'Entering into database'. If there is an error in your XML file, you should get a message explaining why NEOS couldn't parse the file. If you get a message about a wrong password, then somebody else is using the HelloNEOS solver name and you will need to choose another name to use.
Now your solver should be present on NEOS. Look here. Clicking on your solver will show you a web form with two text fields for the numbers and a radio button section for the operation. We're not quite done yet, so submitting your problem won't work yet. You can go ahead and give a try though, you should get some error about not finding a station to run the solver on.
hello.py
for the HelloNEOS solver looks like:
#!/usr/bin/env python import os print ("Hello NEOS!"); f = open('num1','r') num1 = float(f.read()) f.close() f = open('num2','r') num2 = float(f.read()) f.close() f = open('operation','r') operation=f.read() f.close() if operation=="Multiplication": print "%.5f * %.5f = %.5f" % (num1, num2, num1*num2) else: print "%.5f + %.5f = %.5f" % (num1, num2, num1+num2)
/home/neos/driverlist.txt
will look like
this:
test:HelloNEOS:basic /path/to/hello.py
Before starting the server, you need to edit the SolverTools/config.py
file to give the location of this driverlist.txt
file and
some directories for running jobs in:
class Variables: NEOS_HOST="neos.mcs.anl.gov" NEOS_PORT=3332 JOBSDIR="/home/neos/HelloNEOS/jobs" LOGDIR="/home/neos/HelloNEOS/logs" TESTDIR="/home/neos/HelloNEOS/test" DRIVER_FILE="/home/neos/driverlist.txt"
Now you are ready to go. Just execute
SolverTools/SolverDaemon.pyIf you are behind a firewall, then you will need to open up a port. You can choose which port to listen on by giving the port as a command line argument:
SolverDaemon.py 4000
Congratulations, you have created a solver for NEOS. You should be able to access your solver here.
SolverTools/remove.py
script:
remove.py test:HelloNEOS:basic passwordwhere 'password' is the password that you selected in the XML file. @NEOS_WEB_DISCLAIMER@