Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <monoid_operation_tree.h>
Public Member Functions | |
MonoidOperationTree (int size) | |
Constructs a MonoidOperationTree able to store 'size' operands. | |
MonoidOperationTree (const MonoidOperationTree &)=delete | |
This type is neither copyable nor movable. | |
MonoidOperationTree & | operator= (const MonoidOperationTree &)=delete |
const T & | result () const |
Returns the root of the tree, containing the result of the operation. | |
void | Reset (int argument_index) |
Resets the argument of given index. | |
void | Set (int argument_index, const T &argument) |
Sets the argument of given index. | |
void | Clear () |
Resets all arguments. | |
const T & | GetOperand (int argument_index) const |
Returns the leaf node corresponding to the given argument index. | |
template<class Diver > | |
void | DiveInTree (Diver *const diver) const |
Dive down a branch of the operation tree, and then come back up. | |
std::string | DebugString () const |
A monoid is an algebraic structure consisting of a set S with an associative binary operation * :S x S -> S that has an identity element. Associative means a*(b*c) = (a*b)*c for all a,b,c in S. An identity element is an element e in S such that for all a in S, e*a = a*e = a. See http://en.wikipedia.org/wiki/Monoid for more details.
A MonoidOperationTree is a data structure that maintains a product a_1 * a_2 * ... * a_n for a given (fixed) n, and that supports the following functions:
The parameter class T represents an element of the set S. It must:
Possible use cases are:
Definition at line 56 of file monoid_operation_tree.h.
|
explicit |
Constructs a MonoidOperationTree able to store 'size' operands.
Definition at line 165 of file monoid_operation_tree.h.
|
delete |
This type is neither copyable nor movable.
void operations_research::MonoidOperationTree< T >::Clear | ( | ) |
Resets all arguments.
Definition at line 173 of file monoid_operation_tree.h.
std::string operations_research::MonoidOperationTree< T >::DebugString | ( | ) | const |
New layer
Definition at line 209 of file monoid_operation_tree.h.
|
inline |
Dive down a branch of the operation tree, and then come back up.
Definition at line 84 of file monoid_operation_tree.h.
|
inline |
Returns the leaf node corresponding to the given argument index.
Definition at line 78 of file monoid_operation_tree.h.
|
delete |
void operations_research::MonoidOperationTree< T >::Reset | ( | int | argument_index | ) |
Resets the argument of given index.
Definition at line 179 of file monoid_operation_tree.h.
|
inline |
Returns the root of the tree, containing the result of the operation.
Definition at line 66 of file monoid_operation_tree.h.
void operations_research::MonoidOperationTree< T >::Set | ( | int | argument_index, |
const T & | argument ) |
Sets the argument of given index.
Definition at line 184 of file monoid_operation_tree.h.