00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "BonPumpForMinlp.hpp"
00010 #include "CbcModel.hpp"
00011 #include "OsiBranchingObject.hpp"
00012
00013 namespace Bonmin {
00014
00016 PumpForMinlp::PumpForMinlp():
00017 LocalSolverBasedHeuristic(){
00018 }
00020 PumpForMinlp::PumpForMinlp(BonminSetup * setup):
00021 LocalSolverBasedHeuristic(setup){
00022 setupDefaults(setup->options());
00023 }
00024
00026 PumpForMinlp::PumpForMinlp
00027 (const PumpForMinlp &other):
00028 LocalSolverBasedHeuristic(other){
00029 }
00030
00031 PumpForMinlp::~PumpForMinlp(){
00032 }
00033
00035 int
00036 PumpForMinlp::solution(double & objectiveValue,
00037 double * newSolution){
00038 if(model_->getNodeCount() || model_->getCurrentPassNumber() > 1) return 0;
00039 if(model_->getSolutionCount()) return 0;
00040
00041
00042 OsiTMINLPInterface * nlp = dynamic_cast<OsiTMINLPInterface *>
00043 (setup_->nonlinearSolver()->clone());
00044
00045 OsiBranchingInformation info = model_->usefulInformation();
00046
00047 double cutoff = info.cutoff_;
00048 int r_val = doLocalSearch(nlp, newSolution, objectiveValue, cutoff, "pump_for_minlp.");
00049 return r_val;
00050 }
00051
00052 void
00053 PumpForMinlp::setupDefaults(Ipopt::SmartPtr<Bonmin::OptionsList> options){
00054
00055 std::string prefix = "pump_for_minlp.";
00056 changeIfNotSet(options, prefix, "algorithm", "B-iFP");
00057 changeIfNotSet(options, prefix, "time_limit", 30.);
00058 }
00059
00060
00061 void
00062 PumpForMinlp::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions){
00063 roptions->SetRegisteringCategory("MINLP Heuristics", RegisteredOptions::BonminCategory);
00064 roptions->AddStringOption2(
00065 "pump_for_minlp",
00066 "if yes runs FP for MINLP",
00067 "no",
00068 "no", "don't run it",
00069 "yes", "runs the heuristic",
00070 "");
00071 roptions->setOptionExtraInfo("pump_for_minlp", 63);
00072 }
00073
00075 void
00076 PumpForMinlp::Initialize(Ipopt::SmartPtr<Bonmin::OptionsList> options){
00077 }
00078 }
00079