18 #ifndef OR_TOOLS_SAT_ENCODING_H_ 19 #define OR_TOOLS_SAT_ENCODING_H_ 78 int size()
const {
return literals_.size(); }
88 return depth_ > other.depth_ ||
89 (depth_ == other.depth_ && other.for_sorting_ > for_sorting_);
109 int depth()
const {
return depth_; }
110 int lb()
const {
return lb_; }
112 int ub()
const {
return ub_; }
120 BooleanVariable for_sorting_;
127 std::vector<Literal> literals_;
133 #if defined(_M_X64) && defined(_DEBUG) 135 static_assert(
sizeof(EncodingNode) == 72,
136 "ERROR_EncodingNode_is_not_well_compacted");
140 static_assert(
sizeof(EncodingNode) <= 64,
141 "ERROR_EncodingNode_is_not_well_compacted");
147 EncodingNode
LazyMerge(EncodingNode*
a, EncodingNode*
b, SatSolver* solver);
159 EncodingNode*
b, SatSolver* solver);
164 const std::vector<EncodingNode*>&
nodes,
166 std::deque<EncodingNode>* repository);
172 std::deque<EncodingNode>* repository);
179 const std::vector<Literal>& literals,
180 const std::vector<Coefficient>& coeffs,
Coefficient* offset,
181 std::deque<EncodingNode>* repository);
183 const LinearObjective& objective_proto,
Coefficient* offset,
184 std::deque<EncodingNode>* repository);
197 const std::vector<Literal>& core);
208 std::deque<EncodingNode>* repository,
209 std::vector<EncodingNode*>*
nodes, SatSolver* solver);
214 #endif // OR_TOOLS_SAT_ENCODING_H_ void InitializeLazyNode(EncodingNode *a, EncodingNode *b, SatSolver *solver)
#define CHECK_GE(val1, val2)
EncodingNode * MergeAllNodesWithDeque(Coefficient upper_bound, const std::vector< EncodingNode * > &nodes, SatSolver *solver, std::deque< EncodingNode > *repository)
bool operator<(const EncodingNode &other) const
void set_weight(Coefficient w)
void ApplyUpperBound(int64_t upper_bound, SatSolver *solver)
Literal GreaterThan(int i) const
EncodingNode * LazyMergeAllNodeWithPQ(const std::vector< EncodingNode * > &nodes, SatSolver *solver, std::deque< EncodingNode > *repository)
Coefficient ComputeCoreMinWeight(const std::vector< EncodingNode * > &nodes, const std::vector< Literal > &core)
void InitializeFullNode(int n, EncodingNode *a, EncodingNode *b, SatSolver *solver)
#define CHECK_LT(val1, val2)
bool IncreaseCurrentUB(SatSolver *solver)
Coefficient weight() const
void IncreaseNodeSize(EncodingNode *node, SatSolver *solver)
EncodingNode FullMerge(Coefficient upper_bound, EncodingNode *a, EncodingNode *b, SatSolver *solver)
EncodingNode * child_a() const
Coefficient MaxNodeWeightSmallerThan(const std::vector< EncodingNode * > &nodes, Coefficient upper_bound)
std::vector< EncodingNode * > CreateInitialEncodingNodes(const std::vector< Literal > &literals, const std::vector< Coefficient > &coeffs, Coefficient *offset, std::deque< EncodingNode > *repository)
Literal literal(int i) const
std::tuple< int64_t, int64_t, const double > Coefficient
Collection of objects used to extend the Constraint Solver library.
void ProcessCore(const std::vector< Literal > &core, Coefficient min_weight, std::deque< EncodingNode > *repository, std::vector< EncodingNode * > *nodes, SatSolver *solver)
int Reduce(const SatSolver &solver)
EncodingNode LazyMerge(EncodingNode *a, EncodingNode *b, SatSolver *solver)
EncodingNode * child_b() const
std::vector< Literal > ReduceNodesAndExtractAssumptions(Coefficient upper_bound, Coefficient stratified_lower_bound, Coefficient *lower_bound, std::vector< EncodingNode * > *nodes, SatSolver *solver)