92 sat_solver_(model->GetOrCreate<
SatSolver>()),
118 const std::vector<ImpliedBoundEntry>&
GetImpliedBounds(IntegerVariable var);
124 return has_implied_bounds_.PositionsSetAtLeastOnce();
130 const auto it = literal_to_var_to_value_.find(literal.
Index());
131 return it != literal_to_var_to_value_.end() ? it->second
132 : empty_var_to_value_;
138 Literal literal, IntegerVariable var)
const {
141 const auto it = bounds_.find({literal.
Index(), var});
142 if (it != bounds_.end()) {
143 result.first = it->second;
146 if (it2 != bounds_.end()) {
147 result.second = -it2->second;
152 const absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>,
171 std::vector<IntegerLiteral> tmp_integer_literals_;
179 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>, IntegerValue>
189 std::vector<ImpliedBoundEntry> empty_implied_bounds_;
195 absl::flat_hash_map<LiteralIndex,
196 absl::flat_hash_map<IntegerVariable, IntegerValue>>
197 literal_to_var_to_value_;
198 const absl::flat_hash_map<IntegerVariable, IntegerValue> empty_var_to_value_;
201 int64_t num_deductions_ = 0;
202 int64_t num_enqueued_in_var_to_bounds_ = 0;
203 int64_t num_promoted_to_equivalence_ = 0;
204 int max_changed_domain_complexity_ = 0;
214 void Add(IntegerVariable var,
const std::vector<ValueLiteralPair>& encoding,
215 int exactly_one_index);
218 const absl::btree_map<int, std::vector<ValueLiteralPair>>&
Get(
219 IntegerVariable var);
225 absl::btree_map<IntegerVariable,
226 absl::btree_map<int, std::vector<ValueLiteralPair>>>
227 var_to_index_to_element_encodings_;
228 const absl::btree_map<int, std::vector<ValueLiteralPair>>
229 empty_element_encoding_;
230 std::vector<IntegerVariable> element_encoded_variables_;
325 absl::Span<const IntegerVariable> lp_vars,
330 const absl::flat_hash_map<IntegerVariable, std::vector<IntegerVariable>>&
332 return bool_rlt_candidates_;
340 IntegerVariable
b)
const {
341 if (
b < a) std::swap(a,
b);
342 const auto it = bool_rlt_ubs_.find({a,
b});
348 std::array<LiteralIndex, 2> GetKey(LiteralIndex a, LiteralIndex
b)
const;
349 void ProcessNewProduct(LiteralIndex p, LiteralIndex a, LiteralIndex
b);
350 void ProcessNewProduct(IntegerVariable p,
Literal l, IntegerVariable x);
351 void ProcessTernaryClauseForRLT(absl::Span<const Literal> clause);
356 IntegerVariable var1,
double lp1, IntegerVariable var2,
double lp2,
357 IntegerVariable bound_var,
double bound_lp);
361 const bool rlt_enabled_;
375 absl::flat_hash_map<std::array<LiteralIndex, 3>, std::bitset<3>> detector_;
378 absl::flat_hash_map<std::array<LiteralIndex, 2>, std::vector<LiteralIndex>>
382 absl::flat_hash_map<std::array<LiteralIndex, 2>, LiteralIndex> products_;
386 absl::flat_hash_set<std::array<LiteralIndex, 2>> has_product_;
390 absl::flat_hash_set<std::pair<LiteralIndex, IntegerVariable>>
392 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>,
393 std::vector<IntegerVariable>>
394 conditional_equalities_;
397 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>, IntegerVariable>
401 absl::flat_hash_map<IntegerVariable, std::vector<IntegerVariable>>
402 bool_rlt_candidates_;
403 absl::flat_hash_map<std::pair<IntegerVariable, IntegerVariable>,
410 std::vector<IntegerVariable> ternary_clauses_with_view_;
415 int64_t num_products_ = 0;
416 int64_t num_int_products_ = 0;
417 int64_t num_trail_updates_ = 0;
418 int64_t num_processed_binary_ = 0;
419 int64_t num_processed_ternary_ = 0;
420 int64_t num_processed_exo_ = 0;
421 int64_t num_conditional_zeros_ = 0;
422 int64_t num_conditional_equalities_ = 0;
IntegerVariable literal_view
ImpliedBoundEntry(IntegerVariable lit, IntegerValue lb)