Skip to content

Commit

Permalink
fix more unused-but-set warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
svigerske committed Mar 17, 2023
1 parent b0d9ac2 commit 5f6e048
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
34 changes: 17 additions & 17 deletions Clp/src/ClpPredictorCorrector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3742,29 +3742,29 @@ void ClpPredictorCorrector::debugMove(int /*phase*/,
if (!flagged(iColumn))
primalNew[iColumn] += primalStep * deltaX_[iColumn];
}
CoinWorkDouble quadraticOffset = quadraticDjs(djNew, primalNew, 1.0);
/*CoinWorkDouble quadraticOffset =*/ quadraticDjs(djNew, primalNew, 1.0);
CoinZeroN(errorRegionNew, numberRows_);
CoinZeroN(rhsFixRegionNew, numberRows_);
CoinWorkDouble maximumBoundInfeasibility = 0.0;
CoinWorkDouble maximumDualError = 1.0e-12;
CoinWorkDouble primalObjectiveValue = 0.0;
//CoinWorkDouble primalObjectiveValue = 0.0;
//CoinWorkDouble dualObjectiveValue = 0.0;
CoinWorkDouble solutionNorm = 1.0e-12;
const CoinWorkDouble largeFactor = 1.0e2;
CoinWorkDouble largeGap = largeFactor * solutionNorm_;
if (largeGap < largeFactor) {
largeGap = largeFactor;
}
CoinWorkDouble dualFake = 0.0;
//CoinWorkDouble dualFake = 0.0;
CoinWorkDouble dualTolerance = dblParam_[ClpDualTolerance];
dualTolerance = dualTolerance / scaleFactor_;
if (dualTolerance < 1.0e-12) {
dualTolerance = 1.0e-12;
}
//CoinWorkDouble newGap = 0.0;
CoinWorkDouble offsetObjective = 0.0;
//CoinWorkDouble offsetObjective = 0.0;
CoinWorkDouble gamma2 = gamma_ * gamma_; // gamma*gamma will be added to diagonal
CoinWorkDouble gammaOffset = 0.0;
//CoinWorkDouble gammaOffset = 0.0;
CoinWorkDouble maximumDjInfeasibility = 0.0;
for (iColumn = 0; iColumn < numberTotal; iColumn++) {
if (!flagged(iColumn)) {
Expand Down Expand Up @@ -3800,12 +3800,12 @@ void ClpPredictorCorrector::debugMove(int /*phase*/,
CoinWorkDouble gammaTerm = gamma2;
if (primalR_) {
gammaTerm += primalR_[iColumn];
quadraticOffset += newPrimal * newPrimal * primalR_[iColumn];
//quadraticOffset += newPrimal * newPrimal * primalR_[iColumn];
}
CoinWorkDouble dualInfeasibility = reducedCost - zValue + wValue + gammaTerm * newPrimal;
if (CoinAbs(dualInfeasibility) > dualTolerance) {
dualFake += newPrimal * dualInfeasibility;
}
//if (CoinAbs(dualInfeasibility) > dualTolerance) {
// dualFake += newPrimal * dualInfeasibility;
//}
if (lowerBoundInfeasibility > maximumBoundInfeasibility) {
maximumBoundInfeasibility = lowerBoundInfeasibility;
}
Expand All @@ -3818,10 +3818,10 @@ void ClpPredictorCorrector::debugMove(int /*phase*/,
// reducedCost-zVec_[iColumn]+wVec_[iColumn]+gammaTerm*newPrimal);
maximumDualError = dualInfeasibility;
}
gammaOffset += newPrimal * newPrimal;
//gammaOffset += newPrimal * newPrimal;
djNew[iColumn] = 0.0;
} else {
offsetObjective += primalNew[iColumn] * cost_[iColumn];
//offsetObjective += primalNew[iColumn] * cost_[iColumn];
if (upper_[iColumn] - lower_[iColumn] > 1.0e-5) {
if (primalNew[iColumn] < lower_[iColumn] + 1.0e-8 && djNew[iColumn] < -1.0e-8) {
if (-djNew[iColumn] > maximumDjInfeasibility) {
Expand All @@ -3836,26 +3836,26 @@ void ClpPredictorCorrector::debugMove(int /*phase*/,
}
djNew[iColumn] = primalNew[iColumn];
}
primalObjectiveValue += solution_[iColumn] * cost_[iColumn];
//primalObjectiveValue += solution_[iColumn] * cost_[iColumn];
}
// update rhs region
multiplyAdd(djNew + numberColumns_, numberRows_, -1.0, rhsFixRegionNew, 1.0);
matrix_->times(1.0, djNew, rhsFixRegionNew);
primalObjectiveValue += 0.5 * gamma2 * gammaOffset + 0.5 * quadraticOffset;
//primalObjectiveValue += 0.5 * gamma2 * gammaOffset + 0.5 * quadraticOffset;
//dualObjectiveValue += offsetObjective + dualFake;
//dualObjectiveValue -= 0.5 * gamma2 * gammaOffset + 0.5 * quadraticOffset;
// Need to rethink (but it is only for printing)
//compute error and fixed RHS
multiplyAdd(primalNew + numberColumns_, numberRows_, -1.0, errorRegionNew, 0.0);
matrix_->times(1.0, primalNew, errorRegionNew);
//finish off objective computation
CoinWorkDouble primalObjectiveNew = primalObjectiveValue * scaleFactor_;
//CoinWorkDouble primalObjectiveNew = primalObjectiveValue * scaleFactor_;
//CoinWorkDouble dualValue2 = innerProduct(dualNew, numberRows_, rhsFixRegionNew);
//dualObjectiveValue -= dualValue2;
//CoinWorkDouble dualObjectiveNew=dualObjectiveValue*scaleFactor_;
CoinWorkDouble maximumRHSError1 = 0.0;
CoinWorkDouble maximumRHSError2 = 0.0;
CoinWorkDouble primalOffset = 0.0;
//CoinWorkDouble primalOffset = 0.0;
char *dropped = cholesky_->rowsDropped();
int iRow;
for (iRow = 0; iRow < numberRows_; iRow++) {
Expand All @@ -3868,10 +3868,10 @@ void ClpPredictorCorrector::debugMove(int /*phase*/,
if (CoinAbs(value) > maximumRHSError2) {
maximumRHSError2 = CoinAbs(value);
}
primalOffset += value * dualNew[iRow];
//primalOffset += value * dualNew[iRow];
}
}
primalObjectiveNew -= primalOffset * scaleFactor_;
//primalObjectiveNew -= primalOffset * scaleFactor_;
//CoinWorkDouble maximumRHSError;
if (maximumRHSError1 > maximumRHSError2) {
; //maximumRHSError = maximumRHSError1;
Expand Down
4 changes: 4 additions & 0 deletions Clp/src/ClpSimplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2166,7 +2166,9 @@ int ClpSimplex::housekeeping(double objectiveChange)
int numberFixed = 0;
int numberUnsat = 0;
int numberSat = 0;
#ifdef COIN_DETAILED
double sumUnsat = 0.0;
#endif
double tolerance = 10.0 * primalTolerance_;
double mostAway = 0.0;
for (int i = 0; i < numberColumns_; i++) {
Expand All @@ -2183,7 +2185,9 @@ int ClpSimplex::housekeeping(double objectiveChange)
// problem may be perturbed so relax test
if (fabs(value - closest) > 1.0e-4) {
numberUnsat++;
#ifdef COIN_DETAILED
sumUnsat += fabs(value - closest);
#endif
if (mostAway < fabs(value - closest)) {
mostAway = fabs(value - closest);
}
Expand Down

0 comments on commit 5f6e048

Please sign in to comment.