![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
This class helps keep track of moves that change more than one variable. Mainly this class keeps track of how to backtrack back to the local minimum as you make a sequence of exploratory moves, so in order to commit a compound move, you just need to call Clear instead of Backtracking over the changes.
Definition at line 636 of file feasibility_jump.h.
#include <feasibility_jump.h>
Public Member Functions | |
CompoundMoveBuilder (int num_variables) | |
void | Push (int var, int64_t prev_value, double score) |
bool | Backtrack (int *var, int64_t *value, double *score) |
void | Clear () |
Removes all moves on the stack. | |
int | Size () const |
Returns the number of variables in the move. | |
bool | OnStack (int var) const |
Returns true if this var has been set in this move already,. | |
double | Score () const |
Returns the sum of scores of atomic moved pushed to this compound move. | |
double | BestChildScore () const |
int | Discrepancy () const |
Returns the number of backtracks to any ancestor of the current leaf. | |
bool | StackValuesInDomains (absl::Span< const Domain > var_domains) const |
Returns true if all prev_values on the stack are in the appropriate domain. |
|
inlineexplicit |
Definition at line 638 of file feasibility_jump.h.
bool operations_research::sat::CompoundMoveBuilder::Backtrack | ( | int * | var, |
int64_t * | value, | ||
double * | score ) |
Sets var, val and score to a move that will revert the most recent atomic move on the stack, and pops this move from the stack. Returns false if the stack is empty.
Definition at line 1175 of file feasibility_jump.cc.
|
inline |
Definition at line 664 of file feasibility_jump.h.
void operations_research::sat::CompoundMoveBuilder::Clear | ( | ) |
Removes all moves on the stack.
Definition at line 1164 of file feasibility_jump.cc.
|
inline |
Returns the number of backtracks to any ancestor of the current leaf.
Definition at line 669 of file feasibility_jump.h.
bool operations_research::sat::CompoundMoveBuilder::OnStack | ( | int | var | ) | const |
Returns true if this var has been set in this move already,.
Definition at line 1171 of file feasibility_jump.cc.
void operations_research::sat::CompoundMoveBuilder::Push | ( | int | var, |
int64_t | prev_value, | ||
double | score ) |
Adds an atomic move to the stack. var must not be on the stack (this is DCHECKed).
Definition at line 1188 of file feasibility_jump.cc.
|
inline |
Returns the sum of scores of atomic moved pushed to this compound move.
Definition at line 660 of file feasibility_jump.h.
|
inline |
Returns the number of variables in the move.
Definition at line 654 of file feasibility_jump.h.
bool operations_research::sat::CompoundMoveBuilder::StackValuesInDomains | ( | absl::Span< const Domain > | var_domains | ) | const |
Returns true if all prev_values on the stack are in the appropriate domain.
Definition at line 1204 of file feasibility_jump.cc.