14#ifndef OR_TOOLS_SAT_IMPLIED_BOUNDS_H_
15#define OR_TOOLS_SAT_IMPLIED_BOUNDS_H_
22#include "absl/container/flat_hash_map.h"
30#include "ortools/sat/sat_parameters.pb.h"
85 : parameters_(*
model->GetOrCreate<SatParameters>()),
123 const auto it = literal_to_var_to_value_.find(
literal.Index());
124 return it != literal_to_var_to_value_.end() ? it->second
125 : empty_var_to_value_;
132 const std::vector<ValueLiteralPair>& encoding,
133 int exactly_one_index);
136 const absl::flat_hash_map<int, std::vector<ValueLiteralPair>>&
156 const SatParameters& parameters_;
162 std::vector<IntegerLiteral> tmp_integer_literals_;
170 absl::flat_hash_map<std::pair<LiteralIndex, IntegerVariable>, IntegerValue>
178 std::vector<ImpliedBoundEntry> empty_implied_bounds_;
186 absl::flat_hash_map<LiteralIndex,
187 absl::flat_hash_map<IntegerVariable, IntegerValue>>
188 literal_to_var_to_value_;
189 const absl::flat_hash_map<IntegerVariable, IntegerValue> empty_var_to_value_;
191 absl::flat_hash_map<IntegerVariable,
192 absl::flat_hash_map<int, std::vector<ValueLiteralPair>>>
193 var_to_index_to_element_encodings_;
194 const absl::flat_hash_map<int, std::vector<ValueLiteralPair>>
195 empty_element_encoding_;
196 std::vector<IntegerVariable> element_encoded_variables_;
204 int64_t num_deductions_ = 0;
205 int64_t num_enqueued_in_var_to_bounds_ = 0;
217 const AffineExpression& right, Model*
model,
218 LinearConstraintBuilder* builder);
224 const std::vector<AffineExpression>& right,
226 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