BonPumpForMinlp.cpp
Go to the documentation of this file.
1 // (C) Copyright CNRS
2 // This code is published under the Eclipse Public License.
3 //
4 // Authors :
5 // Pierre Bonami, LIF Université de la Méditérannée-CNRS
6 //
7 // Date : 02/18/2009
8 
9 #include "BonPumpForMinlp.hpp"
10 #include "CbcModel.hpp"
11 #include "OsiBranchingObject.hpp"
12 
13 namespace Bonmin {
14 
18  }
22  setupDefaults(setup->options());
23  }
24 
27  (const PumpForMinlp &other):
29  }
30 
32  }
33 
35  int
36  PumpForMinlp::solution(double & objectiveValue,
37  double * newSolution){
38  if(model_->getNodeCount() || model_->getCurrentPassNumber() > 1) return 0;
39  if(model_->getSolutionCount()) return 0;
40  //int numberObjects = model_->numberObjects();
41  //OsiObject ** objects = model_->objects();
42  OsiTMINLPInterface * nlp = dynamic_cast<OsiTMINLPInterface *>
44 
45  OsiBranchingInformation info = model_->usefulInformation();
46 
47  double cutoff = info.cutoff_;
48  int r_val = doLocalSearch(nlp, newSolution, objectiveValue, cutoff, "pump_for_minlp.");
49  return r_val;
50  }
51 
52  void
54  //int dummy;
55  std::string prefix = "pump_for_minlp.";
56  changeIfNotSet(options, prefix, "algorithm", "B-iFP");
57  changeIfNotSet(options, prefix, "time_limit", 30.);
58  }
59 
60 
61  void
63  roptions->SetRegisteringCategory("Primal Heuristics", RegisteredOptions::BonminCategory);
64  roptions->AddStringOption2(
65  "pump_for_minlp",
66  "whether to run the feasibility pump heuristic for MINLP",
67  "no",
68  "no", "",
69  "yes", "",
70  "");
71  roptions->setOptionExtraInfo("pump_for_minlp", 63);
72  }
73 
75  void
77  }
78 }/* ends bonmin namespace*/
79 
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real fint fint fint fint * info
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
int solution(double &objectiveValue, double *newSolution)
Runs heuristic.
OsiSolverInterface * clone(bool copyData=true) const
Virtual copy constructor.
int doLocalSearch(OsiTMINLPInterface *solver, double *solution, double &solValue, double cutoff, std::string prefix="local_solver.") const
Do a local search based on setup and passed solver.
void Initialize(Ipopt::SmartPtr< Ipopt::OptionsList > options)
Initiaize using passed options.
PumpForMinlp()
Default constructor.
virtual ~PumpForMinlp()
Destructor.
static void changeIfNotSet(Ipopt::SmartPtr< Ipopt::OptionsList > options, std::string prefix, const std::string &option, const std::string &value)
OsiTMINLPInterface * nonlinearSolver()
Pointer to the non-linear solver used.
Ipopt::SmartPtr< Ipopt::OptionsList > options()
Acces list of Options.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register the options common to all local search based heuristics.
static char prefix[100]
Definition: BM_lp.cpp:26
virtual void setupDefaults(Ipopt::SmartPtr< Ipopt::OptionsList > options)
Setup the defaults.
BonminSetup * setup_
Setup to use for local searches (will make copies).