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_;
148 std::vector<IntegerLiteral> tmp_integer_literals_;
156 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>, IntegerValue>
166 std::vector<ImpliedBoundEntry> empty_implied_bounds_;
172 absl::flat_hash_map<LiteralIndex,
173 absl::flat_hash_map<IntegerVariable, IntegerValue>>
174 literal_to_var_to_value_;
175 const absl::flat_hash_map<IntegerVariable, IntegerValue> empty_var_to_value_;
178 int64_t num_deductions_ = 0;
179 int64_t num_enqueued_in_var_to_bounds_ = 0;
189 void Add(IntegerVariable var,
const std::vector<ValueLiteralPair>& encoding,
190 int exactly_one_index);
193 const absl::btree_map<int, std::vector<ValueLiteralPair>>&
Get(
194 IntegerVariable var);
200 absl::btree_map<IntegerVariable,
201 absl::btree_map<int, std::vector<ValueLiteralPair>>>
202 var_to_index_to_element_encodings_;
203 const absl::btree_map<int, std::vector<ValueLiteralPair>>
204 empty_element_encoding_;
205 std::vector<IntegerVariable> element_encoded_variables_;
300 absl::Span<const IntegerVariable> lp_vars,
305 const absl::flat_hash_map<IntegerVariable, std::vector<IntegerVariable>>&
307 return bool_rlt_candidates_;
315 IntegerVariable
b)
const {
316 if (
b < a) std::swap(a,
b);
317 const auto it = bool_rlt_ubs_.find({a,
b});
323 std::array<LiteralIndex, 2> GetKey(LiteralIndex a, LiteralIndex
b)
const;
324 void ProcessNewProduct(LiteralIndex p, LiteralIndex a, LiteralIndex
b);
325 void ProcessNewProduct(IntegerVariable p,
Literal l, IntegerVariable x);
326 void ProcessTernaryClauseForRLT(absl::Span<const Literal> clause);
331 IntegerVariable var1,
double lp1, IntegerVariable var2,
double lp2,
332 IntegerVariable bound_var,
double bound_lp);
336 const bool rlt_enabled_;
350 absl::flat_hash_map<std::array<LiteralIndex, 3>, std::bitset<3>> detector_;
353 absl::flat_hash_map<std::array<LiteralIndex, 2>, std::vector<LiteralIndex>>
357 absl::flat_hash_map<std::array<LiteralIndex, 2>, LiteralIndex> products_;
361 absl::flat_hash_set<std::array<LiteralIndex, 2>> has_product_;
365 absl::flat_hash_set<std::pair<LiteralIndex, IntegerVariable>>
367 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>,
368 std::vector<IntegerVariable>>
369 conditional_equalities_;
372 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>, IntegerVariable>
376 absl::flat_hash_map<IntegerVariable, std::vector<IntegerVariable>>
377 bool_rlt_candidates_;
378 absl::flat_hash_map<std::pair<IntegerVariable, IntegerVariable>,
385 std::vector<IntegerVariable> ternary_clauses_with_view_;
390 int64_t num_products_ = 0;
391 int64_t num_int_products_ = 0;
392 int64_t num_trail_updates_ = 0;
393 int64_t num_processed_binary_ = 0;
394 int64_t num_processed_ternary_ = 0;
395 int64_t num_processed_exo_ = 0;
396 int64_t num_conditional_zeros_ = 0;
397 int64_t num_conditional_equalities_ = 0;
IntegerVariable literal_view
ImpliedBoundEntry(IntegerVariable lit, IntegerValue lb)
These constructors are needed for OR-Tools.