14#ifndef OR_TOOLS_SAT_IMPLIED_BOUNDS_H_
15#define OR_TOOLS_SAT_IMPLIED_BOUNDS_H_
21#include "absl/container/flat_hash_map.h"
120 const auto it = literal_to_var_to_value_.find(
literal.Index());
121 return it != literal_to_var_to_value_.end() ? it->second
122 : empty_var_to_value_;
129 const std::vector<ValueLiteralPair>& encoding,
130 int exactly_one_index);
133 const absl::flat_hash_map<int, std::vector<ValueLiteralPair>>&
159 std::vector<IntegerLiteral> tmp_integer_literals_;
167 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>, IntegerValue>
175 std::vector<ImpliedBoundEntry> empty_implied_bounds_;
183 absl::flat_hash_map<LiteralIndex,
184 absl::flat_hash_map<IntegerVariable, IntegerValue>>
185 literal_to_var_to_value_;
186 const absl::flat_hash_map<IntegerVariable, IntegerValue> empty_var_to_value_;
188 absl::flat_hash_map<IntegerVariable,
189 absl::flat_hash_map<int, std::vector<ValueLiteralPair>>>
190 var_to_index_to_element_encodings_;
191 const absl::flat_hash_map<int, std::vector<ValueLiteralPair>>
192 empty_element_encoding_;
193 std::vector<IntegerVariable> element_encoded_variables_;
201 int64_t num_deductions_ = 0;
202 int64_t num_enqueued_in_var_to_bounds_ = 0;
214 const AffineExpression& right, Model*
model,
215 LinearConstraintBuilder* builder);
221 const std::vector<AffineExpression>& right,
223 std::vector<LinearExpression>* energies);
const std::vector< IntegerType > & PositionsSetAtLeastOnce() const
ImpliedBounds(Model *model)
bool EnqueueNewDeductions()
const std::vector< ImpliedBoundEntry > & GetImpliedBounds(IntegerVariable var)
void AddLiteralImpliesVarEqValue(Literal literal, IntegerVariable var, IntegerValue value)
void NotifyNewIntegerView(Literal literal)
const absl::flat_hash_map< int, std::vector< ValueLiteralPair > > & GetElementEncodings(IntegerVariable var)
void Add(Literal literal, IntegerLiteral integer_literal)
void AddElementEncoding(IntegerVariable var, const std::vector< ValueLiteralPair > &encoding, int exactly_one_index)
const absl::flat_hash_map< IntegerVariable, IntegerValue > & GetImpliedValues(Literal literal) const
const std::vector< IntegerVariable > & VariablesWithImpliedBounds() const
const std::vector< IntegerVariable > & GetElementEncodedVariables() const
void ProcessIntegerTrail(Literal first_decision)
Class that owns everything related to a particular optimization model.
void LinearizeInnerProduct(const std::vector< AffineExpression > &left, const std::vector< AffineExpression > &right, Model *model, std::vector< LinearExpression > *energies)
const IntegerVariable kNoIntegerVariable(-1)
bool ProductIsLinearized(const LinearExpression &expr)
bool DetectLinearEncodingOfProducts(const AffineExpression &left, const AffineExpression &right, Model *model, LinearConstraintBuilder *builder)
Collection of objects used to extend the Constraint Solver library.
ImpliedBoundEntry(IntegerVariable lit, IntegerValue lb, bool positive)
IntegerVariable literal_view