Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <max_flow.h>
Public Member Functions | |
PriorityQueueWithRestrictedPush () | |
PriorityQueueWithRestrictedPush (const PriorityQueueWithRestrictedPush &)=delete | |
This type is neither copyable nor movable. | |
PriorityQueueWithRestrictedPush & | operator= (const PriorityQueueWithRestrictedPush &)=delete |
bool | IsEmpty () const |
Is the queue empty? | |
void | Clear () |
Clears the queue. | |
void | Push (Element element, IntegerPriority priority) |
Element | Pop () |
Specific but efficient priority queue implementation. The priority type must be an integer. The queue allows to retrieve the element with highest priority but only allows pushes with a priority greater or equal to the highest priority in the queue minus one. All operations are in O(1) and the memory is in O(num elements in the queue). Elements with the same priority are retrieved with LIFO order.
Note(user): As far as I know, this is an original idea and is the only code that use this in the Maximum Flow context. Papers usually refer to an height-indexed array of simple linked lists of active node with the same height. Even worse, sometimes they use double-linked list to allow arbitrary height update in order to detect missing height (used for the Gap heuristic). But this can actually be implemented a lot more efficiently by just maintaining the height distribution of all the node in the graph.
Definition at line 267 of file max_flow.h.
|
inline |
Definition at line 269 of file max_flow.h.
|
delete |
This type is neither copyable nor movable.
void operations_research::PriorityQueueWithRestrictedPush< Element, IntegerPriority >::Clear | ( | ) |
Clears the queue.
Definition at line 700 of file max_flow.h.
bool operations_research::PriorityQueueWithRestrictedPush< Element, IntegerPriority >::IsEmpty | ( | ) | const |
Is the queue empty?
Definition at line 694 of file max_flow.h.
|
delete |
Element operations_research::PriorityQueueWithRestrictedPush< Element, IntegerPriority >::Pop | ( | ) |
Returns the element with highest priority and remove it from the queue. IsEmpty() must be false, this condition is DCHECKed.
Definition at line 725 of file max_flow.h.
void operations_research::PriorityQueueWithRestrictedPush< Element, IntegerPriority >::Push | ( | Element | element, |
IntegerPriority | priority ) |
Push a new element in the queue. Its priority must be greater or equal to the highest priority present in the queue, minus one. This condition is DCHECKed, and violating it yields erroneous queue behavior in NDEBUG mode.
Since users may rely on it, we DCHECK the exact condition.
Definition at line 706 of file max_flow.h.