Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <linear_programming_constraint.h>
Public Member Functions | |
void | ClearAndResize (int size) |
bool | Add (glop::ColIndex col, IntegerValue value) |
Does vector[col] += value and return false in case of overflow. | |
template<bool check_overflow = true> | |
bool | AddLinearExpressionMultiple (IntegerValue multiplier, absl::Span< const glop::ColIndex > cols, absl::Span< const IntegerValue > coeffs) |
LinearConstraint | ConvertToLinearConstraint (absl::Span< const IntegerVariable > integer_variables, IntegerValue upper_bound, std::optional< std::pair< IntegerVariable, IntegerValue > > extra_term=std::nullopt) |
void | ConvertToCutData (absl::int128 rhs, absl::Span< const IntegerVariable > integer_variables, absl::Span< const double > lp_solution, IntegerTrail *integer_trail, CutData *result) |
std::vector< std::pair< glop::ColIndex, IntegerValue > > | GetTerms () |
Similar to ConvertToLinearConstraint(). | |
IntegerValue | operator[] (glop::ColIndex col) const |
We only provide the const []. | |
bool | IsSparse () const |
Simple class to combine linear expression efficiently. First in a sparse way that switch to dense when the number of non-zeros grows.
Definition at line 60 of file linear_programming_constraint.h.
bool operations_research::sat::ScatteredIntegerVector::Add | ( | glop::ColIndex | col, |
IntegerValue | value ) |
Does vector[col] += value and return false in case of overflow.
Definition at line 93 of file linear_programming_constraint.cc.
bool operations_research::sat::ScatteredIntegerVector::AddLinearExpressionMultiple | ( | IntegerValue | multiplier, |
absl::Span< const glop::ColIndex > | cols, | ||
absl::Span< const IntegerValue > | coeffs ) |
Similar to Add() but for multiplier * terms.
Returns false if we encountered any integer overflow. If the template bool is false, we do not check for a bit of extra speed.
Definition at line 107 of file linear_programming_constraint.cc.
void operations_research::sat::ScatteredIntegerVector::ClearAndResize | ( | int | size | ) |
This must be called with the correct size before any other functions are used.
Definition at line 76 of file linear_programming_constraint.cc.
void operations_research::sat::ScatteredIntegerVector::ConvertToCutData | ( | absl::int128 | rhs, |
absl::Span< const IntegerVariable > | integer_variables, | ||
absl::Span< const double > | lp_solution, | ||
IntegerTrail * | integer_trail, | ||
CutData * | result ) |
Definition at line 203 of file linear_programming_constraint.cc.
LinearConstraint operations_research::sat::ScatteredIntegerVector::ConvertToLinearConstraint | ( | absl::Span< const IntegerVariable > | integer_variables, |
IntegerValue | upper_bound, | ||
std::optional< std::pair< IntegerVariable, IntegerValue > > | extra_term = std::nullopt ) |
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.
We first do one pass to compute the exact size and not overallocate.
Allocate once.
Copy terms.
Definition at line 144 of file linear_programming_constraint.cc.
std::vector< std::pair< glop::ColIndex, IntegerValue > > operations_research::sat::ScatteredIntegerVector::GetTerms | ( | ) |
Similar to ConvertToLinearConstraint().
Definition at line 233 of file linear_programming_constraint.cc.
|
inline |
Definition at line 103 of file linear_programming_constraint.h.
|
inline |
We only provide the const [].
Definition at line 99 of file linear_programming_constraint.h.