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

#include <element_diff.h>

Public Member Functions

int64_t checkpoint () const
const absl::flat_hash_set< int64_t > & deleted () const
 The elements that have been deleted before the checkpoint.
void Delete (int64_t id)
 Tracks the element id as deleted if it is less than the checkpoint.
void Advance (int64_t checkpoint)
 Update the checkpoint and clears all tracked deletions.

Detailed Description

Tracks the ids of the elements in a model that:

  1. Are less than the checkpoint for this element.
  2. Have been deleted since the most recent time the checkpoint was advanced (or creation of the ElementDiff if advance was never called).

Generally:

  • Element ids should be nonnegative.
  • Each element should be deleted at most once.
  • Sequential calls to Advance() should be called on non-decreasing checkpoints. However, these are enforced higher up the stack, not in this class.

Definition at line 34 of file element_diff.h.

Member Function Documentation

◆ Advance()

void operations_research::math_opt::ElementDiff::Advance ( int64_t checkpoint)
inline

Update the checkpoint and clears all tracked deletions.

Definition at line 52 of file element_diff.h.

◆ checkpoint()

int64_t operations_research::math_opt::ElementDiff::checkpoint ( ) const
inline

The current checkpoint for this element, generally the next_id for this element when Advance() was last called (or at creation time if advance was never called).

Definition at line 39 of file element_diff.h.

◆ Delete()

void operations_research::math_opt::ElementDiff::Delete ( int64_t id)
inline

Tracks the element id as deleted if it is less than the checkpoint.

Definition at line 45 of file element_diff.h.

◆ deleted()

const absl::flat_hash_set< int64_t > & operations_research::math_opt::ElementDiff::deleted ( ) const
inline

The elements that have been deleted before the checkpoint.

Definition at line 42 of file element_diff.h.


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