30 bool leaveSiUnchanged,
33 OsiSolverInterface * saveLp =
lp_;
48 const CglTreeInfo
info)
const
51 BabInfo * babInfo =
dynamic_cast<BabInfo *
> (si.getAuxiliaryInfo());
54 const CbcNode * node = babInfo->
babPtr()->
model().currentNode();
55 int level = (node == NULL) ? 0 : babInfo->
babPtr()->
model().currentNode()->depth();
56 double rand = CoinDrand48();
57 double score = pow(2.,-level)*
beta_;
62 double orig_violation =
nlp_->getNonLinearitiesViolation(
63 si.getColSolution(), si.getObjValue());
66 std::cout<<
"Initial Constraint violation: "<<orig_violation<<std::endl;
67 std::cout<<
"Initial objectvie value"<<si.
getObjValue()<<std::endl;
72 std::cout<<
"Generating ECP cuts"<<std::endl;
80 int numberCuts = - cs.sizeRowCuts();
82 si.getColSolution():NULL;
83 const OsiSolverInterface &localSi = (lpManip == NULL) ?
84 si : *(lpManip->
si());
86 numberCuts += cs.sizeRowCuts();
87 if (numberCuts > 0 && i + 1 < numRounds_ ) {
98 std::cerr<<
"Installed "<<numberCuts<<
"cuts in lp"<<std::endl;
100 lpManip->
si()->resolve();
102 std::cerr<<
"New objective "<<lpManip->
si()->getObjValue()<<std::endl;
104 if (lpManip->
si()->isProvenPrimalInfeasible()) {
107 std::cout<<
"Stopping Ecp generation because problem became infeasible"<<std::endl;
112 lpManip->
si()->getColSolution(),
113 lpManip->
si()->getObjValue());
115 std::cout<<
"Constraint violation: "<<
violation_<<std::endl;
123 if (lpManip != NULL) {
124 lpManip->
si()->resolve();
125 if (lpManip->
si()->isProvenPrimalInfeasible())
133 if (
lp_ != NULL && lpManip != NULL) {
140 std::cout<<
"End ecp cut generation"<<std::endl;
149 roptions->AddLowerBoundedIntegerOption(
"filmint_ecp_cuts",
150 "Specify the frequency (in terms of nodes) at which some a la filmint ecp cuts are generated.",
152 "A frequency of 0 amounts to to never solve the NLP relaxation.");
153 roptions->setOptionExtraInfo(
"filmint_ecp_cuts",3);
154 roptions->AddLowerBoundedIntegerOption
156 "Set the maximal number of rounds of ECP cuts.",
159 roptions->setOptionExtraInfo(
"ecp_max_rounds",3);
160 roptions->AddLowerBoundedNumberOption
162 "Set the absolute termination tolerance for ECP rounds.",
165 roptions->setOptionExtraInfo(
"ecp_abs_tol",3);
166 roptions->AddLowerBoundedNumberOption
168 "Set the relative termination tolerance for ECP rounds.",
171 roptions->setOptionExtraInfo(
"ecp_rel_tol",3);
172 roptions->AddNumberOption
173 (
"ecp_probability_factor",
174 "Factor appearing in formula for skipping ECP cuts.",
176 "Choosing -1 disables the skipping.");
177 roptions->setOptionExtraInfo(
"ecp_probability_factor",3);
double violation_
Record NLP infeasibility at final point of Ecp.
Small class to manipulatee various things in an OsiSolverInterface and restore them.
void getOuterApproximation(OsiCuts &cs, int getObj, const double *x2, bool global)
Get the outer approximation constraints at the current optimal point.
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
double abs_violation_tol_
absolute tolerance for NLP constraint violation to stop ECP rounds
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo()) const
Standard cut generation methods.
bool addOnlyViolated_
Add only violated OA inequalities.
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Register ecp cuts options.
OsiSolverInterface * lp_
A linear solver.
double objValue_
Record obj value at final point of Ecp.
void restore()
Restore solver.
virtual double getObjValue() const
Get objective function value (can't use default)
bool global_
Add cuts as global.
void assignLpInterface(OsiSolverInterface *si)
Assign an OsiTMINLPInterface.
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.
void installCuts(OsiSolverInterface &si, const OsiCuts &cs, int numberCuts)
Install cuts in solver.
double rel_violation_tol_
relative tolerance for NLP constraint violation to stop ECP rounds
double doEcpRounds(OsiSolverInterface &si, bool leaveSiUnchanged, double *violation=NULL)
int numRounds_
maximum number of iterations of generation.
Bab * babPtr()
Pointer to the branch-and-bound algorithm (to access CbcModel).
static const int infeasible
bool leaveSiUnchanged_
Wether or not we should remove cuts at the end of the procedure.
double beta_
Factor for probability for skipping cuts.
OsiSolverInterface * si()
Get pointer to solver interface.
Ipopt::SmartPtr< Ipopt::OptionsList > options()
Acces list of Options.
Base class for OA algorithms.
OsiTMINLPInterface * nlp_
Pointer to nlp interface.
const char * prefix() const
Get prefix to use for options.
const CbcModel & model() const
Get cbc model used to solve.
Bonmin class for passing info between components of branch-and-cuts.