@@ -46,6 +46,14 @@ static double activityContributionMax(double coef, const double& lb,
4646 }
4747}
4848
49+ static inline double boundRange (double upper_bound, double lower_bound,
50+ double tolerance, HighsVarType var_type) {
51+ double range = upper_bound - lower_bound;
52+ return range - (var_type == HighsVarType::kContinuous
53+ ? std::max (0.3 * range, 1000.0 * tolerance)
54+ : tolerance);
55+ }
56+
4957HighsDomain::HighsDomain (HighsMipSolver& mipsolver) : mipsolver(&mipsolver) {
5058 col_lower_ = mipsolver.model_ ->col_lower_ ;
5159 col_upper_ = mipsolver.model_ ->col_upper_ ;
@@ -369,14 +377,11 @@ void HighsDomain::CutpoolPropagation::recomputeCapacityThreshold(HighsInt cut) {
369377 if (domain->col_upper_ [arindex[i]] == domain->col_lower_ [arindex[i]])
370378 continue ;
371379
372- double boundRange =
373- domain->col_upper_ [arindex[i]] - domain->col_lower_ [arindex[i]];
374-
375- boundRange -= domain->variableType (arindex[i]) == HighsVarType::kContinuous
376- ? std::max (0.3 * boundRange, 1000.0 * domain->feastol ())
377- : domain->feastol ();
378-
379- double threshold = std::fabs (arvalue[i]) * boundRange;
380+ double threshold =
381+ std::fabs (arvalue[i]) * boundRange (domain->col_upper_ [arindex[i]],
382+ domain->col_lower_ [arindex[i]],
383+ domain->feastol (),
384+ domain->variableType (arindex[i]));
380385
381386 capacityThreshold_[cut] =
382387 std::max ({capacityThreshold_[cut], threshold, domain->feastol ()});
@@ -780,24 +785,23 @@ void HighsDomain::ObjectivePropagation::recomputeCapacityThreshold() {
780785 for (HighsInt i = partitionStarts[numPartitions]; i < numObjNzs; ++i) {
781786 HighsInt col = objNonzeros[i];
782787
783- double boundRange = (domain->col_upper_ [col] - domain->col_lower_ [col]);
784- boundRange -= domain->variableType (col) == HighsVarType::kContinuous
785- ? std::max (0.3 * boundRange, 1000.0 * domain->feastol ())
786- : domain->feastol ();
787- capacityThreshold =
788- std::max (capacityThreshold, std::fabs (cost[col]) * boundRange);
788+ capacityThreshold = std::max (
789+ capacityThreshold,
790+ std::fabs (cost[col]) *
791+ boundRange (domain->col_upper_ [col], domain->col_lower_ [col],
792+ domain->feastol (), domain->variableType (col)));
789793 }
790794}
791795
792796void HighsDomain::ObjectivePropagation::updateActivityLbChange (
793797 HighsInt col, double oldbound, double newbound) {
794798 if (cost[col] <= 0.0 ) {
795799 if (cost[col] != 0.0 && newbound < oldbound) {
796- double boundRange = domain-> col_upper_ [col] - newbound;
797- boundRange -= domain-> variableType (col) == HighsVarType:: kContinuous
798- ? std::max ( 0.3 * boundRange, 1000.0 * domain->feastol ())
799- : domain->feastol ();
800- capacityThreshold = std::max (capacityThreshold, -cost[col] * boundRange );
800+ capacityThreshold =
801+ std::max (capacityThreshold,
802+ -cost[col] * boundRange ( domain->col_upper_ [col], newbound,
803+ domain->feastol (),
804+ domain-> variableType (col)) );
801805 isPropagated = false ;
802806 }
803807 debugCheckObjectiveLower ();
@@ -821,11 +825,11 @@ void HighsDomain::ObjectivePropagation::updateActivityLbChange(
821825 debugCheckObjectiveLower ();
822826
823827 if (newbound < oldbound) {
824- double boundRange = (domain-> col_upper_ [col] - domain-> col_lower_ [col]);
825- boundRange -= domain-> variableType (col) == HighsVarType:: kContinuous
826- ? std::max ( 0.3 * boundRange, 1000.0 * domain->feastol ())
827- : domain->feastol ();
828- capacityThreshold = std::max (capacityThreshold, cost[col] * boundRange );
828+ capacityThreshold = std::max (
829+ capacityThreshold,
830+ cost[col] * boundRange ( domain->col_upper_ [col],
831+ domain->col_lower_ [col], domain-> feastol (),
832+ domain-> variableType (col)) );
829833 } else if (numInfObjLower == 0 &&
830834 objectiveLower > domain->mipsolver ->mipdata_ ->upper_limit ) {
831835 domain->infeasible_ = true ;
@@ -914,11 +918,10 @@ void HighsDomain::ObjectivePropagation::updateActivityUbChange(
914918 HighsInt col, double oldbound, double newbound) {
915919 if (cost[col] >= 0.0 ) {
916920 if (cost[col] != 0.0 && newbound > oldbound) {
917- double boundRange = newbound - domain->col_lower_ [col];
918- boundRange -= domain->variableType (col) == HighsVarType::kContinuous
919- ? std::max (0.3 * boundRange, 1000.0 * domain->feastol ())
920- : domain->feastol ();
921- capacityThreshold = std::max (capacityThreshold, cost[col] * boundRange);
921+ capacityThreshold = std::max (
922+ capacityThreshold,
923+ cost[col] * boundRange (newbound, domain->col_lower_ [col],
924+ domain->feastol (), domain->variableType (col)));
922925 isPropagated = false ;
923926 }
924927 debugCheckObjectiveLower ();
@@ -942,11 +945,11 @@ void HighsDomain::ObjectivePropagation::updateActivityUbChange(
942945 debugCheckObjectiveLower ();
943946
944947 if (newbound > oldbound) {
945- double boundRange = (domain-> col_upper_ [col] - domain-> col_lower_ [col]);
946- boundRange -= domain-> variableType (col) == HighsVarType:: kContinuous
947- ? std::max ( 0.3 * boundRange, 1000.0 * domain->feastol ())
948- : domain->feastol ();
949- capacityThreshold = std::max (capacityThreshold, -cost[col] * boundRange );
948+ capacityThreshold = std::max (
949+ capacityThreshold,
950+ -cost[col] * boundRange ( domain->col_upper_ [col],
951+ domain->col_lower_ [col], domain-> feastol (),
952+ domain-> variableType (col)) );
950953 } else if (numInfObjLower == 0 &&
951954 objectiveLower > domain->mipsolver ->mipdata_ ->upper_limit ) {
952955 domain->infeasible_ = true ;
@@ -1362,7 +1365,7 @@ double HighsDomain::adjustedUb(HighsInt col, HighsCDouble boundVal,
13621365 double bound;
13631366
13641367 if (mipsolver->variableType (col) != HighsVarType::kContinuous ) {
1365- bound = std::floor ( double (boundVal + mipsolver->mipdata_ ->feastol ));
1368+ bound = static_cast < double >( floor (boundVal + mipsolver->mipdata_ ->feastol ));
13661369 if (bound < col_upper_[col] &&
13671370 col_upper_[col] - bound >
13681371 1000.0 * mipsolver->mipdata_ ->feastol * std::fabs (bound))
@@ -1397,7 +1400,7 @@ double HighsDomain::adjustedLb(HighsInt col, HighsCDouble boundVal,
13971400 double bound;
13981401
13991402 if (mipsolver->variableType (col) != HighsVarType::kContinuous ) {
1400- bound = std::ceil ( double (boundVal - mipsolver->mipdata_ ->feastol ));
1403+ bound = static_cast < double >( ceil (boundVal - mipsolver->mipdata_ ->feastol ));
14011404 if (bound > col_lower_[col] &&
14021405 bound - col_lower_[col] >
14031406 1000.0 * mipsolver->mipdata_ ->feastol * std::fabs (bound))
@@ -1517,14 +1520,10 @@ HighsInt HighsDomain::propagateRowLower(const HighsInt* Rindex,
15171520void HighsDomain::updateThresholdLbChange (HighsInt col, double newbound,
15181521 double val, double & threshold) {
15191522 if (newbound != col_upper_[col]) {
1520- double boundRange = (col_upper_[col] - newbound);
1521-
1522- boundRange -=
1523- variableType (col) == HighsVarType::kContinuous
1524- ? std::max (0.3 * boundRange, 1000.0 * mipsolver->mipdata_ ->feastol )
1525- : mipsolver->mipdata_ ->feastol ;
1526-
1527- double thresholdNew = std::fabs (val) * boundRange;
1523+ double thresholdNew =
1524+ std::fabs (val) * boundRange (col_upper_[col], newbound,
1525+ mipsolver->mipdata_ ->feastol ,
1526+ variableType (col));
15281527
15291528 // the new threshold is now the maximum of the new threshold and the current
15301529 // one
@@ -1536,14 +1535,10 @@ void HighsDomain::updateThresholdLbChange(HighsInt col, double newbound,
15361535void HighsDomain::updateThresholdUbChange (HighsInt col, double newbound,
15371536 double val, double & threshold) {
15381537 if (newbound != col_lower_[col]) {
1539- double boundRange = (newbound - col_lower_[col]);
1540-
1541- boundRange -=
1542- variableType (col) == HighsVarType::kContinuous
1543- ? std::max (0.3 * boundRange, 1000.0 * mipsolver->mipdata_ ->feastol )
1544- : mipsolver->mipdata_ ->feastol ;
1545-
1546- double thresholdNew = std::fabs (val) * boundRange;
1538+ double thresholdNew =
1539+ std::fabs (val) * boundRange (newbound, col_lower_[col],
1540+ mipsolver->mipdata_ ->feastol ,
1541+ variableType (col));
15471542
15481543 // the new threshold is now the maximum of the new threshold and the current
15491544 // one
@@ -1908,13 +1903,9 @@ void HighsDomain::recomputeCapacityThreshold(HighsInt row) {
19081903
19091904 if (col_upper_[col] == col_lower_[col]) continue ;
19101905
1911- double boundRange = col_upper_[col] - col_lower_[col];
1912-
1913- boundRange -= variableType (col) == HighsVarType::kContinuous
1914- ? std::max (0.3 * boundRange, 1000.0 * feastol ())
1915- : feastol ();
1916-
1917- double threshold = std::fabs (mipsolver->mipdata_ ->ARvalue_ [i]) * boundRange;
1906+ double threshold = std::fabs (mipsolver->mipdata_ ->ARvalue_ [i]) *
1907+ boundRange (col_upper_[col], col_lower_[col], feastol (),
1908+ variableType (col));
19181909
19191910 capacityThreshold_[row] =
19201911 std::max ({capacityThreshold_[row], threshold, feastol ()});
@@ -3037,6 +3028,7 @@ bool HighsDomain::ConflictSet::resolveLinearGeq(HighsCDouble M, double Mupper,
30373028 relaxUb = std::floor (relaxUb);
30383029
30393030 if (relaxUb - ub <= localdom.feastol ()) continue ;
3031+
30403032 locdomchg.domchg .boundval = relaxUb;
30413033
30423034 if (relaxUb - gub >= -localdom.mipsolver ->mipdata_ ->epsilon ) {
0 commit comments