Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <rev.h>
Public Member Functions | |
RevRepository () | |
void | SetLevel (int level) final |
int | Level () const |
void | SaveState (T *object) |
void | SaveStateWithStamp (T *object, int64_t *stamp) |
Public Member Functions inherited from operations_research::ReversibleInterface | |
ReversibleInterface () | |
virtual | ~ReversibleInterface () |
A repository that maintains a set of reversible objects of type T. This is meant to be used for small types that are efficient to copy, like all the basic types, std::pair and things like this.
|
inline |
|
inline |
|
inline |
Saves the given object value for the current level. If this is called multiple time by level, only the value of the first call matter. This is NOT optimized for many calls by level and should mainly be used just once for a given level. If a client cannot do that efficiently, it can use the SaveStateWithStamp() function below.
|
inline |
Calls SaveState() if the given stamp is not the same as the current one. This also sets the given stamp to the current one. The current stamp is maintained by this class and is updated on each level changes. The whole process make sure that only one SaveValue() par level will ever be called, so it is efficient to call this before each update to the object T.
|
finalvirtual |
This works in O(level_diff) on level increase. For level decrease, it is in O(level_diff + num_restored_states).
Implements operations_research::ReversibleInterface.