Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: cp_model_utils
Note: This documentation is automatically generated.
Function |
Type |
Arguments |
Comments |
AddLinearExpressionToLinearConstraint | Return type: void Arguments: const LinearExpressionProto& expr, int64_t coefficient, LinearConstraintProto* linear |
AllValuesInDomain | Return type: std::vector<int64_t> Arguments: const ProtoWithDomain& proto |
ApplyToAllIntervalIndices | Return type: void Arguments: const std::function<void(int* |
ApplyToAllLiteralIndices | Return type: void Arguments: const std::function<void(int* |
ApplyToAllVariableIndices | Return type: void Arguments: const std::function<void(int* |
ComputeInnerObjective | Return type: int64_t Arguments: const CpObjectiveProto& objective, const CpSolverResponse& response |
ConstraintCaseName | Return type: std::string Arguments: ConstraintProto::ConstraintCase constraint_case |
DomainInProtoContains | Return type: bool Arguments: const ProtoWithDomain& proto, int64_t value |
EnforcementLiteral | Return type: inline int Arguments: const ConstraintProto& ct |
ExpressionContainsSingleRef | Return type: bool Arguments: const LinearExpressionProto& expr |
ExpressionIsAffine | Return type: bool Arguments: const LinearExpressionProto& expr |
FillDomainInProto | Return type: void Arguments: const Domain& domain, ProtoWithDomain* proto |
GetReferencesUsedByConstraint | Return type: IndexReferences Arguments: const ConstraintProto& ct |
GetSingleRefFromExpression | Return type: int Arguments: const LinearExpressionProto& expr |
HasEnforcementLiteral | Return type: inline bool Arguments: const ConstraintProto& ct |
LinearExpressionProtosAreEqual | Return type: bool Arguments: const LinearExpressionProto& a, const LinearExpressionProto& b, int64_t b_scaling = 1 |
NegatedRef | Return type: inline int Arguments: int ref |
PositiveRef | Return type: inline int Arguments: int ref |
ReadDomainFromProto | Return type: Domain Arguments: const ProtoWithDomain& proto |
RefIsPositive | Return type: inline bool Arguments: int ref |
ScaleInnerObjectiveValue | Return type: inline int64_t Arguments: const CpObjectiveProto& proto, int64_t value |
ScaleObjectiveValue | Return type: inline double Arguments: const CpObjectiveProto& proto, int64_t value |
SetToNegatedLinearExpression | Return type: void Arguments: const LinearExpressionProto& input_expr, LinearExpressionProto* output_negated_expr |
UnscaleObjectiveValue | Return type: inline double Arguments: const CpObjectiveProto& proto, double value |
UsedIntervals | Return type: std::vector<int> Arguments: const ConstraintProto& ct |
UsedVariables | Return type: std::vector<int> Arguments: const ConstraintProto& ct |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ecp_model_utils\u003c/code\u003e library provides utility functions for working with CP-SAT models in Google's OR-Tools.\u003c/p\u003e\n"],["\u003cp\u003eIt includes functions to manipulate and analyze constraints, expressions, domains, and objective functions.\u003c/p\u003e\n"],["\u003cp\u003eSeveral functions are dedicated to handling references to variables, intervals, and literals within constraints.\u003c/p\u003e\n"],["\u003cp\u003eYou can utilize these utilities to extract information from and modify the components of your CP-SAT models, enhancing model analysis and manipulation.\u003c/p\u003e\n"],["\u003cp\u003eFunctions are provided for scaling and unscaling objective values based on the objective's scaling factor and offset.\u003c/p\u003e\n"]]],["This C++ documentation outlines utility functions for managing constraint programming models. Key actions include manipulating linear expressions, such as adding expressions to constraints (`AddLinearExpressionToLinearConstraint`) and negating them (`SetToNegatedLinearExpression`). Other functions handle domains, reading (`ReadDomainFromProto`) and filling them (`FillDomainInProto`), as well as checking for specific values (`DomainInProtoContains`, `AllValuesInDomain`). Objective value scaling (`ScaleObjectiveValue`, `UnscaleObjectiveValue`) and reference management (`NegatedRef`, `PositiveRef`) are also core functions.\n"],null,["# cp_model_utils\n\nC++ Reference: cp_model_utils\n=============================\n\n\nNote: This documentation is automatically generated.\n\n| Function | Type | Arguments | Comments |\n|---------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|-----------|----------|\n| [`AddLinearExpressionToLinearConstraint`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L182) | Return type: `void ` Arguments: `const LinearExpressionProto& expr, int64_t coefficient, LinearConstraintProto* linear` \u003cbr /\u003e |\n| [`AllValuesInDomain`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L118) | Return type: `std::vector\u003cint64_t\u003e ` Arguments: `const ProtoWithDomain& proto` \u003cbr /\u003e |\n| [`ApplyToAllIntervalIndices`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L67) | Return type: `void ` Arguments: `const std::function\u003cvoid(int*` \u003cbr /\u003e |\n| [`ApplyToAllLiteralIndices`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L65) | Return type: `void ` Arguments: `const std::function\u003cvoid(int*` \u003cbr /\u003e |\n| [`ApplyToAllVariableIndices`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L63) | Return type: `void ` Arguments: `const std::function\u003cvoid(int*` \u003cbr /\u003e |\n| [`ComputeInnerObjective`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L164) | Return type: `int64_t ` Arguments: `const CpObjectiveProto& objective, const CpSolverResponse& response` \u003cbr /\u003e |\n| [`ConstraintCaseName`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L72) | Return type: `std::string ` Arguments: `ConstraintProto::ConstraintCase constraint_case` \u003cbr /\u003e |\n| [`DomainInProtoContains`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L84) | Return type: `bool ` Arguments: `const ProtoWithDomain& proto, int64_t value` \u003cbr /\u003e |\n| [`EnforcementLiteral`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L42) | Return type: `inline int ` Arguments: `const ConstraintProto& ct` \u003cbr /\u003e |\n| [`ExpressionContainsSingleRef`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L168) | Return type: `bool ` Arguments: `const LinearExpressionProto& expr` \u003cbr /\u003e |\n| [`ExpressionIsAffine`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L171) | Return type: `bool ` Arguments: `const LinearExpressionProto& expr` \u003cbr /\u003e |\n| [`FillDomainInProto`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L93) | Return type: `void ` Arguments: `const Domain& domain, ProtoWithDomain* proto` \u003cbr /\u003e |\n| [`GetReferencesUsedByConstraint`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L58) | Return type: `IndexReferences ` Arguments: `const ConstraintProto& ct` \u003cbr /\u003e |\n| [`GetSingleRefFromExpression`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L175) | Return type: `int ` Arguments: `const LinearExpressionProto& expr` \u003cbr /\u003e |\n| [`HasEnforcementLiteral`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L39) | Return type: `inline bool ` Arguments: `const ConstraintProto& ct` \u003cbr /\u003e |\n| [`LinearExpressionProtosAreEqual`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L187) | Return type: `bool ` Arguments: `const LinearExpressionProto& a, const LinearExpressionProto& b, int64_t b_scaling = 1` \u003cbr /\u003e |\n| [`NegatedRef`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L34) | Return type: `inline int ` Arguments: `int ref` \u003cbr /\u003e |\n| [`PositiveRef`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L35) | Return type: `inline int ` Arguments: `int ref` \u003cbr /\u003e |\n| [`ReadDomainFromProto`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L104) | Return type: `Domain ` Arguments: `const ProtoWithDomain& proto` \u003cbr /\u003e |\n| [`RefIsPositive`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L36) | Return type: `inline bool ` Arguments: `int ref` \u003cbr /\u003e |\n| [`ScaleInnerObjectiveValue`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L143) | Return type: `inline int64_t ` Arguments: `const CpObjectiveProto& proto, int64_t value` \u003cbr /\u003e |\n| [`ScaleObjectiveValue`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L130) | Return type: `inline double ` Arguments: `const CpObjectiveProto& proto, int64_t value` \u003cbr /\u003e |\n| [`SetToNegatedLinearExpression`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L47) | Return type: `void ` Arguments: `const LinearExpressionProto& input_expr, LinearExpressionProto* output_negated_expr` \u003cbr /\u003e |\n| [`UnscaleObjectiveValue`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L152) | Return type: `inline double ` Arguments: `const CpObjectiveProto& proto, double value` \u003cbr /\u003e |\n| [`UsedIntervals`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L79) | Return type: `std::vector\u003cint\u003e ` Arguments: `const ConstraintProto& ct` \u003cbr /\u003e |\n| [`UsedVariables`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model_utils.h#L76) | Return type: `std::vector\u003cint\u003e ` Arguments: `const ConstraintProto& ct` \u003cbr /\u003e |"]]