Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <feasibility_jump.h>
Public Member Functions | |
JumpTable ()=default | |
void | SetComputeFunction (absl::AnyInvocable< std::pair< int64_t, double >(int) const > compute_jump) |
void | RecomputeAll (int num_variables) |
std::pair< int64_t, double > | GetJump (int var) |
Gets the current jump delta and score, recomputing if necessary. | |
void | SetJump (int var, int64_t delta, double score) |
void | Recompute (int var) |
Recompute the jump for var when GetJump(var) is next called. | |
bool | NeedRecomputation (int var) const |
double | Score (int var) const |
absl::Span< const int64_t > | Deltas () const |
absl::Span< const double > | Scores () const |
absl::Span< double > | MutableScores () |
bool | JumpIsUpToDate (int var) const |
This class lazily caches the results of compute_jump(var)
which returns a <delta, score> pair. Variables' scores can be manually modified using MutableScores (if the optimal jump is known not to change), or marked for recomputation on the next call to GetJump(var) by calling Recompute.
Definition at line 59 of file feasibility_jump.h.
|
default |
|
inline |
Advanced usage, allows users to read possibly stale deltas for incremental score updates.
Definition at line 84 of file feasibility_jump.h.
std::pair< int64_t, double > operations_research::sat::JumpTable::GetJump | ( | int | var | ) |
Gets the current jump delta and score, recomputing if necessary.
Definition at line 94 of file feasibility_jump.cc.
bool operations_research::sat::JumpTable::JumpIsUpToDate | ( | int | var | ) | const |
For debugging and testing.
Note if you have very high weights (e.g. when using decay), the tolerances in this function are likely too tight.
Definition at line 79 of file feasibility_jump.cc.
|
inline |
Definition at line 91 of file feasibility_jump.h.
|
inline |
Definition at line 78 of file feasibility_jump.h.
void operations_research::sat::JumpTable::Recompute | ( | int | var | ) |
Recompute the jump for var
when GetJump(var)
is next called.
Definition at line 77 of file feasibility_jump.cc.
void operations_research::sat::JumpTable::RecomputeAll | ( | int | num_variables | ) |
Definition at line 65 of file feasibility_jump.cc.
|
inline |
Definition at line 80 of file feasibility_jump.h.
|
inline |
Definition at line 87 of file feasibility_jump.h.
void operations_research::sat::JumpTable::SetComputeFunction | ( | absl::AnyInvocable< std::pair< int64_t, double >(int) const > | compute_jump | ) |
Definition at line 60 of file feasibility_jump.cc.
void operations_research::sat::JumpTable::SetJump | ( | int | var, |
int64_t | delta, | ||
double | score ) |
If the new optimum value and score is known, users can update it directly. e.g. after weight rescaling, or after changing a binary variable.
Definition at line 71 of file feasibility_jump.cc.