Send feedback
Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class DoubleLinearExpr
Note: This documentation is automatically generated.
Method
AddExpression
Return type: DoubleLinearExpr&
Arguments: const LinearExpr& exprs, double coeff = 1.0
Adds a linear expression to the double linear expression.
AddTerm
Return type: DoubleLinearExpr&
Arguments: IntVar var, double coeff
Adds a term (var * coeff) to the linear expression.
AddTerm
Return type: DoubleLinearExpr&
Arguments: BoolVar var, double coeff
coefficients
Return type: const std::vector<double>&
Returns the vector of coefficients.
constant
Return type: double
Returns the constant term.
DebugString
Return type: std::string
Arguments: const CpModelProto* proto = nullptr
Debug string. See the documentation for LinearExpr::DebugString().
DoubleLinearExpr
DoubleLinearExpr
Return type: explicit
Arguments: BoolVar var
Constructs a linear expression from a Boolean variable.
It deals with logical negation correctly.
DoubleLinearExpr
Return type: explicit
Arguments: IntVar var
Constructs a linear expression from an integer variable.
DoubleLinearExpr
Return type: explicit
Arguments: double constant
Constructs a constant linear expression.
IsConstant
Return type: const bool
Returns true if the expression has no variable.
Sum
Return type: static DoubleLinearExpr
Arguments: absl::Span<const IntVar> vars
Constructs the sum of a list of variables.
Sum
Return type: static DoubleLinearExpr
Arguments: absl::Span<const BoolVar> vars
Constructs the sum of a list of Boolean variables.
variables
Return type: const std::vector<int>&
Returns the vector of variable indices.
WeightedSum
Return type: static DoubleLinearExpr
Arguments: absl::Span<const IntVar> vars,
absl::Span<const double> coeffs
Constructs the scalar product of variables and coefficients.
WeightedSum
Return type: static DoubleLinearExpr
Arguments: absl::Span<const BoolVar> vars,
absl::Span<const double> coeffs
Constructs the scalar product of Boolean variables and coefficients.
Send feedback
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.
Need to tell us more?
[[["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."],[],[]]