4 #include "CoinPragma.hpp"
6 #include "OsiClpSolverInterface.hpp"
22 options->GetIntegerValue(
"ecp_max_rounds_strong",
25 options->GetNumericValue(
"ecp_abs_tol_strong",
28 options->GetNumericValue(
"ecp_rel_tol_strong",
32 options->GetEnumValue(
"lp_strong_warmstart_method",
43 maxCuttingPlaneIterations_(rhs.maxCuttingPlaneIterations_),
44 abs_ecp_tol_(rhs.abs_ecp_tol_),
45 rel_ecp_tol_(rhs.rel_ecp_tol_),
46 warm_start_mode_(rhs.warm_start_mode_)
79 lin_ =
new OsiClpSolverInterface();
82 double cutoff = -DBL_MAX;
83 tminlp_interface->
getDblParam(OsiDualObjectiveLimit, cutoff);
84 lin_->setDblParam(OsiDualObjectiveLimit, cutoff);
86 lin_->messageHandler()->setLogLevel(0);
112 std::vector<int> diff_low_bnd_index;
113 std::vector<double> diff_low_bnd_value;
114 std::vector<int> diff_up_bnd_index;
115 std::vector<double> diff_up_bnd_value;
119 const int numCols = tminlp_interface->
getNumCols();
120 const double* colLow_orig =
lin_->getColLower();
121 const double* colUp_orig =
lin_->getColUpper();
122 const double* colLow = tminlp_interface->
getColLower();
123 const double* colUp = tminlp_interface->
getColUpper();
125 OsiSolverInterface * lin =
lin_;
133 for (
int i=0; i<numCols; i++) {
134 const double& lo = colLow[i];
135 if (colLow_orig[i] < lo) {
137 diff_low_bnd_value.push_back(colLow_orig[i]);
138 diff_low_bnd_index.push_back(i);
140 lin->setColLower(i,lo);
142 const double&
up = colUp[i];
143 if (colUp_orig[i] > up) {
145 diff_up_bnd_index.push_back(i);
146 diff_up_bnd_value.push_back(colUp_orig[i]);
148 lin->setColUpper(i,lo);
153 lin->setWarmStart(
warm_);
158 double obj = lin->getObjValue();
160 if (lin->isProvenPrimalInfeasible() ||
161 lin->isDualObjectiveLimitReached()) {
165 else if (lin->isIterationLimitReached()) {
173 if (obj == COIN_DBL_MAX) {
176 else if (violation <= 1
e-8) {
186 for (
unsigned int i = 0; i < diff_low_bnd_index.size(); i++) {
187 lin_->setColLower(diff_low_bnd_index[i],diff_low_bnd_value[i]);
189 for (
unsigned int i = 0; i < diff_up_bnd_index.size(); i++) {
190 lin_->setColUpper(diff_up_bnd_index[i],diff_up_bnd_value[i]);
203 roptions->AddLowerBoundedIntegerOption
204 (
"ecp_max_rounds_strong",
205 "Set the maximal number of rounds of ECP cuts in strong branching.",
208 roptions->setOptionExtraInfo(
"ecp_max_rounds_strong",63);
209 roptions->AddLowerBoundedNumberOption
210 (
"ecp_abs_tol_strong",
211 "Set the absolute termination tolerance for ECP rounds in strong branching.",
214 roptions->setOptionExtraInfo(
"ecp_abs_tol_strong",63);
215 roptions->AddLowerBoundedNumberOption
216 (
"ecp_rel_tol_strong",
217 "Set the relative termination tolerance for ECP rounds in strong branching.",
220 roptions->setOptionExtraInfo(
"ecp_rel_tol_strong",63);
221 roptions->AddStringOption2
222 (
"lp_strong_warmstart_method",
223 "Choose method to use for warm starting lp in strong branching",
225 "Basis",
"Use optimal basis of node",
226 "Clone",
"Clone optimal problem of node",
228 roptions->setOptionExtraInfo(
"lp_strong_warmstart_method",63);
WarmStartMethod warm_start_mode_
Way problems are warm started.
For undocumented options.
This class is the base class for a solver that can be used in BonOsiSolverInterface to perform the st...
virtual const double * getColLower() const
Get pointer to array[getNumCols()] of column lower bounds.
const TMINLP2TNLP * problem() const
get pointer to the TMINLP2TNLP adapter
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
LpBranchingSolver & operator=(const LpBranchingSolver &rhs)
Assignment operator.
void Set_x_sol(Ipopt::Index n, const Ipopt::Number *x_sol)
Set the contiuous solution.
CoinWarmStart * warm_
Warm start object for linear solver.
void set_obj_value(Ipopt::Number value)
Manually set objective value.
This is a generic class for calling an NLP solver to solve a TNLP.
LpBranchingSolver()
Default Constructor.
double abs_ecp_tol_
absolute tolerance for ECP cuts
virtual int getNumCols() const
Get number of columns.
const Bonmin::TNLPSolver * solver() const
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
int maxCuttingPlaneIterations_
Number of maximal ECP cuts.
void fint fint fint real fint real real real real real real real real real * e
A class to have all elements necessary to setup a branch-and-bound.
double doEcpRounds(OsiSolverInterface &si, bool leaveSiUnchanged, double *violation=NULL)
virtual ~LpBranchingSolver()
Destructor.
Implementation of BonChooseVariable for curvature-based braching.
ReturnStatus
Standard return statuses for a solver.
OsiSolverInterface * lin_
Linear solver.
const char * prefix() const
Default Constructor.
StrongBranchingSolver & operator=(const StrongBranchingSolver &rhs)
Assignment operator.
virtual const double * getColUpper() const
Get pointer to array[getNumCols()] of column upper bounds.
OsiTMINLPInterface * nonlinearSolver()
Pointer to the non-linear solver used.
EcpCuts * ecp_
Ecp cut generate.
virtual void unmarkHotStart(OsiTMINLPInterface *tminlp_interface)
Called after all strong branching solves in a node.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
virtual void extractLinearRelaxation(OsiSolverInterface &si, const double *x, bool getObj=1)
Extract a linear relaxation of the MINLP.
double rel_ecp_tol_
relative tolerance for ECP cuts
virtual void markHotStart(OsiTMINLPInterface *tminlp_interface)
Called to initialize solver before a bunch of strong branching solves.
virtual TNLPSolver::ReturnStatus solveFromHotStart(OsiTMINLPInterface *tminlp_interface)
Called to solve the current TMINLP (with changed bound information)
bool getDblParam(OsiDblParam key, double &value) const