20 #define THRES_IMPROVED 0
22 using namespace Couenne;
30 bool null_chg_bds = (NULL == chg_bds);
36 for (
int i=0; i <
nVars (); i++)
38 if (
Var (i) -> Multiplicity () > 0) {
56 bool contains_optimum =
false;
59 contains_optimum =
true;
60 for (
int i=0; i <
nVars (); i++)
67 contains_optimum =
false;
82 ntightened = ((nbwtightened > 0) || first) ?
89 nbwtightened = ((ntightened > 0) || ((ntightened==0) && first)) ?
impliedBounds (chg_bds) : 0;
94 if ((ntightened < 0) || (nbwtightened < 0)) {
104 if (contains_optimum) {
105 for (
int i=0; i<
nVars (); i++)
108 printf (
"bound tightening CUTS optimum: x%d [%e,%e] val = %e, violation = %e\n",
112 contains_optimum =
false;
133 }
while (((ntightened > 0) || (nbwtightened > 0)) &&
153 for (
int i = 0,
j =
nVars ();
j--; i++)
154 if (
Var (i) -> Multiplicity () > 0) {
166 if (
Lb (i) >
Ub (i)) {
181 const CglTreeInfo
info,
184 double startTime = CoinCpuTime ();
196 "Feasibility-based Bound Tightening\n");
198 int objInd =
Obj (0) -> Body () -> Index ();
202 if ((objInd >= 0) && babInfo && (babInfo -> babPtr ())) {
204 CouNumber UB = babInfo -> babPtr () -> model (). getObjValue(),
205 LB = babInfo -> babPtr () -> model (). getBestPossibleObjValue (),
206 primal0 =
Ub (objInd),
226 bool retval =
btCore (chg_bds);
245 objind =
Obj (0) -> Body () -> Index ();
260 *
X = psi -> getColSolution (),
261 *
L = psi -> getColLower (),
262 *
U = psi -> getColUpper (),
263 *RC = psi -> getReducedCost ();
266 printf (
"REDUCED COST BT (LB=%g, UB=%g):\n", LB, UB);
267 for (
int i=0,
j=0; i <
nVars (); i++) {
268 if (
Var (i) -> Multiplicity () <= 0)
270 printf (
"%3d %7e [%7e %7e] c %7e ", i, X [i],
L [i],
U [i], RC [i]);
274 printf (
"-----------\n");
277 int ncols = psi -> getNumCols ();
279 for (
int i=0; i<ncols; i++)
281 (
Var (i) -> Multiplicity () > 0)) {
289 #define CLOSE_TO_BOUNDS 1.e-15
300 if (LB + (u-l)*rc > UB) {
303 newUb = !isInt ? newUb : floor (newUb +
COUENNE_EPS);
305 if (newUb <
Ub (i)) {
314 }
else if ((rc <= 0.) &&
317 if (LB - (u-l) * rc > UB) {
321 newLb = !isInt ? newLb : ceil (newLb -
COUENNE_EPS);
323 if (newLb >
Lb (i)) {
335 printf (
"AFTER reduced cost bt:\n");
336 for (
int i=0,
j=0; i <
nVars (); ++i) {
337 if (
Var (i) -> Multiplicity () <= 0)
339 printf (
"%3d [%7e %7e] ", i,
Lb (i),
Ub (i));
343 printf (
"-----------\n");
int impliedBounds(t_chg_bounds *) const
"Backward" bound tightening, aka implied bounds.
int nVars() const
Total number of variables.
double maxCpuTime_
maximum cpu time
int redCostBT(const OsiSolverInterface *psi, t_chg_bounds *chg_bds) const
procedure to strengthen variable bounds.
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
int max_fbbt_iter_
number of FBBT iterations
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
int tightenBounds(t_chg_bounds *) const
"Forward" bound tightening, that is, propagate bound of variable in an expression to the bounds of ...
void setLower(ChangeStatus lower)
#define COUENNE_BOUND_PREC
bool boundTightening(t_chg_bounds *, const CglTreeInfo info, Bonmin::BabInfo *=NULL) const
tighten bounds using propagation, implied bounds and reduced costs
CouNumber getCutOff() const
Get cutoff.
void setUpper(ChangeStatus upper)
ConstJnlstPtr Jnlst() const
Provide Journalist.
bool btCore(t_chg_bounds *chg_bds) const
core of the bound tightening procedure
const Ipopt::EJournalCategory J_BOUNDTIGHTENING(Ipopt::J_USER2)
bool fbbtReachedIterLimit_
true if FBBT exited for iteration limits as opposed to inability to further tighten bounds ...
exprVar * Var(int i) const
Return pointer to i-th variable.
CouNumber * Ub() const
Return vector of upper bounds.
void installCutOff() const
Make cutoff known to the problem.
CouNumber * optimum_
Best solution known to be loaded from file – for testing purposes.
double CouNumber
main number type in Couenne
CouNumber * X() const
Return vector of variables.
JnlstPtr jnlst_
SmartPointer to the Journalist.
CouenneObjective * Obj(int i) const
i-th objective
CouenneBTPerfIndicator * FBBTperfIndicator_
Performance indicator for FBBT – to be moved away from CouenneProblem when we do it with FBBT...
Bonmin class for passing info between components of branch-and-cuts.
void fint fint fint real fint real * x
CouNumber * Lb() const
Return vector of lower bounds.
bool isInteger(CouNumber x)
is this number integer?