15 #include "OsiCpxSolverInterface.hpp"
22 #define CBCMILPTIME 20
28 nlp_(NULL), cinlp_(NULL), milp_(NULL),
30 maxFirPoints_(5), maxTime_(60), maxTimeFirstCall_(60), numInitialRows_(0),
31 numSol_(-1), colLower_(NULL), colUpper_(NULL),
32 colLowerNlp_(NULL), colUpperNlp_(NULL),
33 omega_(0.2), baseLbRhs_(15),
36 setHeuristicName(
"CouenneIterativeRounding");
40 OsiSolverInterface* cinlp,
43 CbcHeuristic(), nlp_(NULL),
44 cinlp_(NULL), milp_(NULL),
45 numSol_(-1), colLower_(NULL), colUpper_(NULL),
46 colLowerNlp_(NULL), colUpperNlp_(NULL),
54 options->GetIntegerValue(
"iterative_rounding_aggressiveness",
55 irAggressiveness,
"couenne.");
57 double maxTime, maxTimeInit;
58 options->GetNumericValue(
"iterative_rounding_time", maxTime,
60 options->GetNumericValue(
"iterative_rounding_time_firstcall",
61 maxTimeInit,
"couenne.");
65 if (maxTimeInit >= 0){
69 options->GetIntegerValue(
"iterative_rounding_base_lbrhs",
73 options->GetIntegerValue(
"iterative_rounding_num_fir_points",
74 numFirPoints,
"couenne.");
77 options->GetNumericValue(
"iterative_rounding_omega",
83 CbcHeuristic(other), nlp_(other.nlp_),
84 cinlp_(other.cinlp_), milp_(other.milp_),
85 maxRoundingIter_(other.maxRoundingIter_),
86 maxFirPoints_(other.maxFirPoints_),
87 maxTime_(other.maxTime_),
88 maxTimeFirstCall_(other.maxTimeFirstCall_),
89 numInitialRows_(other.numInitialRows_),
90 numSol_(other.numSol_),
91 omega_(other.omega_), baseLbRhs_(other.baseLbRhs_),
92 couenne_(other.couenne_)
99 milp_ =
dynamic_cast<OsiCpxSolverInterface*
>(other.
milp_->clone());
101 milp_ =
dynamic_cast<OsiClpSolverInterface*
>(other.
milp_->clone());
137 CbcHeuristic::operator=(rhs);
141 if(rhs.
nlp_ != NULL){
200 OsiSolverInterface * cinlp){
207 if (tminlp->hasLinearObjective()){
225 OsiSolverInterface * milp = model_->solver();
226 int n = milp->getNumCols();
229 milp_ =
new OsiCpxSolverInterface();
230 milp_->loadProblem(*(milp->getMatrixByRow()), milp->getColLower(),
231 milp->getColUpper(), milp->getObjCoefficients(),
232 milp->getRowLower(), milp->getRowUpper());
233 for (
int i = 0; i <
n; ++i){
234 if (milp->isInteger(i))
235 milp_->setInteger(i);
238 milp_ =
dynamic_cast<OsiClpSolverInterface*
>(milp->clone());
243 memcpy(
colLower_, milp->getColLower(), n*
sizeof(double));
244 memcpy(
colUpper_, milp->getColUpper(), n*
sizeof(double));
246 int nNlp =
cinlp_->getNumCols();
254 for (
int i = 0; i < nNlp; ++i){
255 if (
cinlp_->isInteger(i)){
264 for (
int i = 0; i <
n; ++i){
275 double * tmpArray =
new double[
n];
276 CoinFillN(tmpArray, n, 0.0);
277 milp_->setObjective(tmpArray);
278 milp_->setObjSense(1);
282 for (
int i = 0; i <
n; ++i){
283 milp_->addCol(0, NULL, NULL, 0.0, COIN_DBL_MAX, 1.0);
286 milp_->setHintParam(OsiDoDualInResolve,
true,OsiHintDo);
287 milp_->setHintParam(OsiDoPresolveInResolve,
true,OsiHintDo);
288 milp_->setHintParam(OsiDoReducePrint,
true,OsiHintDo);
290 milp_->messageHandler()->setLogLevel(0);
295 CPXsetintparam(
milp_->getEnvironmentPtr(), CPX_PARAM_MIPEMPHASIS, CPX_MIPEMPHASIS_HIDDENFEAS);
296 CPXsetintparam(
milp_->getEnvironmentPtr(), CPX_PARAM_FPHEUR, 2);
297 CPXsetintparam(
milp_->getEnvironmentPtr(), CPX_PARAM_NODESEL, 0);
298 CPXsetintparam(
milp_->getEnvironmentPtr(), CPX_PARAM_LBHEUR, 1);
299 CPXsetintparam(
milp_->getEnvironmentPtr(), CPX_PARAM_RINSHEUR, 99);
300 CPXsetintparam(
milp_->getEnvironmentPtr(), CPX_PARAM_NODELIM, 50);
301 CPXsetdblparam(
milp_->getEnvironmentPtr(), CPX_PARAM_CUTSFACTOR, 1.0);
302 CPXsetdblparam(
milp_->getEnvironmentPtr(), CPX_PARAM_TILIM,
MILPTIME);
307 CbcHeuristicFPump * feaspump =
new CbcHeuristicFPump();
308 feaspump->setMaximumRetries(2);
309 feaspump->setMaximumPasses(100);
310 feaspump->setAccumulate(3);
311 heuristics_[0] = feaspump;
340 std::cerr <<
"CouenneIterativeRounding::setAggressiveness() : unknown value!\n" << std::endl;
352 if ((model_->numberIntegers() == 0) ||
353 (
numSol_ == model_->getSolutionCount())){
359 numSol_ = model_->getSolutionCount();
361 std::cout <<
"Launching IterativeRounding with parameters:" << std::endl;
363 std::cout <<
"Max feas point: " <<
maxFirPoints_ << std::endl;
364 std::cout <<
"Base lbrhs: " <<
baseLbRhs_ << std::endl;
365 std::cout <<
"Omega: " <<
omega_ << std::endl;
372 const double* bestKnownSolution = model_->bestSolution();
374 bool hasSolution =
true;
375 bool improved =
true;
380 bestKnownSolution = newSolution;
391 improved =
improvementIR(objectiveValue, newSolution, bestKnownSolution);
393 bestKnownSolution = newSolution;
395 found = (found || improved);
407 double* newSolution){
409 std::cout <<
"starting feasibility IR" << std::endl;
411 OsiSolverInterface * solver = model_->solver();
413 OsiAuxInfo * auxInfo = solver->getAuxiliaryInfo();
424 int nNlp =
cinlp_->getNumCols();
427 int numIntAtBound = 0;
435 bool boundsChanged =
false;
436 std::vector<int> previousBranches;
455 if (obj == COIN_DBL_MAX){std::cout <<
" IR: no feasible solution found " << std::endl;
456 std::cout <<
" IR: elapsed time " << CoinCpuTime()-
startTime_ << std::endl;
460 double* xprime =
new double [
n];
468 double constrElem[2];
471 bool foundSolution =
false;
472 double* tmpSolution =
new double[
n];
474 OsiSolverInterface* curr_milp =
milp_;
477 for (
int h = 0; h < outerLoop &&
486 for (
int i = 0; i <
n; i++){
491 cut.mutableRow().setVector(2, constrInd, constrElem);
492 cut.setLb(-COIN_DBL_MAX);
493 cut.setUb(-xprime[i]);
497 cut.mutableRow().setVector(2, constrInd, constrElem);
498 cut.setLb(-COIN_DBL_MAX);
499 cut.setUb(xprime[i]);
502 curr_milp->applyCuts(cs);
508 curr_milp->applyCuts(revlb_all);
511 if (!solFound && !boundsChanged){
512 std::cout <<
" MILP cannot be solved, terminating LB " << std::endl;
516 delete[] tmpSolution;
521 std::cout <<
" IR: elapsed time " << CoinCpuTime()-
startTime_ << std::endl;
522 return foundSolution;
524 else if (!solFound && boundsChanged){
530 branchToCut(tmpSolution, curr_milp, previousBranches);
534 const double * xtilde = curr_milp->getColSolution();
538 CoinCopyN (xtilde, n, tmpSolution);
539 for (
int i = 0; i < nNlp; ++i){
540 if (model_->isInteger(i)){
541 tmpSolution[i] = floor(tmpSolution[i]+0.5);
542 cinlp_->setColLower(i, tmpSolution[i]);
543 cinlp_->setColUpper(i, tmpSolution[i]);
546 cinlp_->setColSolution(tmpSolution);
548 cinlp_->messageHandler()->setLogLevel(1);
550 obj = ((
cinlp_->isProvenOptimal()) ?
551 cinlp_->getObjValue():COIN_DBL_MAX);
552 memcpy(tmpSolution,
cinlp_->getColSolution(),
553 nNlp*
sizeof(double));
557 bool isChecked =
false;
559 isChecked =
couenne_ -> checkNLP0 (tmpSolution, obj,
true,
576 if (
cinlp_->isProvenOptimal () &&
581 #ifdef FM_TRACE_OPTSOL
593 #ifdef FM_TRACE_OPTSOL
606 std::cout <<
"Final Nlp solution with objective " << obj <<
" :" << std::endl;
609 std::cout <<
"New incumbent found" << std::endl;
611 *lb = solver -> getColLower (),
612 *ub = solver -> getColUpper ();
616 for (
int i=0; i <
n; ++i, ++lb, ++ub) {
618 if (t < *lb) t = *lb;
619 else if (t > *ub) t = *ub;
623 foundSolution =
true;
624 objectiveValue = obj;
625 CoinCopyN (tmpSolution, n, newSolution);
631 delete[] tmpSolution;
638 std::cout <<
"IR: Heuristic: " << objectiveValue << std::endl;
639 std::cout <<
"IR: Heuristic time: " << elapsed << std::endl;
640 return foundSolution;
648 if (numIntAtBound >= 50 ||
652 avgBound = floor(avgBound + 0.5);
653 std::cout <<
"Using reverse LB with rhs " << avgBound << std::endl;
654 writeLB(cut, xtilde,
'G', avgBound);
655 revlb_all.insert(cut);
660 boundsChanged =
true;
663 if (h <= outerLoop -2){
668 nlp->messageHandler()->setLogLevel(10);
671 opt->GetNumericValue(
"mu_target", mu_target,
"ipopt.");
672 opt->SetNumericValue(
"mu_target",
omega_*(h+1),
"ipopt.");
673 opt->GetNumericValue(
"kappa_d", kappa_d,
"ipopt.");
674 opt->SetNumericValue(
"kappa_d", 0.0,
"ipopt.");
681 opt->SetNumericValue(
"mu_target", mu_target,
"ipopt.");
682 opt->SetNumericValue(
"kappa_d", kappa_d,
"ipopt.");
700 delete[] tmpSolution;
707 std::cout <<
"IR: Heuristic time: " << elapsed << std::endl;
708 return foundSolution;
714 const double* solution){
715 std::cout <<
"starting Improvement IR" << std::endl;
717 OsiSolverInterface * solver = model_->solver();
719 OsiAuxInfo * auxInfo = solver->getAuxiliaryInfo();
731 int nNlp =
cinlp_->getNumCols();
734 int numIntAtBound = 0;
741 int currentIndex = 0;
744 bool boundsChanged =
false;
745 std::vector<int> previousBranches;
747 double avgBound = 0.0;
750 if (numIntAtBound >= 50 ||
753 writeLB(lbcut1, solution,
'L', lbrhs + floor(avgBound - 0.5));
754 lbcuts.insert(lbcut1);
755 writeLB(lbcut2, solution,
'G', 1);
756 lbcuts.insert(lbcut2);
761 nlp_->applyCuts(lbcuts);
791 if (numIntAtBound > 0){
802 if (obj == COIN_DBL_MAX || obj >= objectiveValue -
COUENNE_EPS){
803 std::cout <<
" IR: no improvement possible " << std::endl;
804 std::cout <<
" IR: elapsed time " << CoinCpuTime()-
startTime_ << std::endl;
808 double* xprime =
new double [
n];
816 double constrElem[2];
819 bool foundSolution =
false;
820 double* tmpSolution =
new double[
n];
822 OsiSolverInterface* curr_milp =
milp_;
830 for (
int i = 0; i <
n; i++){
835 cut.mutableRow().setVector(2, constrInd, constrElem);
836 cut.setLb(-COIN_DBL_MAX);
837 cut.setUb(-xprime[i]);
841 cut.mutableRow().setVector(2, constrInd, constrElem);
842 cut.setLb(-COIN_DBL_MAX);
843 cut.setUb(xprime[i]);
846 curr_milp->applyCuts(cs);
852 curr_milp->applyCuts(revlb_all);
855 if (!solFound && !boundsChanged){
856 std::cout <<
" MILP cannot be solved, terminating LB " << std::endl;
860 delete[] tmpSolution;
865 std::cout <<
" IR: elapsed time " << CoinCpuTime()-
startTime_ << std::endl;
866 return foundSolution;
868 else if (!solFound && boundsChanged){
874 branchToCut(tmpSolution, curr_milp, previousBranches);
877 const double * xtilde = curr_milp->getColSolution();
881 CoinCopyN (xtilde, n, tmpSolution);
882 for (
int i = 0; i < nNlp; ++i){
883 if (model_->isInteger(i)){
884 tmpSolution[i] = floor(tmpSolution[i]+0.5);
885 cinlp_->setColLower(i, tmpSolution[i]);
886 cinlp_->setColUpper(i, tmpSolution[i]);
889 cinlp_->setColSolution(tmpSolution);
891 cinlp_->messageHandler()->setLogLevel(1);
893 obj = ((
cinlp_->isProvenOptimal()) ?
cinlp_->getObjValue():COIN_DBL_MAX);
894 memcpy(tmpSolution,
cinlp_->getColSolution(),
895 nNlp*
sizeof(double));
899 bool isChecked =
false;
901 isChecked =
couenne_ -> checkNLP0 (tmpSolution, obj,
true,
918 if (
cinlp_->isProvenOptimal () &&
923 #ifdef FM_TRACE_OPTSOL
935 #ifdef FM_TRACE_OPTSOL
948 std::cout <<
"Final Nlp solution with objective " << obj <<
" :" << std::endl;
951 std::cout <<
"New incumbent found" << std::endl;
953 *lb = solver -> getColLower (),
954 *ub = solver -> getColUpper ();
958 for (
int i=0; i <
n; ++i, ++lb, ++ub) {
960 if (t < *lb) t = *lb;
961 else if (t > *ub) t = *ub;
965 foundSolution =
true;
966 objectiveValue = obj;
967 CoinCopyN (tmpSolution, n, newSolution);
973 delete[] tmpSolution;
980 std::cout <<
"IR: Heuristic: " << objectiveValue << std::endl;
981 std::cout <<
"IR: Heuristic time: " << elapsed << std::endl;
982 return foundSolution;
989 if (numIntAtBound >= 50 ||
993 avgBound = floor(avgBound + 0.5);
994 std::cout <<
"Using reverse LB with rhs " << avgBound << std::endl;
995 writeLB(cut, xtilde,
'G', avgBound);
996 revlb_all.insert(cut);
1001 boundsChanged =
true;
1007 delete[] tmpSolution;
1014 std::cout <<
"IR: Heuristic time: " << elapsed << std::endl;
1015 return foundSolution;
1020 int numIntAtBound = 0;
1027 return numIntAtBound;
1032 double& avgBoundSize){
1033 int numIntAtBound = 0;
1042 avgBoundSize /= numIntAtBound;
1043 return numIntAtBound;
1048 char sense,
double rhs){
1049 cut.mutableRow().clear();
1053 cut.mutableRow().insert(i, -1);
1057 cut.mutableRow().insert(i, 1);
1063 cut.setLb(-COIN_DBL_MAX);
1066 else if (sense ==
'G'){
1068 cut.setUb(COIN_DBL_MAX);
1071 std::cerr <<
"### ERROR: wrong sense of LB constraint" << std::endl;
1079 double start = CoinCpuTime();
1081 OsiCpxSolverInterface * solver =
dynamic_cast<OsiCpxSolverInterface*
>(milp);
1082 CPXENVptr env = solver->getEnvironmentPtr();
1083 CPXLPptr cpxlp = solver->getLpPtr(OsiCpxSolverInterface::KEEPCACHED_ALL);
1085 bool solFound =
false;
1087 while (!solFound && !infeasible && ((CoinCpuTime() - start) < maxTime)){
1088 solver->branchAndBound();
1089 status = CPXgetstat(env, cpxlp);
1090 solFound = ((status == CPXMIP_NODE_LIM_FEAS) ||
1091 (status == CPXMIP_TIME_LIM_FEAS) ||
1092 (status == CPXMIP_MEM_LIM_FEAS) ||
1093 (status == CPXMIP_ABORT_FEAS) ||
1094 (status == CPXMIP_OPTIMAL) ||
1095 (status == CPXMIP_OPTIMAL_TOL) ||
1096 (status == CPXMIP_ABORT_FEAS) ||
1097 (status == CPXMIP_FAIL_FEAS) ||
1098 (status == CPXMIP_FAIL_FEAS_NO_TREE) ||
1099 (status == CPXMIP_FEASIBLE));
1100 infeasible = ((status == CPXMIP_INForUNBD) ||
1101 (status == CPXMIP_OPTIMAL_INFEAS) ||
1102 (status == CPXMIP_INFEASIBLE));
1109 CbcModel cbcModel(*milp);
1115 while ((cbcModel.getSolutionCount() == 0) &&
1116 (!cbcModel.isProvenInfeasible()) &&
1117 (!cbcModel.isProvenDualInfeasible()) &&
1118 (!cbcModel.isAbandoned()) &&
1119 ((CoinCpuTime() - start) < maxTime)){
1120 cbcModel.branchAndBound();
1123 milp = cbcModel.solver();
1124 if (cbcModel.getSolutionCount() > 0){
1133 OsiSolverInterface* solver,
1134 std::vector<int>& previousBranches){
1140 for (
unsigned int i = 0; i < previousBranches.size(); ++i){
1141 if (branch == previousBranches[i]){
1147 previousBranches.push_back(branch);
1153 if (model_->isInteger(i)){
1164 double sample = rand();
1166 solver->setColUpper(branch, x[branch]-1);
1169 solver->setColLower(branch, x[branch]+1);
1176 roptions -> AddStringOption2
1177 (
"iterative_rounding_heuristic",
1178 "Do we use the Iterative Rounding heuristic",
1182 "If enabled, a heuristic based on Iterative Rounding is used "
1183 "to find feasible solutions for the problem. "
1184 "The heuristic may take some time, but usually finds good solutions. "
1185 "Recommended if you want good upper bounds and have Cplex. "
1186 "Not recommended if you do not have Cplex");
1188 roptions -> AddNumberOption
1189 (
"iterative_rounding_time",
1190 "Specify the maximum time allowed for the Iterative Rounding heuristic",
1191 -1,
"Maximum CPU time employed by the Iterative Rounding heuristic; "
1192 "if no solution found in this time, failure is reported. "
1193 "This overrides the CPU time set by Aggressiveness if positive.");
1195 roptions -> AddNumberOption
1196 (
"iterative_rounding_time_firstcall",
1197 "Specify the maximum time allowed for the Iterative Rounding heuristic "
1198 "when no feasible solution is known",
1199 -1,
"Maximum CPU time employed by the Iterative Rounding heuristic "
1200 "when no solution is known; if no solution found in this time, "
1201 "failure is reported."
1202 "This overrides the CPU time set by Aggressiveness if posive.");
1204 roptions -> AddBoundedIntegerOption
1205 (
"iterative_rounding_aggressiveness",
1206 "Aggressiveness of the Iterative Rounding heuristic",
1208 "Set the aggressiveness of the heuristic; i.e., how many iterations "
1209 "should be run, and with which parameters. The maximum time can be "
1210 "overridden by setting the _time and _time_firstcall options. "
1211 "0 = non aggressive, 1 = standard (default), 2 = aggressive.");
1213 roptions -> AddLowerBoundedIntegerOption
1214 (
"iterative_rounding_num_fir_points",
1215 "Max number of points rounded at the beginning of Iterative Rounding",
1217 "Number of different points (obtained solving a log-barrier problem) "
1218 "that the heuristic will try to round at most, during its execution "
1219 "at the root node (i.e. the F-IR heuristic). Default 5.");
1221 roptions -> AddBoundedNumberOption
1222 (
"iterative_rounding_omega",
1223 "Omega parameter of the Iterative Rounding heuristic",
1224 0,
true, 1,
true, 0.2,
1225 "Set the omega parameter of the heuristic, which represents a "
1226 "multiplicative factor for the minimum log-barrier parameter "
1227 "of the NLP which is solved to obtain feasible points. This "
1228 "corresponds to $\\omega'$ in the paper. Default 0.2.");
1230 roptions -> AddLowerBoundedIntegerOption
1231 (
"iterative_rounding_base_lbrhs",
1232 "Base rhs of the local branching constraint for Iterative Rounding",
1234 "Base rhs for the local branching constraint that defines a "
1235 "neighbourhood of the local incumbent. The base rhs is modified by "
1236 "the algorithm according to variable bounds. This corresponds to "
1237 "k' in the paper. Default 15.");
CouenneIterativeRounding()
Default constructor.
CouenneIterativeRounding & operator=(const CouenneIterativeRounding &rhs)
Assignment operator.
int nVars() const
Total number of variables.
virtual bool isAbandoned() const
Are there a numerical difficulties?
An iterative rounding heuristic, tailored for nonconvex MINLPs.
Ipopt::SmartPtr< Ipopt::Journalist > journalist()
Get a pointer to a journalist.
void update(const double *givenSol, const int givenCard, const double givenVal, const double givenMaxViol)
double maxTime_
Max CPU time to run the heuristic.
const Ipopt::SmartPtr< Ipopt::OptionsList > options() const
Retrieve OsiTMINLPApplication option list.
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
double endTime_
Maximum allowed time for current run.
int numIntegers_
Number of integer variables in the original model.
virtual bool isInteger(int columnNumber) const
Return true if column is integer.
OsiSolverInterface * clone(bool copyData=true) const
Virtual copy constructor.
void setMaxRoundingIter(int value)
Set maximum number of iterations for each rounding phase.
virtual void deleteRows(const int num, const int *rowIndices)
We have to keep this but it will throw an error.
virtual int getNumRows() const
Get number of rows.
OsiSolverInterface * cinlp_
Pointer to the original NLP solver interface.
void use(Ipopt::SmartPtr< TMINLP2TNLP > tminlp2tnlp)
Sets the TMINLP2TNLP to be used by the interface.
int branchToCut(const double *x, OsiSolverInterface *solver, std::vector< int > &previousBranches)
Branch on a random variable to cut given solution; returns var index.
void setMaxTimeFirstCall(double value)
Set maximum CPU time for the heuristic at the root node only.
virtual int getNumCols() const
Get number of columns.
virtual double getObjValue() const
Get objective function value (can't use default)
double startTime_
Starting time for the heuristics.
CouNumber getCutOff() const
Get cutoff.
void setMaxTime(double value)
Set maximum CPU time for the heuristic at each node.
From a TMINLP, this class adapts to another TMINLP where the original objective is transformed into a...
const Bonmin::TNLPSolver * solver() const
void setMaxFirPoints(int value)
Set maximum number of points that we try to round in F-IR.
virtual bool isProvenPrimalInfeasible() const
Is primal infeasiblity proven?
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.
double maxTimeFirstCall_
Max CPU time to run the heuristic when no other solution is known.
bool solveMilp(OsiSolverInterface *milp, double maxTime)
Solve the MILP contained in milp to feasibility, or report failure.
void setMilp()
Set the milp solver at the root.
double omega_
Multiplication factor for log barrier parameter in F-IR; see in the paper.
CouenneRecordBestSol * getRecordBestSol() const
returns recorded best solution
double * colLower_
Pointer to original column lower and upper bounds of the reformulated problem, i.e.
virtual void resolve()
Resolve the continuous relaxation after problem modification.
int baseLbRhs_
Base value for the rhs of the local branching constraint it I-IR.
int maxFirPoints_
Maximum number of iterations in the outer loop for feasibility.
void setOmega(double value)
Set the value for omega, the multiplicative factor for the minimum log-barrier parameter mu used by F...
void setNlp(Bonmin::OsiTMINLPInterface *nlp, OsiSolverInterface *cinlp)
Set the minlp solver.
virtual void setColSolution(const double *colsol)
Set the primal solution variable values Set the values for the starting point.
Class for MINLP problems with symbolic information.
bool areEqual(double a, double b)
Check if two double precision numbers are equal, up to some tolerance.
virtual CbcHeuristic * clone() const
Clone.
int feasibilityIR(double &objectiveValue, double *newSolution)
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions >)
initialize options to be read later
virtual bool isProvenDualInfeasible() const
Is dual infeasiblity proven?
void setBaseLbRhs(int value)
Set the base value for the rhs of the local branching constraint in the I-IR heuristic.
CouenneProblem * couenne_
Pointer to a couenne representation of the problem.
U * GetRawPtr(const OSSmartPtr< U > &smart_ptr)
static const int infeasible
This is a derived class fro TMINLP2TNLP to handle adding quadratic cuts.
double CouNumber
main number type in Couenne
double * colLowerNlp_
Pointer to column lower and upper bounds of the original problem, i.e.
const TMINLP * model() const
Ipopt::SmartPtr< const Ipopt::OptionsList > options() const
Get the options (for getting their values).
CbcHeuristic ** heuristics_
Heuristics for the MILP.
bool infeasibleNode()
Say if current node is found feasible by cut generators.
int solution(double &objectiveValue, double *newSolution)
Run heuristic, return 1 if a better solution than the one passed is found and 0 otherwise.
int computeIntAtBound(const double *x)
Compute number of integer variables at one of their bounds at a given point x.
double getFeasTol()
returns feasibility tolerance
virtual void resolveForRobustness(int numretry)
Method to be called when a problem has failed to be solved.
int numInitialRows_
Number of rows in the original convexification.
void setNlpSolution(const double *sol, int numcols, double objValue)
Pass a solution found by an nlp solver.
int numSol_
Number of solutions last time the heuristic was called.
int improvementIR(double &objectiveValue, double *newSolution, const double *startingSolution)
void setAggressiveness(int value)
Set aggressiveness of heuristic.
OsiClpSolverInterface * milp_
Pointer to a milp solver interface.
void writeLB(OsiRowCut &cut, const double *x, char sense, double rhs)
Write down a local branching constraint, as an OsiRowCut.
double * getModSol(const int expectedCard)
void setHasNlpSolution(bool b)
Say if has an nlp solution.
void initialize(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions, Ipopt::SmartPtr< Ipopt::OptionsList > options, Ipopt::SmartPtr< Ipopt::Journalist > journalist, const std::string &prefix, Ipopt::SmartPtr< TMINLP > tminlp)
Facilitator to initialize interface.
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound.
virtual ~CouenneIterativeRounding()
Destructor.
int maxRoundingIter_
Maximum number of iterations in the main loop.
Bonmin class for passing info between components of branch-and-cuts.
Bonmin::OsiTMINLPInterface * nlp_
Pointer to a dynamic nlp solver interface.
void fint fint fint real fint real * x