1313#include < numeric>
1414
1515#include " lp_data/HConst.h"
16- #include " lp_data/HighsModelUtils.h" // For debugging
16+ #include " lp_data/HighsModelUtils.h" // For debugging #2001
1717#include " lp_data/HighsOptions.h"
1818#include " util/HighsCDouble.h"
1919#include " util/HighsUtils.h"
@@ -1355,10 +1355,7 @@ void HighsPostsolveStack::DuplicateColumn::transformToPresolvedSpace(
13551355void HighsPostsolveStack::SlackColSubstitution::undo (
13561356 const HighsOptions& options, const std::vector<Nonzero>& rowValues,
13571357 HighsSolution& solution, HighsBasis& basis) {
1358- // Taken from HighsPostsolveStack::FreeColSubstitution::undo(
1359- //
1360- // a (removed) cut may have been used in this reduction.
1361- //
1358+ bool debug_print = false ;
13621359 // May have to determine row dual and basis status unless doing
13631360 // primal-only transformation in MIP solver, in which case row may
13641361 // no longer exist if it corresponds to a removed cut, so have to
@@ -1382,50 +1379,41 @@ void HighsPostsolveStack::SlackColSubstitution::undo(
13821379 double (rowValue + colCoef * solution.col_value [col]);
13831380
13841381 solution.col_value [col] = double ((rhs - rowValue) / colCoef);
1385- double rowLower = colCoef > 0 ? rhs - colCoef * slackUpper : rhs - colCoef * slackLower;
1386- double rowUpper = colCoef > 0 ? rhs - colCoef * slackLower : rhs - colCoef * slackUpper;
1387-
1388- printf (
1389- " \n HighsPostsolveStack::SlackColSubstitution::undo rowValue = %11.5g; "
1390- " bounds [%11.5g, %11.5g] colCoef = %11.6g\n " ,
1391- double (rowValue), rowLower, rowUpper, colCoef);
1392- printf (
1393- " HighsPostsolveStack::SlackColSubstitution::undo colValue = %11.5g, bounds [%11.5g, %11.5g]\n " ,
1394- solution.col_value [col], slackLower, slackUpper);
13951382
13961383 // If no dual values requested, return here
13971384 if (!solution.dual_valid ) return ;
13981385
13991386 // Row retains its dual value, and column has this dual value scaled by coeff
1400- if (isModelRow) {
1401- solution.col_dual [col] = - solution.row_dual [row] / colCoef;
1402- printf (
1403- " HighsPostsolveStack::SlackColSubstitution::undo rowDual = %11.5g; colDual = %11.5g\n " ,
1404- solution.row_dual [row], solution.col_dual [col]);
1405- }
1387+ if (isModelRow) solution.col_dual [col] = -solution.row_dual [row] / colCoef;
14061388
14071389 // Set basis status if necessary
14081390 if (!basis.valid ) return ;
14091391
1410- // If row is basic, then slack is basic, otherwise row retains its status
1392+ // If row is basic, then slack is basic, otherwise row retains its status
14111393 if (isModelRow) {
14121394 HighsBasisStatus save_row_basis_status = basis.row_status [row];
14131395 if (basis.row_status [row] == HighsBasisStatus::kBasic ) {
14141396 basis.col_status [col] = HighsBasisStatus::kBasic ;
1415- basis.row_status [row] = computeRowStatus (solution.row_dual [row], RowType::kEq );
1397+ basis.row_status [row] =
1398+ computeRowStatus (solution.row_dual [row], RowType::kEq );
14161399 } else if (basis.row_status [row] == HighsBasisStatus::kLower ) {
1417- basis.col_status [col] = colCoef > 0 ? HighsBasisStatus::kUpper : HighsBasisStatus::kLower ;
1400+ basis.col_status [col] =
1401+ colCoef > 0 ? HighsBasisStatus::kUpper : HighsBasisStatus::kLower ;
14181402 } else {
1419- basis.col_status [col] = colCoef > 0 ? HighsBasisStatus::kLower : HighsBasisStatus::kUpper ;
1403+ basis.col_status [col] =
1404+ colCoef > 0 ? HighsBasisStatus::kLower : HighsBasisStatus::kUpper ;
14201405 }
1421- printf (" HighsPostsolveStack::SlackColSubstitution::undo OgRowStatus = %s; "
1422- " RowStatus = %s; ColStatus = %s\n " ,
1423- utilBasisStatusToString (save_row_basis_status).c_str (), utilBasisStatusToString (basis.row_status [row]).c_str (),
1424- utilBasisStatusToString (basis.col_status [col]).c_str ());
1406+ if (debug_print)
1407+ printf (
1408+ " HighsPostsolveStack::SlackColSubstitution::undo OgRowStatus = %s; "
1409+ " RowStatus = %s; ColStatus = %s\n " ,
1410+ utilBasisStatusToString (save_row_basis_status).c_str (),
1411+ utilBasisStatusToString (basis.row_status [row]).c_str (),
1412+ utilBasisStatusToString (basis.col_status [col]).c_str ());
14251413 if (basis.col_status [col] == HighsBasisStatus::kLower ) {
1426- assert (solution.col_dual [col] > 0 );
1414+ assert (solution.col_dual [col] > -options. dual_feasibility_tolerance );
14271415 } else if (basis.col_status [col] == HighsBasisStatus::kUpper ) {
1428- assert (solution.col_dual [col] < 0 );
1416+ assert (solution.col_dual [col] < options. dual_feasibility_tolerance );
14291417 }
14301418 } else {
14311419 basis.col_status [col] = HighsBasisStatus::kNonbasic ;
0 commit comments