/home/coin/SVN-release/OS-2.2.0/Bonmin/src/Algorithms/Ampl/BonAmplSetup.cpp

Go to the documentation of this file.
00001 // (C) Copyright International Business Machines Corporation 2007
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // Pierre Bonami, International Business Machines Corporation
00007 //
00008 // Date : 04/15/2007
00009 
00010 #include "BonAmplSetup.hpp"
00011 namespace Bonmin
00012 {
00013   void BonminAmplSetup::initialize(char **& argv)
00014   {
00015     readOptionsFile();
00016     /* Read the model.*/
00017     SmartPtr<AmplTMINLP> model = new AmplTMINLP(ConstPtr(journalist()), roptions(), options(),
00018                                                 argv, NULL, "bonmin", NULL);
00019     mayPrintDoc();
00020     BonminSetup::initialize(GetRawPtr(model), true);
00021   }
00022 
00023   void
00024   BonminAmplSetup::initialize(AmplInterface &toFill, char **& argv)
00025   {
00026     Ipopt::SmartPtr<TNLPSolver> solver = toFill.solver();
00027     setOptionsAndJournalist(solver->roptions(),
00028         solver->options(),
00029         solver->journalist());
00030     /* Get the basic options. */
00031     readOptionsFile();
00032     /* Read the model.*/
00033     SmartPtr<AmplTMINLP> model = new AmplTMINLP(ConstPtr(journalist()), roptions(),
00034                                                 options(), argv, NULL, "bonmin", NULL);
00035     mayPrintDoc();
00036     toFill.initialize(roptions_, options_, journalist_, prefix(), GetRawPtr(model));
00037     BonminSetup::initialize(toFill, true);
00038   }
00039 
00041   void
00042   BonminAmplSetup::initialize(char **& argv, std::string& opt_file_content, std::string& nl_file_content, bool createContinuousSolver /*= false*/)
00043   {
00044     /* Get the basic options. */
00045     readOptionsString(opt_file_content);
00046     /* read nl file by creating AmplTMINLP.*/
00047     SmartPtr<AmplTMINLP> model = new AmplTMINLP(ConstPtr(journalist()), roptions(),
00048                                                 options(), argv, NULL, "bonmin", &nl_file_content);
00049     mayPrintDoc();
00050     BonminSetup::initialize(GetRawPtr(model), createContinuousSolver);
00051   }
00052 
00053 
00055   void
00056   BonminAmplSetup::initialize(AmplInterface &toFill, char **& argv, std::string& opt_file_content,
00057       std::string& nl_file_content, bool createContinuousSolver /*=  false*/
00058                              )
00059   {
00060     /* Get the basic options. */
00061     readOptionsString(opt_file_content);
00062     /* read nl file by creating AmplTMINLP.*/
00063     SmartPtr<AmplTMINLP> model = new AmplTMINLP(ConstPtr(journalist()), roptions(),
00064                                                 options(), argv, NULL, "bonmin", &nl_file_content);
00065     mayPrintDoc();
00066     toFill.initialize(roptions_, options_, journalist_, prefix(), GetRawPtr(model));
00067     BonminSetup::initialize(toFill, createContinuousSolver);
00068   }
00069 
00071   void BonminAmplSetup::fillOsiInterface(AmplInterface &toFill, char ** &argv, std::string & options,
00072       std::string & nl, bool createContinuousSolver /*=  false*/)
00073   {
00074 
00075     /* Get the basic options. */
00076     readOptionsString(options);
00077     /* Read the model.*/
00078     SmartPtr<AmplTMINLP> model =
00079       new AmplTMINLP(ConstPtr(journalist_),
00080           roptions_,
00081           options_,
00082           argv, NULL, "bonmin", &nl);
00083     toFill.initialize(roptions(), options_, journalist(), prefix(), GetRawPtr(model));
00084   }
00085 
00086 }
00087 

Generated on Thu Aug 5 03:02:53 2010 by  doxygen 1.4.7