Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions highs/mip/HighsDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,12 +730,14 @@ HighsDomain::ObjectivePropagation::ObjectivePropagation(HighsDomain* domain)
if (domain->col_lower_[col] == -kHighsInf)
++numInfObjLower;
else
objectiveLower += domain->col_lower_[col] * cost[col];
objectiveLower +=
static_cast<HighsCDouble>(domain->col_lower_[col]) * cost[col];
} else {
if (domain->col_upper_[col] == kHighsInf)
++numInfObjLower;
else
objectiveLower += domain->col_upper_[col] * cost[col];
objectiveLower +=
static_cast<HighsCDouble>(domain->col_upper_[col]) * cost[col];
}
}

Expand Down Expand Up @@ -845,12 +847,12 @@ void HighsDomain::ObjectivePropagation::updateActivityLbChange(
if (oldbound == -kHighsInf)
--numInfObjLower;
else
objectiveLower -= oldbound * cost[col];
objectiveLower -= static_cast<HighsCDouble>(oldbound) * cost[col];

if (newbound == -kHighsInf)
++numInfObjLower;
else
objectiveLower += newbound * cost[col];
objectiveLower += static_cast<HighsCDouble>(newbound) * cost[col];

debugCheckObjectiveLower();

Expand Down Expand Up @@ -965,12 +967,12 @@ void HighsDomain::ObjectivePropagation::updateActivityUbChange(
if (oldbound == kHighsInf)
--numInfObjLower;
else
objectiveLower -= oldbound * cost[col];
objectiveLower -= static_cast<HighsCDouble>(oldbound) * cost[col];

if (newbound == kHighsInf)
++numInfObjLower;
else
objectiveLower += newbound * cost[col];
objectiveLower += static_cast<HighsCDouble>(newbound) * cost[col];

debugCheckObjectiveLower();

Expand Down Expand Up @@ -1105,18 +1107,19 @@ void HighsDomain::ObjectivePropagation::debugCheckObjectiveLower() const {
HighsInt col = objNonzeros[i];
if (cost[col] > 0) {
if (domain->col_lower_[col] > -kHighsInf)
lowerFromScratch += domain->col_lower_[col] * cost[col];
lowerFromScratch +=
static_cast<HighsCDouble>(domain->col_lower_[col]) * cost[col];
else
++numInf;
} else {
if (domain->col_upper_[col] < kHighsInf)
lowerFromScratch += domain->col_upper_[col] * cost[col];
lowerFromScratch +=
static_cast<HighsCDouble>(domain->col_upper_[col]) * cost[col];
else
++numInf;
}
}
assert(std::fabs(double(lowerFromScratch - objectiveLower)) <=
domain->feastol());
assert(abs(lowerFromScratch - objectiveLower) <= domain->feastol());
assert(numInf == numInfObjLower);
#endif
}
Expand Down
20 changes: 11 additions & 9 deletions highs/presolve/HPresolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2952,7 +2952,8 @@ void HPresolve::substitute(HighsInt row, HighsInt col, double rhs) {

// substitute column in the objective function
if (model->col_cost_[col] != 0.0) {
HighsCDouble objscale = model->col_cost_[col] * substrowscale;
HighsCDouble objscale =
static_cast<HighsCDouble>(model->col_cost_[col]) * substrowscale;
model->offset_ = static_cast<double>(model->offset_ - objscale * rhs);
assert(std::isfinite(model->offset_));
for (HighsInt rowiter : rowpositions) {
Expand All @@ -2967,7 +2968,7 @@ void HPresolve::substitute(HighsInt row, HighsInt col, double rhs) {
}
assert(std::abs(model->col_cost_[col]) <=
std::max(options->dual_feasibility_tolerance,
kHighsTiny * std::abs(static_cast<double>(objscale))));
static_cast<double>(kHighsTiny * abs(objscale))));
model->col_cost_[col] = 0.0;
}

Expand Down Expand Up @@ -5170,7 +5171,7 @@ HPresolve::Result HPresolve::singletonColStuffing(
break;
// compute delta (bound difference)
HighsCDouble delta =
t.multiplier * t.val *
t.multiplier * static_cast<HighsCDouble>(t.val) *
(static_cast<HighsCDouble>(model->col_upper_[t.col]) -
static_cast<HighsCDouble>(model->col_lower_[t.col]));
// check if variable can be fixed
Expand Down Expand Up @@ -7104,10 +7105,12 @@ HPresolve::Result HPresolve::strengthenInequalities(
double ub = model->col_upper_[col] - model->col_lower_[col];
if (weight > 0) {
comp = 1;
maxviolation += model->col_upper_[col] * weight;
maxviolation +=
static_cast<HighsCDouble>(model->col_upper_[col]) * weight;
} else {
comp = -1;
maxviolation += model->col_lower_[col] * weight;
maxviolation +=
static_cast<HighsCDouble>(model->col_lower_[col]) * weight;
weight = -weight;
}

Expand Down Expand Up @@ -7227,16 +7230,15 @@ HPresolve::Result HPresolve::strengthenInequalities(
HighsInt direction) {
for (HighsInt i : indices) {
assert(Arow[positions[i]] == row);
double coefdelta =
direction * static_cast<double>(reducedcost[i] - maxviolation);
HighsCDouble coefdelta = direction * (reducedcost[i] - maxviolation);
HighsInt col = Acol[positions[i]];

if (complementation[i] == -1) {
rhs += coefdelta * model->col_lower_[col];
addToMatrix(row, col, coefdelta);
addToMatrix(row, col, static_cast<double>(coefdelta));
} else {
rhs -= coefdelta * model->col_upper_[col];
addToMatrix(row, col, -coefdelta);
addToMatrix(row, col, static_cast<double>(-coefdelta));
}
}
};
Expand Down
Loading