fix glop status

This commit is contained in:
Laurent Perron
2020-08-17 18:06:14 +02:00
parent 788c5f2ad1
commit b8a1ab7dc0
2 changed files with 10 additions and 8 deletions

View File

@@ -655,7 +655,10 @@ bool LPSolver::IsProblemSolutionConsistent(
++num_basic_variables;
break;
case ConstraintStatus::FIXED_VALUE:
if (lb != ub) {
// Exactly the same remark as for the VariableStatus::FIXED_VALUE case
// above. Because of precision error, this can happen when the
// difference between the two bounds is small and not just exactly zero.
if (ub - lb > 1e-12) {
LogConstraintStatusError(row, status, lb, ub);
return false;
}

View File

@@ -2026,10 +2026,9 @@ void RevisedSimplex::DualPhaseIUpdatePriceOnReducedCostChange(
for (ColIndex col : cols) {
const Fractional reduced_cost = reduced_costs[col];
const Fractional sign =
(can_increase.IsSet(col) && reduced_cost < -tolerance)
? 1.0
: (can_decrease.IsSet(col) && reduced_cost > tolerance) ? -1.0
: 0.0;
(can_increase.IsSet(col) && reduced_cost < -tolerance) ? 1.0
: (can_decrease.IsSet(col) && reduced_cost > tolerance) ? -1.0
: 0.0;
if (sign != dual_infeasibility_improvement_direction_[col]) {
if (sign == 0.0) {
--num_dual_infeasible_positions_;
@@ -2275,9 +2274,9 @@ Status RevisedSimplex::UpdateAndPivot(ColIndex entering_col,
const VariableStatus leaving_variable_status =
lower_bound_[leaving_col] == upper_bound_[leaving_col]
? VariableStatus::FIXED_VALUE
: target_bound == lower_bound_[leaving_col]
? VariableStatus::AT_LOWER_BOUND
: VariableStatus::AT_UPPER_BOUND;
: target_bound == lower_bound_[leaving_col]
? VariableStatus::AT_LOWER_BOUND
: VariableStatus::AT_UPPER_BOUND;
if (variable_values_.Get(leaving_col) != target_bound) {
ratio_test_stats_.bound_shift.Add(variable_values_.Get(leaving_col) -
target_bound);