@@ -60,6 +60,14 @@ static HighsCDouble computeDelta(HighsInt row, double val, double oldbound,
6060 }
6161}
6262
63+ static inline double boundRange (double upper_bound, double lower_bound,
64+ double tolerance, HighsVarType var_type) {
65+ double range = upper_bound - lower_bound;
66+ return range - (var_type == HighsVarType::kContinuous
67+ ? std::max (0.3 * range, 1000.0 * tolerance)
68+ : tolerance);
69+ }
70+
6371HighsDomain::HighsDomain (HighsMipSolver& mipsolver) : mipsolver(&mipsolver) {
6472 col_lower_ = mipsolver.model_ ->col_lower_ ;
6573 col_upper_ = mipsolver.model_ ->col_upper_ ;
@@ -383,14 +391,11 @@ void HighsDomain::CutpoolPropagation::recomputeCapacityThreshold(HighsInt cut) {
383391 if (domain->col_upper_ [arindex[i]] == domain->col_lower_ [arindex[i]])
384392 continue ;
385393
386- double boundRange =
387- domain->col_upper_ [arindex[i]] - domain->col_lower_ [arindex[i]];
388-
389- boundRange -= domain->variableType (arindex[i]) == HighsVarType::kContinuous
390- ? std::max (0.3 * boundRange, 1000.0 * domain->feastol ())
391- : domain->feastol ();
392-
393- double threshold = std::fabs (arvalue[i]) * boundRange;
394+ double threshold =
395+ std::fabs (arvalue[i]) * boundRange (domain->col_upper_ [arindex[i]],
396+ domain->col_lower_ [arindex[i]],
397+ domain->feastol (),
398+ domain->variableType (arindex[i]));
394399
395400 capacityThreshold_[cut] =
396401 std::max ({capacityThreshold_[cut], threshold, domain->feastol ()});
@@ -756,24 +761,23 @@ void HighsDomain::ObjectivePropagation::recomputeCapacityThreshold() {
756761 for (HighsInt i = partitionStarts[numPartitions]; i < numObjNzs; ++i) {
757762 HighsInt col = objNonzeros[i];
758763
759- double boundRange = (domain->col_upper_ [col] - domain->col_lower_ [col]);
760- boundRange -= domain->variableType (col) == HighsVarType::kContinuous
761- ? std::max (0.3 * boundRange, 1000.0 * domain->feastol ())
762- : domain->feastol ();
763- capacityThreshold =
764- std::max (capacityThreshold, std::fabs (cost[col]) * boundRange);
764+ capacityThreshold = std::max (
765+ capacityThreshold,
766+ std::fabs (cost[col]) *
767+ boundRange (domain->col_upper_ [col], domain->col_lower_ [col],
768+ domain->feastol (), domain->variableType (col)));
765769 }
766770}
767771
768772void HighsDomain::ObjectivePropagation::updateActivityLbChange (
769773 HighsInt col, double oldbound, double newbound) {
770774 if (cost[col] <= 0.0 ) {
771775 if (cost[col] != 0.0 && newbound < oldbound) {
772- double boundRange = domain-> col_upper_ [col] - newbound;
773- boundRange -= domain-> variableType (col) == HighsVarType:: kContinuous
774- ? std::max ( 0.3 * boundRange, 1000.0 * domain->feastol ())
775- : domain->feastol ();
776- capacityThreshold = std::max (capacityThreshold, -cost[col] * boundRange );
776+ capacityThreshold =
777+ std::max (capacityThreshold,
778+ -cost[col] * boundRange ( domain->col_upper_ [col], newbound,
779+ domain->feastol (),
780+ domain-> variableType (col)) );
777781 isPropagated = false ;
778782 }
779783 debugCheckObjectiveLower ();
@@ -797,11 +801,11 @@ void HighsDomain::ObjectivePropagation::updateActivityLbChange(
797801 debugCheckObjectiveLower ();
798802
799803 if (newbound < oldbound) {
800- double boundRange = (domain-> col_upper_ [col] - domain-> col_lower_ [col]);
801- boundRange -= domain-> variableType (col) == HighsVarType:: kContinuous
802- ? std::max ( 0.3 * boundRange, 1000.0 * domain->feastol ())
803- : domain->feastol ();
804- capacityThreshold = std::max (capacityThreshold, cost[col] * boundRange );
804+ capacityThreshold = std::max (
805+ capacityThreshold,
806+ cost[col] * boundRange ( domain->col_upper_ [col],
807+ domain->col_lower_ [col], domain-> feastol (),
808+ domain-> variableType (col)) );
805809 } else if (numInfObjLower == 0 &&
806810 objectiveLower > domain->mipsolver ->mipdata_ ->upper_limit ) {
807811 domain->infeasible_ = true ;
@@ -890,11 +894,10 @@ void HighsDomain::ObjectivePropagation::updateActivityUbChange(
890894 HighsInt col, double oldbound, double newbound) {
891895 if (cost[col] >= 0.0 ) {
892896 if (cost[col] != 0.0 && newbound > oldbound) {
893- double boundRange = newbound - domain->col_lower_ [col];
894- boundRange -= domain->variableType (col) == HighsVarType::kContinuous
895- ? std::max (0.3 * boundRange, 1000.0 * domain->feastol ())
896- : domain->feastol ();
897- capacityThreshold = std::max (capacityThreshold, cost[col] * boundRange);
897+ capacityThreshold = std::max (
898+ capacityThreshold,
899+ cost[col] * boundRange (newbound, domain->col_lower_ [col],
900+ domain->feastol (), domain->variableType (col)));
898901 isPropagated = false ;
899902 }
900903 debugCheckObjectiveLower ();
@@ -918,11 +921,11 @@ void HighsDomain::ObjectivePropagation::updateActivityUbChange(
918921 debugCheckObjectiveLower ();
919922
920923 if (newbound > oldbound) {
921- double boundRange = (domain-> col_upper_ [col] - domain-> col_lower_ [col]);
922- boundRange -= domain-> variableType (col) == HighsVarType:: kContinuous
923- ? std::max ( 0.3 * boundRange, 1000.0 * domain->feastol ())
924- : domain->feastol ();
925- capacityThreshold = std::max (capacityThreshold, -cost[col] * boundRange );
924+ capacityThreshold = std::max (
925+ capacityThreshold,
926+ -cost[col] * boundRange ( domain->col_upper_ [col],
927+ domain->col_lower_ [col], domain-> feastol (),
928+ domain-> variableType (col)) );
926929 } else if (numInfObjLower == 0 &&
927930 objectiveLower > domain->mipsolver ->mipdata_ ->upper_limit ) {
928931 domain->infeasible_ = true ;
@@ -1333,7 +1336,7 @@ double HighsDomain::adjustedUb(HighsInt col, HighsCDouble boundVal,
13331336 double bound;
13341337
13351338 if (mipsolver->variableType (col) != HighsVarType::kContinuous ) {
1336- bound = std::floor ( double (boundVal + mipsolver->mipdata_ ->feastol ));
1339+ bound = static_cast < double >( floor (boundVal + mipsolver->mipdata_ ->feastol ));
13371340 accept = bound < col_upper_[col] &&
13381341 col_upper_[col] - bound >
13391342 1000.0 * mipsolver->mipdata_ ->feastol * std::fabs (bound);
@@ -1365,7 +1368,7 @@ double HighsDomain::adjustedLb(HighsInt col, HighsCDouble boundVal,
13651368 double bound;
13661369
13671370 if (mipsolver->variableType (col) != HighsVarType::kContinuous ) {
1368- bound = std::ceil ( double (boundVal - mipsolver->mipdata_ ->feastol ));
1371+ bound = static_cast < double >( ceil (boundVal - mipsolver->mipdata_ ->feastol ));
13691372 accept = bound > col_lower_[col] &&
13701373 bound - col_lower_[col] >
13711374 1000.0 * mipsolver->mipdata_ ->feastol * std::fabs (bound);
@@ -1482,14 +1485,10 @@ HighsInt HighsDomain::propagateRowLower(const HighsInt* Rindex,
14821485void HighsDomain::updateThresholdLbChange (HighsInt col, double newbound,
14831486 double val, double & threshold) {
14841487 if (newbound != col_upper_[col]) {
1485- double boundRange = (col_upper_[col] - newbound);
1486-
1487- boundRange -=
1488- variableType (col) == HighsVarType::kContinuous
1489- ? std::max (0.3 * boundRange, 1000.0 * mipsolver->mipdata_ ->feastol )
1490- : mipsolver->mipdata_ ->feastol ;
1491-
1492- double thresholdNew = std::fabs (val) * boundRange;
1488+ double thresholdNew =
1489+ std::fabs (val) * boundRange (col_upper_[col], newbound,
1490+ mipsolver->mipdata_ ->feastol ,
1491+ variableType (col));
14931492
14941493 // the new threshold is now the maximum of the new threshold and the current
14951494 // one
@@ -1501,14 +1500,10 @@ void HighsDomain::updateThresholdLbChange(HighsInt col, double newbound,
15011500void HighsDomain::updateThresholdUbChange (HighsInt col, double newbound,
15021501 double val, double & threshold) {
15031502 if (newbound != col_lower_[col]) {
1504- double boundRange = (newbound - col_lower_[col]);
1505-
1506- boundRange -=
1507- variableType (col) == HighsVarType::kContinuous
1508- ? std::max (0.3 * boundRange, 1000.0 * mipsolver->mipdata_ ->feastol )
1509- : mipsolver->mipdata_ ->feastol ;
1510-
1511- double thresholdNew = std::fabs (val) * boundRange;
1503+ double thresholdNew =
1504+ std::fabs (val) * boundRange (newbound, col_lower_[col],
1505+ mipsolver->mipdata_ ->feastol ,
1506+ variableType (col));
15121507
15131508 // the new threshold is now the maximum of the new threshold and the current
15141509 // one
@@ -1811,13 +1806,9 @@ void HighsDomain::recomputeCapacityThreshold(HighsInt row) {
18111806
18121807 if (col_upper_[col] == col_lower_[col]) continue ;
18131808
1814- double boundRange = col_upper_[col] - col_lower_[col];
1815-
1816- boundRange -= variableType (col) == HighsVarType::kContinuous
1817- ? std::max (0.3 * boundRange, 1000.0 * feastol ())
1818- : feastol ();
1819-
1820- double threshold = std::fabs (mipsolver->mipdata_ ->ARvalue_ [i]) * boundRange;
1809+ double threshold = std::fabs (mipsolver->mipdata_ ->ARvalue_ [i]) *
1810+ boundRange (col_upper_[col], col_lower_[col], feastol (),
1811+ variableType (col));
18211812
18221813 capacityThreshold_[row] =
18231814 std::max ({capacityThreshold_[row], threshold, feastol ()});
@@ -2940,6 +2931,7 @@ bool HighsDomain::ConflictSet::resolveLinearGeq(HighsCDouble M, double Mupper,
29402931 relaxUb = std::floor (relaxUb);
29412932
29422933 if (relaxUb - ub <= localdom.feastol ()) continue ;
2934+
29432935 locdomchg.domchg .boundval = relaxUb;
29442936
29452937 if (relaxUb - gub >= -localdom.mipsolver ->mipdata_ ->epsilon ) {
0 commit comments