11 #include "CoinHelperFunctions.hpp"
15 using namespace Couenne;
29 objind =
Obj (0) -> Body () -> Index ();
35 *llb =
new double [ncols], *lub =
new double [ncols],
36 *rlb =
new double [ncols], *rub =
new double [ncols],
37 dualBound = objind >= 0 ?
Lb (objind) :
Obj (0) -> Body () -> Value ();
41 Lb (index) =
Ub (index) = floor (xFrac);
52 bool feasLeft =
btCore (f_chg);
54 dualL [index] = dualBound;
57 CoinCopyN (
Lb (), ncols, llb);
58 CoinCopyN (
Ub (), ncols, lub);
61 CoinCopyN (olb, ncols,
Lb ());
62 CoinCopyN (oub, ncols,
Ub ());
66 Lb (index) =
Ub (index) = ceil (xFrac);
68 for (
int j = 0;
j<ncols;
j++) {
76 bool feasRight =
btCore (f_chg);
78 dualR [index] = dualBound;
81 CoinCopyN (
Lb (), ncols, rlb);
82 CoinCopyN (
Ub (), ncols, rub);
85 CoinCopyN (olb, ncols,
Lb ());
86 CoinCopyN (oub, ncols,
Ub ());
108 "test on %d -> Infeasible.\n ", index);
115 "test on %d -> Right feasible, fix to %g.\n", index, ceil (xFrac));
117 fixed [index] =
FIXED;
118 Lb (index) =
Ub (index) = olb [index] = oub [index] = xInt [index] = ceil (xFrac);
124 for (
int j=0;
j<ncols;
j++)
if (index !=
j) {
126 olb [
j] =
Lb (
j) = CoinMax (
Lb (
j), rlb [
j]);
127 oub [
j] =
Ub (j) = CoinMin (
Ub (j), rub [j]);
133 else if (!feasRight) {
137 "test on %d -> Left feasible, fix to %g.\n", index, floor (xFrac));
139 fixed [index] =
FIXED;
140 Lb (index) =
Ub (index) = olb [index] = oub [index] = xInt [index] = floor (xFrac);
146 for (
int j=0;
j<ncols;
j++)
if (index !=
j) {
148 olb [
j] =
Lb (
j) = CoinMax (
Lb (
j), llb [
j]);
149 oub [
j] =
Ub (j) = CoinMin (
Ub (j), lub [j]);
159 for (
int j=0;
j<ncols;
j++) {
161 olb [
j] =
Lb (
j) = CoinMax (
Lb (
j), CoinMin (llb [
j], rlb [j]));
162 oub [
j] =
Ub (j) = CoinMin (
Ub (j), CoinMax (lub [j], rub [j]));
170 if ((retval >= 0) && !patient) {
172 fixed [index] =
FIXED;
174 Lb (index) =
Ub (index) = olb [index] = oub [index] = xInt [index] =
175 ((dualL [index] < dualR [index] -
COUENNE_EPS) ? floor (xFrac) :
176 (dualL [index] > dualR [index] +
COUENNE_EPS) ? ceil (xFrac) :
177 ((CoinDrand48 () < 0.5) ? floor (xFrac) : ceil (xFrac)));
180 "test on %d -> Both feasible, lost patience, fixed to %g.\n",
181 index, xInt [index]);
187 "test on %d -> Both feasible, skip this turn.\n", index);
192 delete [] llb;
delete [] lub;
193 delete [] rlb;
delete [] rub;
int nVars() const
Total number of variables.
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
void setLower(ChangeStatus lower)
void setUpper(ChangeStatus upper)
int testIntFix(int index, CouNumber xFrac, enum fixType *fixed, CouNumber *xInt, CouNumber *dualL, CouNumber *dualR, CouNumber *olb, CouNumber *oub, bool patient) const
Test fixing of an integer variable (used in getIntegerCandidate())
bool btCore(t_chg_bounds *chg_bds) const
core of the bound tightening procedure
CouNumber * Ub() const
Return vector of upper bounds.
double CouNumber
main number type in Couenne
fixType
structure to record fixed, non-fixed, and continuous variables
const Ipopt::EJournalCategory J_NLPHEURISTIC(Ipopt::J_USER5)
JnlstPtr jnlst_
SmartPointer to the Journalist.
CouenneObjective * Obj(int i) const
i-th objective
CouNumber * Lb() const
Return vector of lower bounds.