Arguments:
const std::vector<IntegerVariable>& integer_variables,
IntegerValue upper_bound, LinearConstraint* result
This is not const only because non_zeros is sorted. Note that sorting the
non-zeros make the result deterministic whether or not we were in sparse
mode.
TODO(user): Ideally we should convert to IntegerVariable as late as
possible. Prefer to use GetTerms().
[[["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\u003eScatteredIntegerVector\u003c/code\u003e is a C++ class designed for efficient combination of linear expressions.\u003c/p\u003e\n"],["\u003cp\u003eIt employs a sparse representation initially, transitioning to dense as the number of non-zero elements increases.\u003c/p\u003e\n"],["\u003cp\u003eKey methods include \u003ccode\u003eAdd\u003c/code\u003e, \u003ccode\u003eAddLinearExpressionMultiple\u003c/code\u003e, \u003ccode\u003eClearAndResize\u003c/code\u003e, and \u003ccode\u003eConvertToLinearConstraint\u003c/code\u003e for manipulating and converting the vector.\u003c/p\u003e\n"],["\u003cp\u003eThe class is used within the or-tools library, specifically for handling linear programming constraints.\u003c/p\u003e\n"]]],["The `ScatteredIntegerVector` class efficiently combines linear expressions, switching between sparse and dense storage based on non-zero element count. Key actions include `ClearAndResize` to initialize the vector size. `Add` increments the value at a specific column, and `AddLinearExpressionMultiple` applies a multiplier to multiple terms. `ConvertToLinearConstraint` transforms the vector into a linear constraint using integer variables, while `IsSparse` checks if the vector is in sparse mode. Each operation returns a boolean when there is a potential overflow.\n"],null,["C++ Reference: class ScatteredIntegerVector\n\n\nNote: This documentation is automatically generated.\nSimple class to combine linear expression efficiently. First in a sparse way that switch to dense when the number of non-zeros grows.\n\n| Method ||\n|-------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`Add`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/linear_programming_constraint.h#L78) | Return type: `bool ` Arguments: `glop::ColIndex col, IntegerValue value` Does vector\\[col\\] += value and return false in case of overflow. |\n| [`AddLinearExpressionMultiple`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/linear_programming_constraint.h#L82) | Return type: `bool ` Arguments: ` IntegerValue multiplier, const std::vector\u003cstd::pair\u003cglop::ColIndex, IntegerValue\u003e\u003e& terms` Similar to Add() but for multiplier \\* terms. Returns false in case of overflow. |\n| [`ClearAndResize`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/linear_programming_constraint.h#L75) | Return type: `void ` Arguments: `int size` This must be called with the correct size before any other functions are used. |\n| [`ConvertToLinearConstraint`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/linear_programming_constraint.h#L92) | Return type: `void ` Arguments: ` const std::vector\u003cIntegerVariable\u003e& integer_variables, IntegerValue upper_bound, LinearConstraint* result` This is not const only because non_zeros is sorted. Note that sorting the non-zeros make the result deterministic whether or not we were in sparse mode. TODO(user): Ideally we should convert to IntegerVariable as late as possible. Prefer to use GetTerms(). |\n| [`IsSparse`](https://github.com/google/or-tools/blob/v9.4/ortools/sat/linear_programming_constraint.h#L104) | Return type: `const bool ` \u003cbr /\u003e |"]]