14#ifndef OR_TOOLS_SAT_CP_CONSTRAINTS_H_
15#define OR_TOOLS_SAT_CP_CONSTRAINTS_H_
22#include "absl/log/check.h"
23#include "absl/types/span.h"
44 : literals_(literals),
47 integer_trail_(integer_trail) {}
78 absl::Span<const AffineExpression> exprs,
79 absl::Span<const Literal> selectors,
80 absl::Span<const Literal> enforcements,
93 void Explain(
int id, IntegerValue propagation_slack,
94 IntegerVariable var_to_explain,
int trail_index,
96 std::vector<
int>* trail_indices_reason) final;
99 const IntegerVariable target_var_;
115 const
std::vector<int64_t>&
input) {
116 std::vector<IntegerValue> result(
input.size());
117 for (
int i = 0;
i <
input.size(); ++
i) {
118 result[
i] = IntegerValue(
input[
i]);
125 const std::vector<Literal>& literals,
bool value) {
132 model->TakeOwnership(constraint);
137 IntegerVariable target_var,
const absl::Span<const IntegerVariable> vars,
138 const absl::Span<const IntegerValue> offsets,
139 const absl::Span<const Literal> selectors,
140 const absl::Span<const Literal> enforcements) {
142 std::vector<AffineExpression> exprs;
143 for (
int i = 0;
i < vars.size(); ++
i) {
148 enforcements,
model);
150 model->TakeOwnership(constraint);
164 IntegerVariable target_var,
const std::vector<IntegerVariable>& vars,
165 const std::vector<Literal>& selectors) {
166 CHECK_EQ(vars.size(), selectors.size());
168 const std::vector<IntegerValue> offsets(vars.size(), IntegerValue(0));
169 if (vars.size() > 2) {
174 if (vars.size() > 2) {
BooleanXorPropagator & operator=(const BooleanXorPropagator &)=delete
BooleanXorPropagator(const std::vector< Literal > &literals, bool value, Trail *trail, IntegerTrail *integer_trail)
void RegisterWith(GenericLiteralWatcher *watcher)
BooleanXorPropagator(const BooleanXorPropagator &)=delete
This type is neither copyable nor movable.
GreaterThanAtLeastOneOfPropagator & operator=(const GreaterThanAtLeastOneOfPropagator &)=delete
void RegisterWith(GenericLiteralWatcher *watcher)
GreaterThanAtLeastOneOfPropagator(const GreaterThanAtLeastOneOfPropagator &)=delete
This type is neither copyable nor movable.
Base class for CP like propagators.
std::function< void(Model *)> GreaterThanAtLeastOneOf(IntegerVariable target_var, const absl::Span< const IntegerVariable > vars, const absl::Span< const IntegerValue > offsets, const absl::Span< const Literal > selectors, const absl::Span< const Literal > enforcements)
std::function< void(Model *)> LiteralXorIs(const std::vector< Literal > &literals, bool value)
Enforces the XOR of a set of literals to be equal to the given value.
std::vector< IntegerValue > ToIntegerValueVector(const std::vector< int64_t > &input)
std::vector< IntegerVariable > NegationOf(const std::vector< IntegerVariable > &vars)
Returns the vector of the negated variables.
std::function< void(Model *)> PartialIsOneOfVar(IntegerVariable target_var, const std::vector< IntegerVariable > &vars, const std::vector< Literal > &selectors)
In SWIG mode, we don't want anything besides these top-level includes.
static int input(yyscan_t yyscanner)