12 #include "CbcModel.hpp"
13 #include "OsiBranchingObject.hpp"
51 const double * bestSolution = model_->bestSolution();
53 #ifdef DEBUG_BON_HEURISTIC_RINS
54 std::cout<<
"exited RINS b"<<std::endl;
68 int numberIntegers = model_->numberIntegers();
69 const int * integerVariable = model_->integerVariable();
73 double primalTolerance;
74 nlp->
getDblParam(OsiPrimalTolerance,primalTolerance);
77 for (
int i=0; i<numberIntegers; i++) {
78 int iColumn=integerVariable[i];
79 const OsiObject *
object = model_->object(i);
83 getIntegerInformation(
object, originalLower, originalUpper);
84 double valueInt=bestSolution[iColumn];
85 if (valueInt<originalLower) {
86 valueInt=originalLower;
87 }
else if (valueInt>originalUpper) {
88 valueInt=originalUpper;
90 if (fabs(currentSolution[iColumn]-valueInt)<10.0*primalTolerance) {
91 double nearest=floor(valueInt+0.5);
99 if(nFix > numberIntegers/10) {
100 #ifdef DEBUG_BON_HEURISTIC_RINS
101 std::cout<<
"cutoff = "<<model_->getCutoff()<<std::endl;
103 r_val =
doLocalSearch(nlp, newSolution, objectiveValue, model_->getCutoff(),
"rins.");
104 #ifdef DEBUG_BON_HEURISTIC_RINS
105 std::cout<<
"executed RINS "<<r_val<<std::endl;
122 roptions->AddStringOption2(
124 "if yes runs the RINS heuristic",
129 roptions->setOptionExtraInfo(
"heuristic_RINS", 63);
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
OsiSolverInterface * clone(bool copyData=true) const
Virtual copy constructor.
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound.
int solution(double &objectiveValue, double *newSolution)
Runs heuristic.
HeuristicRINS()
Default constructor.
void Initialize(Ipopt::SmartPtr< Ipopt::OptionsList > options)
Initiaize using passed options.
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 numberSolutions_
Number of solutions so we can do something at solution.
virtual ~HeuristicRINS()
Destructor.
OsiTMINLPInterface * nonlinearSolver()
Pointer to the non-linear solver used.
int howOften_
How often to do (code can change)
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register the options common to all local search based heuristics.
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound.
BonminSetup * setup_
Setup to use for local searches (will make copies).
bool getDblParam(OsiDblParam key, double &value) const