20#ifndef OR_TOOLS_SAT_ENCODING_H_
21#define OR_TOOLS_SAT_ENCODING_H_
31#include "ortools/sat/boolean_problem.pb.h"
83 int size()
const {
return literals_.size(); }
93 return depth_ > other.depth_ ||
94 (depth_ == other.depth_ && other.for_sorting_ > for_sorting_);
126 int depth()
const {
return depth_; }
128 int lb()
const {
return lb_; }
130 int ub()
const {
return ub_; }
141 BooleanVariable for_sorting_;
151 std::vector<Literal> literals_;
157EncodingNode
LazyMerge(EncodingNode*
a, EncodingNode*
b, SatSolver* solver);
169 EncodingNode*
b, SatSolver* solver);
174 const std::vector<EncodingNode*>&
nodes,
176 std::deque<EncodingNode>* repository);
183 SatSolver* solver, std::deque<EncodingNode>* repository);
190 const std::vector<Literal>& literals,
191 const std::vector<Coefficient>& coeffs,
Coefficient* offset,
192 std::deque<EncodingNode>* repository);
194 const LinearObjective& objective_proto,
Coefficient* offset,
195 std::deque<EncodingNode>* repository);
208 const std::vector<Literal>& core);
219 std::deque<EncodingNode>* repository,
220 std::vector<EncodingNode*>*
nodes, SatSolver* solver);
236 std::deque<EncodingNode>* repository,
237 std::vector<EncodingNode*>*
nodes,
#define CHECK_LT(val1, val2)
#define CHECK_GE(val1, val2)
void InitializeLazyCoreNode(Coefficient weight, EncodingNode *a, EncodingNode *b)
Literal GetAssumption(SatSolver *solver)
bool IncreaseCurrentUB(SatSolver *solver)
void ApplyWeightUpperBound(Coefficient gap, SatSolver *solver)
Coefficient Reduce(const SatSolver &solver)
EncodingNode * child_b() const
void InitializeLazyNode(EncodingNode *a, EncodingNode *b, SatSolver *solver)
void InitializeFullNode(int n, EncodingNode *a, EncodingNode *b, SatSolver *solver)
Coefficient weight() const
Literal literal(int i) const
std::string DebugString(const VariablesAssignment &assignment) const
EncodingNode * child_a() const
void set_weight(Coefficient w)
Literal GreaterThan(int i) const
void set_depth(int depth)
bool operator<(const EncodingNode &other) const
std::tuple< int64_t, int64_t, const double > Coefficient
Coefficient ComputeCoreMinWeight(const std::vector< EncodingNode * > &nodes, const std::vector< Literal > &core)
EncodingNode * MergeAllNodesWithDeque(Coefficient upper_bound, const std::vector< EncodingNode * > &nodes, SatSolver *solver, std::deque< EncodingNode > *repository)
EncodingNode * LazyMergeAllNodeWithPQAndIncreaseLb(Coefficient weight, const std::vector< EncodingNode * > &nodes, SatSolver *solver, std::deque< EncodingNode > *repository)
std::vector< Literal > ReduceNodesAndExtractAssumptions(Coefficient upper_bound, Coefficient stratified_lower_bound, Coefficient *lower_bound, std::vector< EncodingNode * > *nodes, SatSolver *solver)
void IncreaseNodeSize(EncodingNode *node, SatSolver *solver)
EncodingNode LazyMerge(EncodingNode *a, EncodingNode *b, SatSolver *solver)
EncodingNode FullMerge(Coefficient upper_bound, EncodingNode *a, EncodingNode *b, SatSolver *solver)
bool ProcessCore(const std::vector< Literal > &core, Coefficient min_weight, std::deque< EncodingNode > *repository, std::vector< EncodingNode * > *nodes, SatSolver *solver)
Coefficient MaxNodeWeightSmallerThan(const std::vector< EncodingNode * > &nodes, Coefficient upper_bound)
bool ProcessCoreWithAlternativeEncoding(const std::vector< Literal > &core, Coefficient min_weight, std::deque< EncodingNode > *repository, std::vector< EncodingNode * > *nodes, SatSolver *solver)
std::vector< EncodingNode * > CreateInitialEncodingNodes(const std::vector< Literal > &literals, const std::vector< Coefficient > &coeffs, Coefficient *offset, std::deque< EncodingNode > *repository)
Collection of objects used to extend the Constraint Solver library.