OR-Tools  9.3
cp_model_utils.cc File Reference

Go to the source code of this file.

Namespaces

namespace  operations_research
 Collection of objects used to extend the Constraint Solver library.
 
namespace  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, const CpSolverResponse &response)
 
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)
 

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 159 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 152 of file cp_model_utils.cc.