92 : parameters_(*model->GetOrCreate<SatParameters>()),
93 sat_solver_(model->GetOrCreate<
SatSolver>()),
119 const std::vector<ImpliedBoundEntry>&
GetImpliedBounds(IntegerVariable var);
125 return has_implied_bounds_.PositionsSetAtLeastOnce();
131 const auto it = literal_to_var_to_value_.find(literal.
Index());
132 return it != literal_to_var_to_value_.end() ? it->second
133 : empty_var_to_value_;
142 const SatParameters& parameters_;
149 std::vector<IntegerLiteral> tmp_integer_literals_;
157 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>, IntegerValue>
167 std::vector<ImpliedBoundEntry> empty_implied_bounds_;
173 absl::flat_hash_map<LiteralIndex,
174 absl::flat_hash_map<IntegerVariable, IntegerValue>>
175 literal_to_var_to_value_;
176 const absl::flat_hash_map<IntegerVariable, IntegerValue> empty_var_to_value_;
179 int64_t num_deductions_ = 0;
180 int64_t num_enqueued_in_var_to_bounds_ = 0;
190 void Add(IntegerVariable var,
const std::vector<ValueLiteralPair>& encoding,
191 int exactly_one_index);
194 const absl::btree_map<int, std::vector<ValueLiteralPair>>&
Get(
195 IntegerVariable var);
201 absl::btree_map<IntegerVariable,
202 absl::btree_map<int, std::vector<ValueLiteralPair>>>
203 var_to_index_to_element_encodings_;
204 const absl::btree_map<int, std::vector<ValueLiteralPair>>
205 empty_element_encoding_;
206 std::vector<IntegerVariable> element_encoded_variables_;
301 absl::Span<const IntegerVariable> lp_vars,
306 const absl::flat_hash_map<IntegerVariable, std::vector<IntegerVariable>>&
308 return bool_rlt_candidates_;
316 IntegerVariable
b)
const {
317 if (
b < a) std::swap(a,
b);
318 const auto it = bool_rlt_ubs_.find({a,
b});
324 std::array<LiteralIndex, 2> GetKey(LiteralIndex a, LiteralIndex
b)
const;
325 void ProcessNewProduct(LiteralIndex p, LiteralIndex a, LiteralIndex
b);
326 void ProcessNewProduct(IntegerVariable p,
Literal l, IntegerVariable x);
327 void ProcessTernaryClauseForRLT(absl::Span<const Literal> clause);
332 IntegerVariable var1,
double lp1, IntegerVariable var2,
double lp2,
333 IntegerVariable bound_var,
double bound_lp);
337 const bool rlt_enabled_;
351 absl::flat_hash_map<std::array<LiteralIndex, 3>, std::bitset<3>> detector_;
354 absl::flat_hash_map<std::array<LiteralIndex, 2>, std::vector<LiteralIndex>>
358 absl::flat_hash_map<std::array<LiteralIndex, 2>, LiteralIndex> products_;
362 absl::flat_hash_set<std::array<LiteralIndex, 2>> has_product_;
366 absl::flat_hash_set<std::pair<LiteralIndex, IntegerVariable>>
368 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>,
369 std::vector<IntegerVariable>>
370 conditional_equalities_;
373 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>, IntegerVariable>
377 absl::flat_hash_map<IntegerVariable, std::vector<IntegerVariable>>
378 bool_rlt_candidates_;
379 absl::flat_hash_map<std::pair<IntegerVariable, IntegerVariable>,
386 std::vector<IntegerVariable> ternary_clauses_with_view_;
391 int64_t num_products_ = 0;
392 int64_t num_int_products_ = 0;
393 int64_t num_trail_updates_ = 0;
394 int64_t num_processed_binary_ = 0;
395 int64_t num_processed_ternary_ = 0;
396 int64_t num_processed_exo_ = 0;
397 int64_t num_conditional_zeros_ = 0;
398 int64_t num_conditional_equalities_ = 0;
IntegerVariable literal_view
ImpliedBoundEntry(IntegerVariable lit, IntegerValue lb, bool positive)
These constructors are needed for OR-Tools.