Send feedback
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
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 2022-09-14 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?