OR-Tools  9.6
cp_model_utils.cc File Reference

Go to the source code of this file.

Namespaces

 operations_research
 Collection of objects used to extend the Constraint Solver library.
 
 operations_research::sat
 

Macros

#define APPLY_TO_SINGULAR_FIELD(ct_name, field_name)
 
#define APPLY_TO_REPEATED_FIELD(ct_name, field_name)
 

Functions

void SetToNegatedLinearExpression (const LinearExpressionProto &input_expr, LinearExpressionProto *output_negated_expr)
 
IndexReferences GetReferencesUsedByConstraint (const ConstraintProto &ct)
 
void ApplyToAllLiteralIndices (const std::function< void(int *)> &f, ConstraintProto *ct)
 
void ApplyToAllVariableIndices (const std::function< void(int *)> &f, ConstraintProto *ct)
 
void ApplyToAllIntervalIndices (const std::function< void(int *)> &f, ConstraintProto *ct)
 
std::string ConstraintCaseName (ConstraintProto::ConstraintCase constraint_case)
 
std::vector< int > UsedVariables (const ConstraintProto &ct)
 
std::vector< int > UsedIntervals (const ConstraintProto &ct)
 
int64_t ComputeInnerObjective (const CpObjectiveProto &objective, absl::Span< const int64_t > solution)
 
bool ExpressionContainsSingleRef (const LinearExpressionProto &expr)
 
bool ExpressionIsAffine (const LinearExpressionProto &expr)
 
int GetSingleRefFromExpression (const LinearExpressionProto &expr)
 
void AddLinearExpressionToLinearConstraint (const LinearExpressionProto &expr, int64_t coefficient, LinearConstraintProto *linear)
 
bool LinearExpressionProtosAreEqual (const LinearExpressionProto &a, const LinearExpressionProto &b, int64_t b_scaling)
 
uint64_t FingerprintExpression (const LinearExpressionProto &lin, uint64_t seed)
 
uint64_t FingerprintModel (const CpModelProto &model, uint64_t seed)
 
void SetupTextFormatPrinter (google::protobuf::TextFormat::Printer *printer)
 

Macro Definition Documentation

◆ APPLY_TO_REPEATED_FIELD

#define APPLY_TO_REPEATED_FIELD (   ct_name,
  field_name 
)
Value:
{ \
for (int& r : *ct->mutable_##ct_name()->mutable_##field_name()) f(&r); \
}
const Constraint * ct

Definition at line 163 of file cp_model_utils.cc.

◆ APPLY_TO_SINGULAR_FIELD

#define APPLY_TO_SINGULAR_FIELD (   ct_name,
  field_name 
)
Value:
{ \
int temp = ct->mutable_##ct_name()->field_name(); \
f(&temp); \
ct->mutable_##ct_name()->set_##field_name(temp); \
}

Definition at line 156 of file cp_model_utils.cc.