00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "BonAmplSetup.hpp"
00011 #include "BonSolReader.hpp"
00012 namespace Bonmin
00013 {
00014 void BonminAmplSetup::initialize(char **& argv)
00015 {
00016 readOptionsFile();
00017
00018 Ipopt::SmartPtr<AmplTMINLP> model = new AmplTMINLP(ConstPtr(journalist()), roptions(), options(),
00019 argv, NULL, "bonmin", NULL);
00020 mayPrintDoc();
00021 BonminSetup::initialize(GetRawPtr(model), true);
00022 #if 1
00023 int ival;
00024 options()->GetEnumValue("read_solution_file", ival, "bonmin.");
00025 if(ival){
00026 printf("Reading solution file");
00027 SolReader read(argv[1], ".dbg_sol");
00028 read.set_n_cols(nonlinearSolver()->getNumCols());
00029 read.readFile();
00030 nonlinearSolver()->activateRowCutDebugger(read.x());
00031 }
00032 #endif
00033 }
00034
00035 void
00036 BonminAmplSetup::initialize(AmplInterface &toFill, char **& argv)
00037 {
00038 Ipopt::SmartPtr<TNLPSolver> solver = toFill.solver();
00039 setOptionsAndJournalist(solver->roptions(),
00040 solver->options(),
00041 solver->journalist());
00042
00043 readOptionsFile();
00044
00045 Ipopt::SmartPtr<AmplTMINLP> model = new AmplTMINLP(ConstPtr(journalist()), roptions(),
00046 options(), argv, NULL, "bonmin", NULL);
00047 mayPrintDoc();
00048 toFill.initialize(roptions_, options_, journalist_, prefix(), GetRawPtr(model));
00049 BonminSetup::initialize(toFill, true);
00050 }
00051
00053 void
00054 BonminAmplSetup::initialize(char **& argv, std::string& opt_file_content, std::string& nl_file_content, bool createContinuousSolver )
00055 {
00056
00057 readOptionsString(opt_file_content);
00058
00059 Ipopt::SmartPtr<AmplTMINLP> model = new AmplTMINLP(ConstPtr(journalist()), roptions(),
00060 options(), argv, NULL, "bonmin", &nl_file_content);
00061 mayPrintDoc();
00062 BonminSetup::initialize(GetRawPtr(model), createContinuousSolver);
00063 }
00064
00065
00067 void
00068 BonminAmplSetup::initialize(AmplInterface &toFill, char **& argv, std::string& opt_file_content,
00069 std::string& nl_file_content, bool createContinuousSolver
00070 )
00071 {
00072
00073 readOptionsString(opt_file_content);
00074
00075 Ipopt::SmartPtr<AmplTMINLP> model = new AmplTMINLP(ConstPtr(journalist()), roptions(),
00076 options(), argv, NULL, "bonmin", &nl_file_content);
00077 mayPrintDoc();
00078 toFill.initialize(roptions_, options_, journalist_, prefix(), GetRawPtr(model));
00079 BonminSetup::initialize(toFill, createContinuousSolver);
00080 }
00081
00083 void BonminAmplSetup::fillOsiInterface(AmplInterface &toFill, char ** &argv, std::string & options,
00084 std::string & nl, bool createContinuousSolver )
00085 {
00086
00087
00088 readOptionsString(options);
00089
00090 Ipopt::SmartPtr<AmplTMINLP> model =
00091 new AmplTMINLP(ConstPtr(journalist_),
00092 roptions_,
00093 options_,
00094 argv, NULL, "bonmin", &nl);
00095 toFill.initialize(roptions(), options_, journalist(), prefix(), GetRawPtr(model));
00096 }
00097
00098 }
00099