10 #include "CbcModel.hpp"
11 #include "OsiBranchingObject.hpp"
38 double * newSolution){
40 if(model_->getSolutionCount() > 0)
return 0;
41 if(model_->getNodeCount() > 1000)
return 0;
42 if(model_->getNodeCount() % 100 != 0)
return 0;
43 int numberObjects = model_->numberObjects();
44 OsiObject ** objects = model_->objects();
56 OsiBranchingInformation
info = model_->usefulInformation();
57 info.solution_ = model_->getColSolution();
61 for(
int i = 0 ; i < numberObjects; i++){
62 if(objects[i]->infeasibility(&info, dummy) == 0.){
63 objects[i]->feasibleRegion(nlp, &info);
67 if(nFixed < numberObjects / 3)
return 0;
68 double cutoff = info.cutoff_;
69 int r_val =
doLocalSearch(nlp, newSolution, objectiveValue, cutoff);
77 roptions->AddStringOption2(
78 "fix_and_solve_heuristic",
79 "if yes runs a heuristic at root where fixes all variables integer in the continuous solution",
82 "yes",
"runs the heuristic",
84 roptions->setOptionExtraInfo(
"fix_and_solve_heuristic", 63);
For undocumented options.
virtual ~FixAndSolveHeuristic()
Destructor.
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 ...
void Initialize(Ipopt::SmartPtr< Ipopt::OptionsList > options)
Initiaize using passed options.
OsiSolverInterface * clone(bool copyData=true) const
Virtual copy constructor.
FixAndSolveHeuristic()
Default constructor.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register the options common to all local search based heuristics.
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.
int solution(double &objectiveValue, double *newSolution)
Runs heuristic.
OsiTMINLPInterface * nonlinearSolver()
Pointer to the non-linear solver used.
BonminSetup * setup_
Setup to use for local searches (will make copies).