Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <dynamic_partition.h>
Public Member Functions | |
SimpleDynamicPartition (int num_elements) | |
int | NumElements () const |
int | NumParts () const |
int | PartOf (int element) const |
int | SizeOfPart (int part) const |
void | Refine (absl::Span< const int > distinguished_subset) |
template<typename T > | |
std::vector< absl::Span< const T > > | GetParts (std::vector< T > *buffer) |
A subset of the API of DynamicPartition without backtrack support. The Refine() here is about twice as fast, but we have limited query support until a batch ComputeElementsByPart() is called.
Definition at line 273 of file dynamic_partition.h.
|
inlineexplicit |
Definition at line 275 of file dynamic_partition.h.
|
inline |
This is meant to be called once after a bunch of Refine(). The returned Span<> points into the given buffer which is re-initialized. To handle strongly typed int, we actually call T(int) as we fill the buffer.
Compute start of each part in buffer.
Fill result.
Copy elements in order and at their place.
Definition at line 374 of file dynamic_partition.h.
|
inline |
Definition at line 279 of file dynamic_partition.h.
|
inline |
Definition at line 280 of file dynamic_partition.h.
|
inline |
Definition at line 281 of file dynamic_partition.h.
void operations_research::SimpleDynamicPartition::Refine | ( | absl::Span< const int > | distinguished_subset | ) |
Compute the size of the non-empty intersection of each part with the distinguished_subset.
Reuse local_sizes to store new_part index or zero (no remapping). Also update the size of each part.
No need to remap if the whole part is in distinguished_subset.
For each part not completely included or excluded, split out the element from distinguished_subset into a new part.
Sparse clean.
Definition at line 298 of file dynamic_partition.cc.
|
inline |
Definition at line 282 of file dynamic_partition.h.