[[["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\u003e\u003ccode\u003eDoubleLinearExpr\u003c/code\u003e in C++ allows the construction and manipulation of linear expressions involving both integer and boolean variables with double-precision coefficients.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides methods to add terms (\u003ccode\u003eAddTerm\u003c/code\u003e) or other linear expressions (\u003ccode\u003eAddExpression\u003c/code\u003e) to the current expression, building complex expressions.\u003c/p\u003e\n"],["\u003cp\u003eIt supports creating expressions from single \u003ccode\u003eBoolVar\u003c/code\u003e, \u003ccode\u003eIntVar\u003c/code\u003e, or a constant (\u003ccode\u003eDoubleLinearExpr\u003c/code\u003e constructors), as well as constructing sums or weighted sums of variables with the static \u003ccode\u003eSum\u003c/code\u003e and \u003ccode\u003eWeightedSum\u003c/code\u003e methods.\u003c/p\u003e\n"],["\u003cp\u003eThe class allows the inspection of the expression through methods like \u003ccode\u003ecoefficients\u003c/code\u003e, \u003ccode\u003econstant\u003c/code\u003e, \u003ccode\u003evariables\u003c/code\u003e, and \u003ccode\u003eIsConstant\u003c/code\u003e, which respectively return the coefficients, the constant term, the vector of variables indexes and check if the expression has no variable.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDebugString\u003c/code\u003e method allows the user to get a debug string of the current instance, providing a means of error checking.\u003c/p\u003e\n"]]],["The `DoubleLinearExpr` class in C++ allows the construction and manipulation of linear expressions. Key actions include adding terms or expressions using `AddTerm` and `AddExpression`. You can construct expressions from `BoolVar`, `IntVar`, or constants. `Sum` and `WeightedSum` methods enable creating expressions from lists of variables. The class provides access to coefficients via `coefficients`, variable indices via `variables`, and the constant term via `constant`. It also determines if an expression has variables with `IsConstant`.\n"],null,["# DoubleLinearExpr\n\nC++ Reference: class DoubleLinearExpr\n=====================================\n\n\nNote: This documentation is automatically generated.\n\n| Method ||\n|------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`AddExpression`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L374) | Return type: `DoubleLinearExpr& ` Arguments: `const LinearExpr& exprs, double coeff = 1.0` Adds a linear expression to the double linear expression. |\n| [`AddTerm`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L370) | Return type: `DoubleLinearExpr& ` Arguments: `IntVar var, double coeff` Adds a term (var \\* coeff) to the linear expression. |\n| [`AddTerm`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L371) | Return type: `DoubleLinearExpr& ` Arguments: `BoolVar var, double coeff` \u003cbr /\u003e |\n| [`coefficients`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L406) | Return type: `const std::vector\u003cdouble\u003e& ` Returns the vector of coefficients. |\n| [`constant`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L412) | Return type: `double ` Returns the constant term. |\n| [`DebugString`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L415) | Return type: `std::string ` Arguments: `const CpModelProto* proto = nullptr` Debug string. See the documentation for LinearExpr::DebugString(). |\n| [`DoubleLinearExpr`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L347) | \u003cbr /\u003e |\n| [`DoubleLinearExpr`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L351) | Return type: `explicit ` Arguments: `BoolVar var` Constructs a linear expression from a Boolean variable. It deals with logical negation correctly. |\n| [`DoubleLinearExpr`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L354) | Return type: `explicit ` Arguments: `IntVar var` Constructs a linear expression from an integer variable. |\n| [`DoubleLinearExpr`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L357) | Return type: `explicit ` Arguments: `double constant` Constructs a constant linear expression. |\n| [`IsConstant`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L409) | Return type: `const bool ` Returns true if the expression has no variable. |\n| [`Sum`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L389) | Return type: `static DoubleLinearExpr ` Arguments: `absl::Span\u003cconst IntVar\u003e vars` Constructs the sum of a list of variables. |\n| [`Sum`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L392) | Return type: `static DoubleLinearExpr ` Arguments: `absl::Span\u003cconst BoolVar\u003e vars` Constructs the sum of a list of Boolean variables. |\n| [`variables`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L403) | Return type: `const std::vector\u003cint\u003e& ` Returns the vector of variable indices. |\n| [`WeightedSum`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L395) | Return type: `static DoubleLinearExpr ` Arguments: `absl::Span\u003cconst IntVar\u003e vars, absl::Span\u003cconst double\u003e coeffs` Constructs the scalar product of variables and coefficients. |\n| [`WeightedSum`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/cp_model.h#L399) | Return type: `static DoubleLinearExpr ` Arguments: `absl::Span\u003cconst BoolVar\u003e vars, absl::Span\u003cconst double\u003e coeffs` Constructs the scalar product of Boolean variables and coefficients. |"]]