- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/OS-2.3.5/OS/applications/amplClient/OSAmplClient.cpp

Go to the documentation of this file.

    00001
    00063 #include "OSCoinSolver.h"
    00064 #include "OSConfig.h"
    00065 #include "OSnl2osil.h"
    00066 #include "OSiLReader.h"
    00067 #include "OSrLReader.h"
    00068 #include "OSiLWriter.h"
    00069 #include "OSrLWriter.h"
    00070 #include "OSInstance.h"
    00071 #include "OSResult.h"
    00072 #include "OSOption.h"
    00073 #include "OSoLReader.h"
    00074 #include "OSoLWriter.h"
    00075 #ifdef COIN_HAS_LINDO
    00076 #include "OSLindoSolver.h"
    00077 #endif
    00078 #ifdef COIN_HAS_IPOPT
    00079 #include "OSIpoptSolver.h"
    00080 #endif
    00081 #ifdef COIN_HAS_BONMIN
    00082 #include "OSBonminSolver.h"
    00083 #endif
    00084 #ifdef COIN_HAS_COUENNE
    00085 #include "OSCouenneSolver.h"
    00086 #endif
    00087 #include "OSFileUtil.h"
    00088 #include "OSDefaultSolver.h"
    00089 #include "OSSolverAgent.h"
    00090 #include "OShL.h"
    00091 #include "OSErrorClass.h"
    00092 #include "CoinError.hpp"
    00093 #include "OSOption.h"
    00094 #include "OSOptionsStruc.h"
    00095 #include <sstream>
    00096
    00097 #ifdef HAVE_CSTRING
    00098 # include <cstring>
    00099 #else
    00100 # ifdef HAVE_STRING_H
    00101 #  include <string.h>
    00102 # else
    00103 #  error "don't have header file for string"
    00104 # endif
    00105 #endif
    00106
    00107 #include "CoinError.hpp"
    00108 #include "CoinHelperFunctions.hpp"
    00109
    00110
    00111 #include <iostream>
    00112 //AMPL includes must be last.
    00113 #include <asl.h>
    00114
    00115
    00116
    00117
    00118 #define MAXCHARS 5000
    00119
    00120 typedef struct yy_buffer_state *YY_BUFFER_STATE;
    00121 YY_BUFFER_STATE osss_scan_string(const char* osss, void* scanner );
    00122 //void osssset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
    00123 void setyyextra(osOptionsStruc *osoptions, void* scanner);
    00124 int ossslex(void* scanner );
    00125 int ossslex_init(void** ptr);
    00126 int ossslex_destroy (void* scanner );
    00127
    00128
    00129 using std::cerr;
    00130 using std::cout;
    00131 using std::endl;
    00132 using std::ostringstream;
    00133
    00134 void getAmplClientOptions(char *options, std::string *solverName,
    00135    std::string *optionFile, std::string *serviceLocation);
    00136
    00137
    00138
    00139
    00140
    00141 int main(int argc, char **argv)
    00142 {
    00143         WindowsErrorPopupBlocker();
    00144         char *stub;
    00145         // set AMPL structures
    00146         ASL *asl;
    00147         asl = ASL_alloc(ASL_read_fg);
    00148     stub = argv[1];
    00149         jac0dim((char*)stub, (fint)strlen(stub));
    00150         OSnl2osil *nl2osil = NULL;
    00151         //initialize object with stub -- the nl file
    00152         nl2osil = new OSnl2osil( stub);
    00153         // create an osinstance object
    00154         OSInstance *osinstance;
    00155         std::cout << " call nl2osil" << std::endl;
    00156         try{
    00157                 nl2osil->createOSInstance() ;
    00158         }
    00159         catch(const ErrorClass& eclass){
    00160                 std::cout << eclass.errormsg << std::endl;
    00161                 return 0;
    00162         }
    00163         std::cout << " return from  nl2osil" << std::endl;
    00164         osinstance = nl2osil->osinstance;
    00165         std::cout << " osinstance created" << std::endl;
    00166         // turn the osinstance into osil
    00167         // not needed for a local solve
    00168         // send an osinstance object in memory
    00176         char *amplclient_options = NULL;
    00177         //char *agent_address = NULL;
    00178         char *solver_option = NULL;
    00179         // set solver type default to clp
    00180         DefaultSolver *solverType  = NULL;
    00181         OSrLReader *osrlreader = NULL;
    00182         OSrLWriter *osrlwriter;
    00183         osrlwriter = new OSrLWriter();
    00184         OSResult *osresult = NULL;
    00185         std::string osrl = "";
    00186         std::string sSolverName = "";
    00187         std::string osolFileName = "";
    00188     std::string osol ="";
    00189         std::string serviceLocation = "";
    00190         //char *URL = NULL;
    00191         //char delims[] = " ";
    00192
    00193
    00194
    00195         // get the solver set by AMPL
    00196         amplclient_options = getenv("OSAmplClient_options");
    00197         if( amplclient_options != NULL){
    00198                 cout << "HERE ARE THE AMPLCLIENT OPTIONS " <<   amplclient_options << endl;
    00199                 getAmplClientOptions(amplclient_options, &sSolverName, &osolFileName, &serviceLocation);
    00200         }
    00201
    00202     if(osolFileName.size() > 0){
    00203         FileUtil *fileUtil;
    00204                 fileUtil = new FileUtil();
    00205         osol = fileUtil->getFileAsString( osolFileName.c_str() );
    00206         delete fileUtil;
    00207     }
    00208         //std::cout << " solver Name = " << sSolverName << std::endl;
    00209         //std::cout << " solver Options = " << osol << std::endl;
    00210
    00211     //convert solver name to lower case for testing purposes
    00212
    00213     unsigned int k;
    00214     for(k = 0; k < sSolverName.length(); k++){
    00215         sSolverName[ k] = tolower( sSolverName[ k]);
    00216     }
    00217
    00218
    00219         try{
    00220                 if(serviceLocation.size() == 0 ){
    00221                         //determine the solver
    00222
    00223
    00224                         if(sSolverName.size() == 0){// determine the default solver
    00225                                 if(osinstance->getNumberOfIntegerVariables() + osinstance->getNumberOfBinaryVariables() > 0){//we have an integer program
    00226                                         if( (osinstance->getNumberOfNonlinearExpressions() > 0)
    00227                                            || (osinstance->getNumberOfQuadraticTerms() > 0) ){ // we are nonlinear and integer
    00228                                                 sSolverName = "bonmin";
    00229                                         }else{//we are linear integer
    00230                                                 sSolverName = "cbc";
    00231                                         }
    00232                                 }else{// we have a continuous problem
    00233                                         if( (osinstance->getNumberOfNonlinearExpressions() > 0)
    00234                                            || (osinstance->getNumberOfQuadraticTerms() > 0) ){ // we are nonlinear and continuous
    00235                                                 sSolverName = "ipopt";
    00236                                         }else{//we have linear program
    00237                                                 sSolverName = "clp";
    00238                                         }
    00239                                 }
    00240                         }
    00241
    00242
    00243                         if( sSolverName == "lindo") {
    00244                                 // we are requesting the Lindo solver
    00245                                 bool bLindoIsPresent = false;
    00246                                 #ifdef COIN_HAS_LINDO
    00247                                 bLindoIsPresent = true;
    00248                                 solverType = new LindoSolver();
    00249                                 solverType->sSolverName = "lindo";
    00250                                 #endif
    00251                                 if(bLindoIsPresent == false) throw ErrorClass( "the Lindo solver requested is not present");
    00252                         }
    00253                         else{
    00254                                 if( sSolverName == "clp" ){
    00255                                         if( solver_option != NULL) cout << "HERE ARE THE Clp SOLVER OPTIONS " <<   solver_option << endl;
    00256                                         solverType = new CoinSolver();
    00257                                         solverType->sSolverName = "clp";
    00258                                 }
    00259                                 else{
    00260                                         if( sSolverName == "cbc"){
    00261
    00262                                                 solverType = new CoinSolver();
    00263                                                 solverType->sSolverName = "cbc";
    00264                                         }
    00265                                         else{
    00266                                                 if( sSolverName == "cplex"){
    00267                                                         bool bCplexIsPresent = false;
    00268                                                         #ifdef COIN_HAS_CPX
    00269                                                                 bCplexIsPresent = true;
    00270                                                                 solverType = new CoinSolver();
    00271                                                                 solverType->sSolverName = "cplex";
    00272                                                         #endif
    00273                                                                 if(bCplexIsPresent == false) throw ErrorClass( "the Cplex solver requested is not present");
    00274                                                 }
    00275                                                 else{
    00276                                                         if( sSolverName == "glpk"){
    00277                                                                 bool bGlpkIsPresent = false;
    00278                                                                 #ifdef COIN_HAS_GLPK
    00279                                                                         bGlpkIsPresent = true;
    00280                                                                         solverType = new CoinSolver();
    00281                                                                         solverType = new CoinSolver();
    00282                                                                         solverType->sSolverName = "glpk";
    00283                                                                 #endif
    00284                                                                 if(bGlpkIsPresent == false) throw ErrorClass( "the Glpk solver requested is not present");
    00285                                                         }
    00286                                                         else{
    00287                                                                 if( sSolverName == "ipopt"){
    00288                                                                         bool bIpoptIsPresent = false;
    00289                                                                         #ifdef COIN_HAS_IPOPT
    00290                                                                                 bIpoptIsPresent = true;
    00291                                                                                 solverType = new IpoptSolver();
    00292                                                                                 solverType->sSolverName = "ipopt";
    00293                                                                         #endif
    00294                                                                         if(bIpoptIsPresent == false) throw ErrorClass( "the Ipopt solver requested is not present");
    00295                                                                 }
    00296                                                                 else{
    00297                                                                         if( sSolverName == "symphony" ){
    00298                                                                                 bool bSymIsPresent = false;
    00299                                                                                 #ifdef COIN_HAS_SYMPHONY
    00300                                                                                         bSymIsPresent = true;
    00301                                                                                         solverType = new CoinSolver();
    00302                                                                                         solverType->sSolverName = "symphony";
    00303                                                                                 #endif
    00304                                                                                 if(bSymIsPresent == false) throw ErrorClass( "the SYMPHONY solver requested is not present");
    00305                                                                         }
    00306                                                                         else{
    00307                                                                                 if( sSolverName == "dylp"){
    00308                                                                                         bool bDyLPIsPresent = false;
    00309                                                                                         #ifdef COIN_HAS_DYLP
    00310                                                                                                 bDyLPIsPresent = true;
    00311                                                                                                 solverType = new CoinSolver();
    00312                                                                                                 solverType->sSolverName = "dylp";
    00313                                                                                         #endif
    00314                                                                                         if(bDyLPIsPresent == false) throw ErrorClass( "the DyLP solver requested is not present");
    00315                                                                                 }
    00316                                                                                 else{
    00317                                                                                         if( sSolverName == "bonmin" ){
    00318                                                                                                 bool bBonminIsPresent = false;
    00319                                                                                                 #ifdef COIN_HAS_BONMIN
    00320                                                                                                         bBonminIsPresent = true;
    00321                                                                                                         solverType = new BonminSolver();
    00322                                                                                                         solverType->sSolverName = "bonmin";
    00323                                                                                                 #endif
    00324                                                                                                 if(bBonminIsPresent == false) throw ErrorClass( "the Bonmin solver requested is not present");
    00325                                                                                         }
    00326                                                                                         else{
    00327                                                                                                 if( sSolverName == "couenne"){
    00328                                                                                                         bool bCouenneIsPresent = false;
    00329                                                                                                         #ifdef COIN_HAS_COUENNE
    00330                                                                                                                 bCouenneIsPresent = true;
    00331                                                                                                                 solverType = new CouenneSolver();
    00332                                                                                                                 solverType->sSolverName = "counenne";
    00333                                                                                                         #endif
    00334                                                                                                         if(bCouenneIsPresent == false) throw ErrorClass( "the Couenne solver requested is not present");
    00335                                                                                                 }
    00336                                                                                                 else{
    00337                                                                                                         throw ErrorClass( "a supported solver has not been selected");
    00338                                                                                                 }
    00339                                                                                         }
    00340                                                                                 }
    00341                                                                         }
    00342                                                                 }
    00343                                                         }
    00344                                                 }
    00345                                         }
    00346                                 }
    00347                         }
    00348
    00349                         // now do a local solve
    00350                         solverType->osol = osol;
    00351                         //std::cout << osol << std::endl;
    00352                         OSiLWriter osilwriter;
    00353                         //std::cout << "WRITE THE INSTANCE" << std::endl;
    00354                         //std::cout << osilwriter.writeOSiL( osinstance) << std::endl;
    00355                         //std::cout << "DONE WRITE THE INSTANCE" << std::endl;
    00356
    00357                         solverType->osinstance = osinstance;
    00358                         solverType->buildSolverInstance();
    00359                         solverType->solve();
    00360                         osrl = solverType->osrl ;
    00361                                 //std::cout << osrl << std::endl;
    00362                 }// end if serviceLocation.size() == 0
    00363                 else{// do a remote solve
    00364                         OSSolverAgent* osagent = NULL;
    00365                         OSiLWriter *osilwriter = NULL;
    00366                         osilwriter = new OSiLWriter();
    00367                         std::string  osil = osilwriter->writeOSiL( osinstance);
    00369
    00370                         //agent_address = strstr(solver_option, "service");
    00371                         //agent_address += 7;
    00372                         //URL = strtok( agent_address, delims );
    00373                         //std::string sURL = URL;
    00375                         // we should be pointing to the start of the address
    00376                         osagent = new OSSolverAgent( serviceLocation);
    00377                         cout << "Place remote synchronous call: " + serviceLocation << endl << endl << endl;
    00378                         //cout << osol << endl;
    00379                         osrl = osagent->solve(osil, osol);
    00380                         if (osrl.size() == 0) throw ErrorClass("Nothing was returned from the server, please check service address");
    00381                         delete osilwriter;
    00382                         delete osagent;
    00383                 }
    00384         }//end try
    00385         catch(const ErrorClass& eclass){
    00386                 osresult = new OSResult();
    00387                 osresult->setGeneralMessage( eclass.errormsg);
    00388                 osresult->setGeneralStatusType( "error");
    00389                 osrl = osrlwriter->writeOSrL( osresult);
    00390                 std::cout  << osrl << std::endl;
    00391                 osrl = " ";
    00392                 write_sol(const_cast<char*>(osrl.c_str()), NULL, NULL, NULL);
    00393                 delete osresult;
    00394                 return 0;
    00395         }
    00396
    00397         try{ // now put solution back to ampl
    00398                 //need_nl = 0;
    00399                 std::string sResultFileName = "solutionResult.osrl";
    00400                 FileUtil *fileUtil;
    00401                 fileUtil = new FileUtil();
    00402                 fileUtil->writeFileFromString(sResultFileName, osrl);
    00403                 delete fileUtil;
    00404                 //cout << "WRITE THE SOLUTION BACK INTO AMPL" <<endl;
    00405                 string::size_type pos1 = osrl.find( "error");
    00406                 if(pos1 == std::string::npos){
    00407                         std::string sReport = "model was solved";
    00408                         std::cout << sReport << std::endl;
    00409                         //std::cout << osrl << std::endl;
    00410                         osrlreader = new OSrLReader();
    00411                         osresult = osrlreader->readOSrL( osrl);
    00412                         // do the following so output is not written twice
    00413                         // see page 23 of hooking solver to AMPL
    00414                         //need_nl = printf( sReport.c_str());
    00415
    00416                         //
    00417                         sReport = " ";
    00418                         int i;
    00419                         int vecSize;
    00420                         double *x;
    00421                         double *y;
    00422                         int numVars = osresult->getVariableNumber();
    00423                         int numCons = osresult->getConstraintNumber();
    00424                         x = new double[ numVars];
    00425                         y = new double[ numCons];
    00426
    00427                         std::vector<IndexValuePair*> primalValPair;
    00428                         std::vector<IndexValuePair*> dualValPair;
    00429                         dualValPair = osresult->getOptimalDualVariableValues( 0);
    00430                         primalValPair = osresult->getOptimalPrimalVariableValues( 0);
    00431
    00432                         for(i = 0; i < numVars; i++){
    00433                                 x[ 0] = 0.0;
    00434                         }
    00435                         vecSize = primalValPair.size();
    00436                         for(i = 0; i < vecSize; i++){
    00437                                 x[ primalValPair[i]->idx ] = primalValPair[i]->value;
    00438                                 //std::cout << "index =  " <<   primalValPair[i]->idx  << std::endl;
    00439                                 //std::cout << "value =  " <<   primalValPair[i]->value  << std::endl;
    00440                         }
    00441
    00442
    00443                         for(i = 0; i < numCons; i++){
    00444                                 y[ 0] = 0.0;
    00445                         }
    00446                         vecSize = dualValPair.size();
    00447                         for(i = 0; i < vecSize; i++){
    00448                                 y[ dualValPair[i]->idx ] = dualValPair[i]->value;
    00449                                 //std::cout << "index =  " <<   primalValPair[i]->idx  << std::endl;
    00450                                 //std::cout << "value =  " <<   primalValPair[i]->value  << std::endl;
    00451                         }
    00452
    00453
    00454
    00455                         write_sol(  const_cast<char*>(sReport.c_str()),  x, y , NULL);
    00456
    00457                         delete osrlreader;
    00458                         osrlreader = NULL;
    00459                         //delete[] x;
    00460                         //x = NULL;
    00461                         //delete y;
    00462                         //y = NULL;
    00463                 }else{
    00464                         // do the following so output is not written twice
    00465                         // see page 23 of hooking solver to AMPL
    00466                         std::cout  << osrl << std::endl;
    00467                         osrl = " ";
    00468                         //
    00469                         write_sol(  const_cast<char*>(osrl.c_str()), NULL, NULL, NULL);
    00470                         need_nl = 0;
    00471                 }
    00472                 //cout << "DONE WRITING THE SOLUTION BACK INTO AMPL" <<endl;
    00473         }
    00474         catch(const ErrorClass& eclass){
    00475                 cout << "There was an error parsing the OSrL" << endl << eclass.errormsg << endl << endl;
    00476         }
    00477         if(  solverType != NULL ){
    00478                 //cout << "TRY TO DELETE solverType" <<endl;
    00479                 delete solverType;
    00480                 //cout << "solverType JUST DELETED" <<endl;
    00481                 solverType = NULL;
    00482         }
    00483         delete osrlwriter;
    00484         //cout << "osrlwriter JUST DELETED" <<endl;
    00485         osrlwriter = NULL;
    00486         delete nl2osil;
    00487         //cout << "nl2osil JUST DELETED" <<endl;
    00488         nl2osil = NULL;
    00489         ASL_free(&asl);
    00490         return 0;
    00491 } // end main
    00492
    00493
    00494 //void getAmplClientOptions(char *amplclient_options, std::string *solverName,
    00495 //      std::string *solverOptions, std::string *serviceLocation){
    00496 //
    00497 //
    00498 //      std::string amplOptions = "";
    00499 //      std::ostringstream outStr;
    00500 //      std::string::size_type  pos1;
    00501 //      std::string::size_type  pos2;
    00502 //      std::string osolFileName = "";
    00503 //      FileUtil *fileUtil = NULL;
    00504 //
    00505 //      size_t i = 0;
    00506 //      size_t n = strlen( amplclient_options);
    00507 //      try{
    00508 //              while( i < n){
    00509 //                      //std::cout << amplclient_options[ i] << std::endl;
    00510 //                      if( amplclient_options[ i]  == ' '){
    00511 //                              outStr << ',';
    00512 //                              i++;
    00513 //                              while( amplclient_options[ i] == ' '  ){
    00514 //                                      i++;
    00515 //                              }
    00516 //                      }
    00517 //                      else{
    00518 //                              outStr << amplclient_options[ i];
    00519 //                              i++;
    00520 //                      }
    00521 //
    00522 //              }
    00523 //              //end with a comma
    00524 //              outStr << ',';
    00525 //              amplOptions = outStr.str();
    00526 //
    00527 //
    00528 //              // see if a solver has been specified
    00529 //              pos1 = amplOptions.find( "solver");
    00530 //              if(pos1 != std::string::npos){
    00531 //                      //we have a solver specified
    00532 //                      pos1 += 6;
    00533 //                      //std::cout << "position 1 = " << pos1 << std::endl;
    00534 //                      // we are at at the comma after solver
    00535 //                      pos2 = amplOptions.find( ",", pos1 + 1);
    00536 //                      //std::cout << "position 2 = " << pos2 << std::endl;
    00537 //                      if(pos2 != std::string::npos){
    00538 //                              //std::cout << "solverName = " <<  amplOptions.substr(pos1 + 1, pos2-pos1 - 1) << std::endl;
    00539 //                              *solverName = amplOptions.substr(pos1 + 1, pos2-pos1 - 1);
    00540 //
    00541 //                      }
    00542 //              }
    00543 //
    00544 //
    00545 //              // see if an option file has been specified
    00546 //              pos1 = amplOptions.find( "optionFile");
    00547 //              if(pos1 != std::string::npos){
    00548 //                      //we have a option file specified  specified
    00549 //                      pos1 += 10;
    00550 //                      //std::cout << "position 1 = " << pos1 << std::endl;
    00551 //                      // we are at at the comma after optionfile
    00552 //                      pos2 = amplOptions.find( ",", pos1 + 1);
    00553 //                      //std::cout << "position 2 = " << pos2 << std::endl;
    00554 //                      if(pos2 != std::string::npos){
    00555 //                              //std::cout << "optionFile Name = " <<  amplOptions.substr(pos1 + 1, pos2-pos1 - 1) << std::endl;
    00556 //                              osolFileName = amplOptions.substr(pos1 + 1, pos2-pos1 - 1);
    00557 //                      }
    00558 //              }
    00559 //
    00560 //              //now go ahead and read the OSoL file if specified
    00561 //
    00562 //              if( osolFileName.size() > 0 ){
    00563 //                      fileUtil = new FileUtil();
    00564 //                      *solverOptions  = fileUtil->getFileAsString( osolFileName.c_str());
    00565 //                      delete fileUtil;
    00566 //                      fileUtil = NULL;
    00567 //              }else{ // go ahead and create the osol string
    00568 //                      *solverOptions = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <osol xmlns=\"os.optimizationservices.org\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"os.optimizationservices.org http://www.optimizationservices.org/schemas/2.0/OSoL.xsd\"></osol>";
    00569 //              }
    00570 //
    00571 //              // see if a serviceLocation has been specified
    00572 //              pos1 = amplOptions.find( "serviceLocation");
    00573 //              if(pos1 != std::string::npos){
    00574 //                      //we have a serviceLocation specified
    00575 //                      pos1 += 15;
    00576 //                      //std::cout << "position 1 = " << pos1 << std::endl;
    00577 //                      // we are at at the comma after solver
    00578 //                      pos2 = amplOptions.find( ",", pos1 + 1);
    00579 //                      //std::cout << "position 2 = " << pos2 << std::endl;
    00580 //                      if(pos2 != std::string::npos){
    00581 //                              //std::cout << "solverName = " <<  amplOptions.substr(pos1 + 1, pos2-pos1 - 1) << std::endl;
    00582 //                              *serviceLocation = amplOptions.substr(pos1 + 1, pos2-pos1 - 1);
    00583 //
    00584 //                      }
    00585 //              }
    00586 //
    00587 //
    00588 //      }//end try
    00589 //      catch(const ErrorClass& eclass){
    00590 //              cout << "There was an error processing OSAmplClient options: " << endl << eclass.errormsg << endl << endl;
    00591 //              throw ErrorClass( eclass.errormsg) ;
    00592 //      }
    00593 //}//getAmplClientOptions
    00594
    00595
    00596
    00597
    00598
    00599 void getAmplClientOptions(char *amplclient_options, std::string *solverName,
    00600                                                   std::string *solverOptions, std::string *serviceLocation){
    00601
    00602         osOptionsStruc *osoptions;
    00603
    00604         void* scanner;
    00605         // initialize the OS options structure
    00606
    00607         osoptions = new osOptionsStruc();
    00608         osoptions->configFile = "";
    00609         osoptions->osilFile = "";
    00610         osoptions->osil = "";
    00611         osoptions->osolFile = "";
    00612         osoptions->osol = "";
    00613         osoptions->osrlFile = "";
    00614         osoptions->osrl = "";
    00615         //osoptions->insListFile = "";
    00616         osoptions->insList = "";
    00617         osoptions->serviceLocation = "";
    00618         osoptions->serviceMethod = "";
    00619         osoptions->osplInputFile = "";
    00620         osoptions->osplOutputFile = "";
    00621         osoptions->mpsFile = "";
    00622         osoptions->nlFile = "";
    00623         osoptions->gamsControlFile = "";
    00624         osoptions->solverName = "";
    00625         osoptions->browser = "";
    00626         osoptions->invokeHelp = false;
    00627         osoptions->writeVersion = false;
    00628         try{
    00629                 //cout << "Input String = "  << amplclient_options << endl;
    00630                 ossslex_init( &scanner);
    00631                 //std::cout << "Call Text Extra" << std::endl;
    00632                 setyyextra( osoptions, scanner);
    00633                 //std::cout << "Call scan string " << std::endl;
    00634                 osss_scan_string( amplclient_options, scanner);
    00635                 //std::cout << "call ossslex" << std::endl;
    00636                 ossslex( scanner);
    00637                 ossslex_destroy( scanner);
    00638                 //std::cout << "done with call to ossslex" << std::endl;
    00639 //
    00640 //              cout << "HERE ARE THE OPTION VALUES:" << endl;
    00641 //              if(osoptions->configFile != "") cout << "Config file = " << osoptions->configFile << endl;
    00642 //              if(osoptions->osilFile != "") cout << "OSiL file = " << osoptions->osilFile << endl;
    00643 //              if(osoptions->osolFile != "") cout << "OSoL file = " << osoptions->osolFile << endl;
    00644 //              if(osoptions->osrlFile != "") cout << "OSrL file = " << osoptions->osrlFile << endl;
    00645 //              //if(osoptions->insListFile != "") cout << "Instruction List file = " << osoptions->insListFile << endl;
    00646 //              if(osoptions->osplInputFile != "") cout << "OSpL Input file = " << osoptions->osplInputFile << endl;
    00647 //              if(osoptions->serviceMethod != "") cout << "Service Method = " << osoptions->serviceMethod << endl;
    00648 //              if(osoptions->mpsFile != "") cout << "MPS File Name = " << osoptions->mpsFile << endl;
    00649 //              if(osoptions->nlFile != "") cout << "NL File Name = " << osoptions->nlFile << endl;
    00650 //              if(osoptions->gamsControlFile != "") cout << "gams Control File Name = " << osoptions->gamsControlFile << endl;
    00651 //              if(osoptions->browser != "") cout << "Browser Value = " << osoptions->browser << endl;
    00652 //              if(osoptions->solverName != "") cout << "Selected Solver = " << osoptions->solverName << endl;
    00653 //              if(osoptions->serviceLocation != "") cout << "Service Location = " << osoptions->serviceLocation << endl;
    00654 //
    00655
    00656                 *solverName = osoptions->solverName;
    00657                 *solverOptions = osoptions->osolFile;
    00658
    00659                 *serviceLocation = osoptions->serviceLocation;
    00660
    00661         }//end try
    00662         catch(const ErrorClass& eclass){
    00663                 cout << "There was an error processing OSAmplClient options: " << endl << eclass.errormsg << endl << endl;
    00664                 throw ErrorClass( eclass.errormsg) ;
    00665         }
    00666 }//getAmplClientOptions