#include "OSConfig.h"
#include "OSnl2OS.h"
#include "OSosrl2ampl.h"
#include "OSiLReader.h"
#include "OSiLWriter.h"
#include "OSoLReader.h"
#include "OSoLWriter.h"
#include "OSrLReader.h"
#include "OSrLWriter.h"
#include "OSInstance.h"
#include "OSOption.h"
#include "OSResult.h"
#include "OSOutput.h"
#include "OSDefaultSolver.h"
#include "OSCoinSolver.h"
#include "OSFileUtil.h"
#include "OSSolverAgent.h"
#include "OShL.h"
#include "OSErrorClass.h"
#include "CoinError.hpp"
#include "OSCommandLine.h"
#include "OSCommandLineReader.h"
#include "OSRunSolver.h"
#include <sstream>
#include "CoinHelperFunctions.hpp"
#include <iostream>
#include <asl.h>
Go to the source code of this file.
Typedefs | |
typedef struct yy_buffer_state * | YY_BUFFER_STATE |
Functions | |
YY_BUFFER_STATE | osss_scan_string (const char *osss, void *scanner) |
void | setyyextra (OSCommandLine *oscommandline, void *scanner) |
int | ossslex (void *scanner) |
int | ossslex_init (void **ptr) |
int | ossslex_destroy (void *scanner) |
std::string | get_help () |
void | list_options (OSCommandLine *oscommandline) |
void | solve (OSCommandLine *oscommandline, OSnl2OS *nl2OS) |
Next we have implementations of the six remote service methods solve, send, retrieve, knock, kill, getJobID (Do not bother with local solve; use runSolver instead) More... | |
void | getJobID (OSCommandLine *oscommandline, OSnl2OS *osnl2os) |
void | send (OSCommandLine *oscommandline, OSnl2OS *osnl2os) |
void | kill (OSCommandLine *oscommandline, OSnl2OS *osnl2os) |
void | retrieve (OSCommandLine *oscommandline, OSnl2OS *osnl2os) |
void | knock (OSCommandLine *oscommandline, OSnl2OS *osnl2os) |
bool | findInstance (OSCommandLine *oscommandline, OSnl2OS *nl2os) |
This method tries to find the instance by reading the .nl file. More... | |
void | makeStrings (OSCommandLine *oscommandline) |
void | doPrintRow (OSInstance *osinstance, std::string rownumberstring) |
void | reportResults (OSCommandLine *oscommandline, std::string osrl, OSnl2OS *nl2OS) |
Deal with the OSrL output generated by the call to one of the service methods. More... | |
void | reportErrors (OSCommandLine *oscommandline, std::string errormsg, OSnl2OS *nl2OS) |
Deal with any error messages generated by the call to one of the service methods. More... | |
int | main (int argc, char **argv) |
Variables | |
const OSSmartPtr< OSOutput > | osoutput |
This executable is designed to act as a "solver" for AMPL. It can be used to solve problems locally or on a remote server. For example, to solve a problem locally, start AMPL. Let's assume that the model is hs71.mod. Execute the following sequence of commands:
model hs71.mod;
option solver OSAmplClient;
option OSAmplClient_options "-solver bonmin";
solve;
display x1;
you should get:
x1 = 1
display x2;
you should get:
x2 = 4.743
in general, specify options to the OSAmplClient solver by using the AMPL command OSAmplClient_options as another example, if you wanted to solve hs71.mod on a remote server you would do: model hs71.mod;
option solver OSAmplClient;
option OSAmplClient_options "-serviceLocation http://74.94.100.129:8080/OSServer/services/OSSolverService";
there are three possible options to specify:
{itemize}
the name of the solver using the { -solver} option, valid values for this option are { clp}, { cbc}, { dylp}, { ipopt}, { bonmin}, { couenne}, { symphony}, and { vol}.
the location of the remote server using the { -serviceLocation} option
the location of the option file using the { -osol} option
{itemize}
if no options are specified using { OSAmplClient_options}, by default,for continuous linear models clp is used. For continuous nonlinear models ipopt is used. For mixed-integer linear models (MIP), cbc is used. For mixed-integer nonlinear models bonmin is used. All solvers can be invoked locally or remotely. See the Users Manual in the doc folder for more information.
Definition in file OSAmplClient.cpp.
typedef struct yy_buffer_state* YY_BUFFER_STATE |
Definition at line 127 of file OSAmplClient.cpp.
YY_BUFFER_STATE osss_scan_string | ( | const char * | osss, |
void * | scanner | ||
) |
void setyyextra | ( | OSCommandLine * | oscommandline, |
void * | scanner | ||
) |
Definition at line 3383 of file OSParseosss.cpp.
Definition at line 3211 of file OSParseosss.cpp.
Definition at line 3302 of file OSParseosss.cpp.
std::string get_help | ( | ) |
Definition at line 1086 of file OSAmplClient.cpp.
void list_options | ( | OSCommandLine * | oscommandline | ) |
Definition at line 2537 of file OSSolverService.cpp.
void solve | ( | OSCommandLine * | oscommandline, |
OSnl2OS * | osnl2os | ||
) |
Next we have implementations of the six remote service methods solve, send, retrieve, knock, kill, getJobID (Do not bother with local solve; use runSolver instead)
Definition at line 614 of file OSAmplClient.cpp.
void getJobID | ( | OSCommandLine * | oscommandline, |
OSnl2OS * | osnl2os | ||
) |
Definition at line 715 of file OSAmplClient.cpp.
void send | ( | OSCommandLine * | oscommandline, |
OSnl2OS * | osnl2os | ||
) |
Definition at line 653 of file OSAmplClient.cpp.
void kill | ( | OSCommandLine * | oscommandline, |
OSnl2OS * | osnl2os | ||
) |
Definition at line 898 of file OSAmplClient.cpp.
void retrieve | ( | OSCommandLine * | oscommandline, |
OSnl2OS * | osnl2os | ||
) |
Definition at line 837 of file OSAmplClient.cpp.
void knock | ( | OSCommandLine * | oscommandline, |
OSnl2OS * | osnl2os | ||
) |
Definition at line 746 of file OSAmplClient.cpp.
bool findInstance | ( | OSCommandLine * | oscommandline, |
OSnl2OS * | nl2os | ||
) |
This method tries to find the instance by reading the .nl file.
This is the only acceptable format, since AMPL has just written the content of the model to a temporary file.
oscommandline,: | contains the information processed so far |
Definition at line 535 of file OSAmplClient.cpp.
void makeStrings | ( | OSCommandLine * | oscommandline | ) |
With the options we need to be a little more careful: Options can be in osol and jobID strings (either can be missing) or in an osoption object (which would include both of the above) or missing entirely (in which case a dummy string needs to be created)
Definition at line 559 of file OSAmplClient.cpp.
void doPrintRow | ( | OSInstance * | osinstance, |
std::string | rownumberstring | ||
) |
Definition at line 1052 of file OSAmplClient.cpp.
void reportResults | ( | OSCommandLine * | oscommandline, |
std::string | osrl, | ||
OSnl2OS * | osnl2OS | ||
) |
Deal with the OSrL output generated by the call to one of the service methods.
Definition at line 970 of file OSAmplClient.cpp.
void reportErrors | ( | OSCommandLine * | oscommandline, |
std::string | errMsg, | ||
OSnl2OS * | osnl2OS | ||
) |
Deal with any error messages generated by the call to one of the service methods.
Definition at line 1028 of file OSAmplClient.cpp.
Next we need to get the command line options into a std::string This will depend on whether OSAmplClient was run stand-alone or was called from AMPL (indicated by the second command line argument "-AMPL")
Deal with action items: -printLevel, -logFile, -filePrintLevel, –help, –version
Definition at line 162 of file OSAmplClient.cpp.
const OSSmartPtr<OSOutput> osoutput |
Definition at line 39 of file OSOutput.cpp.