Skip to content

Commit

Permalink
fix crash in post solve/lns/MIPLIB
Browse files Browse the repository at this point in the history
  • Loading branch information
lperron committed Jul 26, 2019
1 parent a2a1b1d commit 6448bfd
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ortools/sat/cp_model_presolve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,9 @@ void CpModelPresolver::DivideLinearByGcd(ConstraintProto* ct) {
}
const Domain rhs = ReadDomainFromProto(ct->linear());
FillDomainInProto(rhs.InverseMultiplicationBy(gcd), ct->mutable_linear());
if (ct->linear().domain_size() == 0) {
return (void)MarkConstraintAsFalse(ct);
}
}
}

Expand Down Expand Up @@ -3775,11 +3778,15 @@ bool CpModelPresolver::PresolveOneConstraint(int c) {
if (CanonicalizeLinear(ct)) {
context_.UpdateConstraintVariableUsage(c);
}
if (RemoveSingletonInLinear(ct)) {
context_.UpdateConstraintVariableUsage(c);
if (ct->constraint_case() == ConstraintProto::ConstraintCase::kLinear) {
if (RemoveSingletonInLinear(ct)) {
context_.UpdateConstraintVariableUsage(c);
}
}
if (PresolveLinear(ct)) {
context_.UpdateConstraintVariableUsage(c);
if (ct->constraint_case() == ConstraintProto::ConstraintCase::kLinear) {
if (PresolveLinear(ct)) {
context_.UpdateConstraintVariableUsage(c);
}
}
if (ct->constraint_case() == ConstraintProto::ConstraintCase::kLinear) {
if (PresolveLinearOnBooleans(ct)) {
Expand Down

0 comments on commit 6448bfd

Please sign in to comment.