Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class ScatteredIntegerVector
Note: This documentation is automatically generated.
Simple class to combine linear expression efficiently. First in a sparse
way that switch to dense when the number of non-zeros grows.
Method |
Add | Return type: bool Arguments: glop::ColIndex col, IntegerValue value Does vector[col] += value and return false in case of overflow.
|
AddLinearExpressionMultiple | Return type: bool Arguments:
IntegerValue multiplier,
const std::vector<std::pair<glop::ColIndex, IntegerValue>>& terms Similar to Add() but for multiplier * terms.
Returns false in case of overflow.
|
ClearAndResize | Return type: void Arguments: int size This must be called with the correct size before any other functions are
used.
|
ConvertToLinearConstraint | Return type: void 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().
|
IsSparse | Return type: const bool |
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.
[null,null,["Last updated 2024-08-06 UTC."],[],["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,[]]