25 VLOG(1) << num_deductions_ <<
" enqueued deductions.";
26 VLOG(1) << bounds_.size() <<
" implied bounds stored.";
27 VLOG(1) << num_enqueued_in_var_to_bounds_
28 <<
" implied bounds with view stored.";
33 const IntegerVariable
var = integer_literal.
var;
36 if (
var >= level_zero_lower_bounds_.
size()) {
38 new_level_zero_bounds_.Resize(
var + 1);
45 if (integer_literal.
bound <= level_zero_lower_bounds_[
var]) {
59 const auto key = std::make_pair(
literal.Index(),
var);
60 auto insert_result = bounds_.insert({key, integer_literal.
bound});
61 if (!insert_result.second) {
62 if (insert_result.first->second < integer_literal.
bound) {
63 insert_result.first->second = integer_literal.
bound;
76 if (it != bounds_.end() && it->second == -integer_literal.
bound) {
88 const auto it = bounds_.find(std::make_pair(
literal.NegatedIndex(),
var));
89 if (it != bounds_.end()) {
90 if (it->second <= level_zero_lower_bounds_[
var]) {
95 const IntegerValue deduction =
105 level_zero_lower_bounds_[
var] = deduction;
106 new_level_zero_bounds_.Set(
var);
108 VLOG(1) <<
"Deduction old: "
115 if (it->second == deduction) {
118 if (integer_literal.
bound == deduction) {
119 bounds_.erase(std::make_pair(
literal.Index(),
var));
141 if (var_to_bounds_.size() <=
var) {
142 var_to_bounds_.resize(
var.value() + 1);
143 has_implied_bounds_.Resize(
var + 1);
145 ++num_enqueued_in_var_to_bounds_;
146 has_implied_bounds_.Set(
var);
148 integer_literal.
bound,
true});
151 if (var_to_bounds_.size() <=
var) {
152 var_to_bounds_.resize(
var.value() + 1);
153 has_implied_bounds_.Resize(
var + 1);
155 ++num_enqueued_in_var_to_bounds_;
156 has_implied_bounds_.Set(
var);
157 var_to_bounds_[
var].push_back(
159 integer_literal.
bound,
false});
164 IntegerVariable
var) {
165 if (
var >= var_to_bounds_.size())
return empty_implied_bounds_;
172 std::vector<ImpliedBoundEntry>& ref = var_to_bounds_[
var];
173 const IntegerValue level_zero_lb =
std::max(
175 level_zero_lower_bounds_[
var] = level_zero_lb;
177 if (entry.lower_bound <= level_zero_lb)
continue;
178 ref[new_size++] = entry;
187 IntegerValue
value) {
199 tmp_integer_literals_.clear();
202 Add(first_decision, lit);
208 for (
const IntegerVariable
var :
209 new_level_zero_bounds_.PositionsSetAtLeastOnce()) {
216 new_level_zero_bounds_.SparseClearAll();
#define CHECK_EQ(val1, val2)
#define DCHECK_GT(val1, val2)
#define VLOG(verboselevel)
void resize(size_type new_size)
bool EnqueueNewDeductions()
const std::vector< ImpliedBoundEntry > & GetImpliedBounds(IntegerVariable var)
void AddLiteralImpliesVarEqValue(Literal literal, IntegerVariable var, IntegerValue value)
void Add(Literal literal, IntegerLiteral integer_literal)
void ProcessIntegerTrail(Literal first_decision)
const IntegerVariable GetLiteralView(Literal lit) const
ABSL_MUST_USE_RESULT bool Enqueue(IntegerLiteral i_lit, absl::Span< const Literal > literal_reason, absl::Span< const IntegerLiteral > integer_reason)
IntegerValue LevelZeroUpperBound(IntegerVariable var) const
IntegerValue LevelZeroLowerBound(IntegerVariable var) const
void AppendNewBounds(std::vector< IntegerLiteral > *output) const
bool IsOptional(IntegerVariable i) const
bool use_implied_bounds() const
int CurrentDecisionLevel() const
constexpr IntegerValue kMinIntegerValue(-kMaxIntegerValue)
const IntegerVariable kNoIntegerVariable(-1)
std::vector< IntegerVariable > NegationOf(const std::vector< IntegerVariable > &vars)
bool VariableIsPositive(IntegerVariable i)
Collection of objects used to extend the Constraint Solver library.
static IntegerLiteral GreaterOrEqual(IntegerVariable i, IntegerValue bound)