9 #ifndef BonminOuterApprox_H
10 #define BonminOuterApprox_H
15 class OsiTMINLPInterface;
18 class OsiSolverInterface;
54 OsiSolverInterface *si,
55 const double *
x,
bool getObj);
58 OsiSolverInterface *si,
59 const double *
x,
bool getObj){
64 inline bool cleanNnz(
double &value,
double colLower,
double colUpper,
65 double rowLower,
double rowUpper,
double colsol,
66 double & lb,
double &ub,
double tiny,
double veryTiny);
79 double rowLower,
double rowUpper,
double colsol,
80 double & lb,
double &ub,
double tiny,
double veryTiny)
82 if(fabs(value)>= tiny)
return 1;
84 if(fabs(value)<veryTiny)
return 0;
88 bool colUpBounded = colUpper < 10000;
89 bool colLoBounded = colLower > -10000;
90 bool rowNotLoBounded = rowLower <= -
infty;
91 bool rowNotUpBounded = rowUpper >=
infty;
94 if(colLoBounded && pos && rowNotUpBounded) {
95 lb += value * (colsol - colLower);
99 if(colLoBounded && !pos && rowNotLoBounded) {
100 ub += value * (colsol - colLower);
104 if(colUpBounded && !pos && rowNotUpBounded) {
105 lb += value * (colsol - colUpper);
109 if(colUpBounded && pos && rowNotLoBounded) {
110 ub += value * (colsol - colUpper);
114 if(pos) value = tiny;
pos
position where the operator should be printed when printing the expression
bool cleanNnz(double &value, double colLower, double colUpper, double rowLower, double rowUpper, double colsol, double &lb, double &ub, double tiny, double veryTiny)
Facilitator to clean up coefficient.
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
~OuterApprox()
Destructor.
OuterApprox()
Default constructor.
A class to build outer approximations.
void extractLinearRelaxation(Bonmin::OsiTMINLPInterface &minlp, OsiSolverInterface *si, const double *x, bool getObj)
Build the Outer approximation in minlp and put it in si.
OuterApprox(const OuterApprox &other)
Copy constructor.
A class to have all elements necessary to setup a branch-and-bound.
void initialize(Bonmin::BabSetupBase &b)
Initialize using options.
OuterApprox & operator=(const OuterApprox &rhs)
Assignment operator.
double tiny_
If constraint coefficient is below this, we try to remove it.
double veryTiny_
If constraint coefficient is below this, we neglect it.
static int nTimesCalled
Count the number of linear outer approximations taken.
void operator()(Bonmin::OsiTMINLPInterface &minlp, OsiSolverInterface *si, const double *x, bool getObj)
Operator() calls extractLinearRelaxation.
void fint fint fint real fint real * x