C++ Reference: class ScatteredIntegerVector

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().