[CP-SAT] fix bug in lb_tree_search

This commit is contained in:
Laurent Perron
2022-09-26 15:37:33 +02:00
parent 500cc2c701
commit 779d5912c5
2 changed files with 12 additions and 0 deletions

View File

@@ -90,6 +90,16 @@ void IntegerSumLE::FillIntegerReason() {
std::pair<IntegerValue, IntegerValue> IntegerSumLE::ConditionalLb(
IntegerLiteral integer_literal, IntegerVariable target_var) const {
// The code below is wrong if integer_literal and target_var are the same.
// In this case we return the trival bounds.
if (PositiveVariable(integer_literal.var) == PositiveVariable(target_var)) {
if (integer_literal.var == target_var) {
return {kMinIntegerValue, integer_literal.bound};
} else {
return {integer_literal.Negated().bound, kMinIntegerValue};
}
}
// Recall that all our coefficient are positive.
bool literal_var_present = false;
bool literal_var_present_positively = false;