Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::sat::JumpTable Class Reference

Detailed Description

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 57 of file feasibility_jump.h.

#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

Constructor & Destructor Documentation

◆ JumpTable()

operations_research::sat::JumpTable::JumpTable ( )
default

Member Function Documentation

◆ Deltas()

absl::Span< const int64_t > operations_research::sat::JumpTable::Deltas ( ) const
inline

Advanced usage, allows users to read possibly stale deltas for incremental score updates.

Definition at line 82 of file feasibility_jump.h.

◆ GetJump()

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 97 of file feasibility_jump.cc.

◆ JumpIsUpToDate()

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 81 of file feasibility_jump.cc.

◆ MutableScores()

absl::Span< double > operations_research::sat::JumpTable::MutableScores ( )
inline

Definition at line 89 of file feasibility_jump.h.

◆ NeedRecomputation()

bool operations_research::sat::JumpTable::NeedRecomputation ( int var) const
inline

Definition at line 76 of file feasibility_jump.h.

◆ Recompute()

void operations_research::sat::JumpTable::Recompute ( int var)

Recompute the jump for var when GetJump(var) is next called.

Definition at line 79 of file feasibility_jump.cc.

◆ RecomputeAll()

void operations_research::sat::JumpTable::RecomputeAll ( int num_variables)

Definition at line 67 of file feasibility_jump.cc.

◆ Score()

double operations_research::sat::JumpTable::Score ( int var) const
inline

Definition at line 78 of file feasibility_jump.h.

◆ Scores()

absl::Span< const double > operations_research::sat::JumpTable::Scores ( ) const
inline

Definition at line 85 of file feasibility_jump.h.

◆ SetComputeFunction()

void operations_research::sat::JumpTable::SetComputeFunction ( absl::AnyInvocable< std::pair< int64_t, double >(int) const > compute_jump)

Definition at line 62 of file feasibility_jump.cc.

◆ SetJump()

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 73 of file feasibility_jump.cc.


The documentation for this class was generated from the following files: