The class template Konieczny implements Konieczny's algorithm as described in the article 'Green's equivalences in finite semigroups of binary relations' by Janusz Konieczny [42]. This algorithm is similar to that of Lallement and McFadden; see [44]. It differs in being applicable to subsemigroups of a non-regular semigroup, though is essentially the same algorithm for elements which happen to be regular.
A Konieczny instance is defined by a generating set, and the main function is Konieczny::run, which implements Konieczny's Algorithm. If Konieczny::run is invoked and Konieczny::finished returns true, then the size, partial order of \(\mathscr{D}\)-classes, and frames for each \(\mathscr{D}\)-class are known.
| Element | the type of the elements of the semigroup (must not be a pointer). |
| Traits | the type of a traits class with the requirements of KoniecznyTraits. |
Classes | |
| class | DClass |
| A class representing a \(\mathscr{D}\)-class in a Konieczny object. More... | |
Public Types | |
| using | const_d_class_iterator = detail::ConstIteratorStateless<DClassIteratorTraits<DClass>> |
| Return type of cbegin_current_D_classes and cend_current_D_classes. | |
| using | const_element_type = typename Traits::const_element_type |
| The type of const elements. | |
| using | const_iterator |
| A type for const iterators through elements. | |
| using | const_reference |
| Type of element const references. | |
| using | const_regular_d_class_iterator = detail::ConstIteratorStateless<DClassIteratorTraits<RegularDClass>> |
| Return type of cbegin_current_regular_D_classes and cend_current_regular_D_classes. | |
| using | D_class_index_type = size_t |
| using | Degree = typename Traits::Degree |
| Adapter for the degree of an element. | |
| using | element_type = typename Traits::element_type |
| The type of elements. | |
| using | EqualTo = typename Traits::EqualTo |
| Adapter for testing equality. | |
| using | Lambda = typename Traits::Lambda |
| Adapter for the action on LambdaValue's. | |
| using | lambda_orb_type = typename Traits::lambda_orb_type |
| The type of the orbit of the lambda values. | |
| using | lambda_value_type = typename Traits::lambda_value_type |
| The type of lambda values. | |
| using | Less = typename Traits::Less |
| Adapter for comparisons. | |
| using | One = typename Traits::One |
| Adapter for the identity element of the given type. | |
| using | Product = typename Traits::Product |
| Adapter for the product of two elements. | |
| using | Rank = typename Traits::Rank |
| Adapter for calculating ranks. | |
| using | Rho = typename Traits::Rho |
| Adapter for the action on RhoValue's. | |
| using | rho_orb_type = typename Traits::rho_orb_type |
| The type of the orbit of the rho values. | |
| using | rho_value_type = typename Traits::rho_value_type |
| The type of rho values. | |
| using | Swap = typename Traits::Swap |
| Adapter for swapping. | |
Public Types inherited from Runner | |
| enum class | state { never_run = 0 , running_to_finish = 1 , running_for = 2 , running_until = 3 , timed_out = 4 , stopped_by_predicate = 6 , not_running = 7 , dead = 8 } |
| Enum class for the state of the Runner. More... | |
Public Types inherited from Reporter | |
| using | nanoseconds = std::chrono::nanoseconds |
| Alias for std::chrono::nanoseconds. | |
| using | time_point = std::chrono::high_resolution_clock::time_point |
| Alias for std::chrono::high_resolution_clock::time_point. | |
Public Member Functions | |
| Konieczny () | |
| Default constructor. | |
| Konieczny (Konieczny &&that) | |
| Move constructor. | |
| Konieczny (Konieczny const &that) | |
| Copy constructor. | |
| Konieczny & | add_generator (const_reference gen) |
| Add a copy of an element to the generators of a Konieczny. | |
| template<typename T> | |
| Konieczny & | add_generators (T const &first, T const &last) |
| Add collection of generators from iterators. | |
| const_d_class_iterator | cbegin_current_D_classes () const |
| Returns a const iterator referring to a pointer to the current first \(\mathscr{D}\)-class. | |
| const_regular_d_class_iterator | cbegin_current_regular_D_classes () const |
| Returns a const iterator referring to a pointer to the current first regular \(\mathscr{D}\)-class. | |
| const_d_class_iterator | cbegin_D_classes () |
| Returns a const iterator referring to a pointer to the first \(\mathscr{D}\)-class. | |
| const_iterator | cbegin_generators () const noexcept |
| Returns a const iterator pointing to the first generator. | |
| const_regular_d_class_iterator | cbegin_regular_D_classes () |
| Returns a const iterator referring to a pointer to the first regular \(\mathscr{D}\)-class. | |
| const_d_class_iterator | cend_current_D_classes () const noexcept |
| Returns a const iterator referring to past the pointer to the current last \(\mathscr{D}\)-class. | |
| const_regular_d_class_iterator | cend_current_regular_D_classes () const noexcept |
| Returns a const iterator referring to past the pointer to the current last regular \(\mathscr{D}\)-class. | |
| const_d_class_iterator | cend_D_classes () |
| Returns a const iterator referring to past the pointer to the last \(\mathscr{D}\)-class. | |
| const_iterator | cend_generators () const noexcept |
| Returns a const iterator pointing to one past the last generator. | |
| const_regular_d_class_iterator | cend_regular_D_classes () |
| Returns a const iterator referring to past the pointer to the last regular \(\mathscr{D}\)-class. | |
| bool | contains (const_reference x) |
| Test membership of an element. | |
| size_t | current_number_of_D_classes () const |
| Returns the current number of \(\mathscr{D}\)-classes. | |
| size_t | current_number_of_H_classes () const |
| Returns the current number of \(\mathscr{H}\)-classes. | |
| size_t | current_number_of_idempotents () const |
| Returns the current number of idempotents. | |
| size_t | current_number_of_L_classes () const |
| Returns the current number of \(\mathscr{L}\)-classes. | |
| size_t | current_number_of_R_classes () const |
| Returns the current number of regular \(\mathscr{R}\)-classes. | |
| size_t | current_number_of_regular_D_classes () const |
| Returns the current number of regular \(\mathscr{D}\)-classes. | |
| size_t | current_number_of_regular_elements () const |
| Returns the current number of regular elements. | |
| size_t | current_number_of_regular_L_classes () const |
| Returns the current number of regular \(\mathscr{L}\)-classes. | |
| size_t | current_number_of_regular_R_classes () const |
| Returns the current number of regular \(\mathscr{R}\)-classes. | |
| size_t | current_size () const |
| Returns the current size. | |
| DClass & | D_class_of_element (const_reference x) |
| Returns the \(\mathscr{D}\)-class containing an element. | |
| size_t | degree () const noexcept |
| Returns the degree of elements. | |
| const_reference | generator (size_t pos) const |
| Returns a const reference to the generator given by an index. | |
| Konieczny & | init () |
| Reinitialize an existing Konieczny object. | |
| bool | is_regular_element (const_reference x) |
| Test regularity of an element. | |
| size_t | number_of_D_classes () |
| Returns the number of \(\mathscr{D}\)-classes. | |
| size_t | number_of_generators () const noexcept |
| Returns the number of generators. | |
| size_t | number_of_H_classes () |
| Returns the number of \(\mathscr{H}\)-classes. | |
| size_t | number_of_idempotents () |
| Returns the number of idempotents. | |
| size_t | number_of_L_classes () |
| Returns the number of \(\mathscr{L}\)-classes. | |
| size_t | number_of_R_classes () |
| Returns the number of \(\mathscr{R}\)-classes. | |
| size_t | number_of_regular_D_classes () |
| Returns the number of regular \(\mathscr{D}\)-classes. | |
| size_t | number_of_regular_elements () |
| Returns the number of regular elements. | |
| size_t | number_of_regular_L_classes () |
| Returns the number of regular \(\mathscr{L}\)-classes. | |
| size_t | number_of_regular_R_classes () |
| Returns the number of regular \(\mathscr{R}\)-classes. | |
| Konieczny & | operator= (Konieczny &&) |
| Move assignment operator. | |
| Konieczny & | operator= (Konieczny const &) |
| Copy assignment operator. | |
| size_t | size () |
| Returns the size. | |
Public Member Functions inherited from Runner | |
| Runner () | |
| Default constructor. | |
| Runner (Runner &&other) | |
| Move constructor. | |
| Runner (Runner const &other) | |
| Copy constructor. | |
| state | current_state () const noexcept |
| Return the current state. | |
| bool | dead () const noexcept |
| Check if the runner is dead. | |
| bool | finished () const |
| Check if run has been run to completion or not. | |
| Runner & | init () |
| Initialize an existing Runner object. | |
| void | kill () noexcept |
| Stop run from running (thread-safe). | |
| Runner & | operator= (Runner &&other) |
| Move assignment operator. | |
| Runner & | operator= (Runner const &other) |
| Copy assignment operator. | |
| void | report_why_we_stopped () const |
| Report why run stopped. | |
| void | run () |
| Run until finished. | |
| void | run_for (std::chrono::nanoseconds t) |
| Run for a specified amount of time. | |
| template<typename Time> | |
| void | run_for (Time t) |
| Run for a specified amount of time. | |
| void | run_until (bool(*func)()) |
Run until a nullary predicate returns true or finished. | |
| template<typename Func> | |
| void | run_until (Func &&func) |
Run until a nullary predicate returns true or finished. | |
| bool | running () const noexcept |
| Check if currently running. | |
| bool | running_for () const noexcept |
| Check if the runner is currently running for a particular length of time. | |
| std::chrono::nanoseconds | running_for_how_long () const noexcept |
| Return the last value passed to run_for. | |
| bool | running_until () const noexcept |
Check if the runner is currently running until a nullary predicate returns true. | |
| bool | started () const noexcept |
| Check if run has been called at least once before. | |
| bool | stopped () const |
| Check if the runner is stopped. | |
| bool | stopped_by_predicate () const |
| Check if the runner was stopped, or should stop, because of the argument last passed to run_until. | |
| std::string | string_why_we_stopped () const |
| virtual bool | success () const |
| Check if run has been run to completion successfully. | |
| bool | timed_out () const |
| Check if the amount of time passed to run_for has elapsed. | |
Public Member Functions inherited from Reporter | |
| Reporter () | |
| Default constructor. | |
| Reporter (Reporter &&that) | |
| Default move constructor. | |
| Reporter (Reporter const &that) | |
| Default copy constructor. | |
| void | emit_divider () |
| Emits the current divider string for reporting. | |
| Reporter & | init () |
| Initialize an existing Reporter object. | |
| time_point | last_report () const noexcept |
| Get the time point of the last report. | |
| Reporter & | operator= (Reporter &&that) |
| Default move assignment operator. | |
| Reporter & | operator= (Reporter const &that) |
| Default copy assignment operator. | |
| bool | report () const |
| Check if it is time to report. | |
| std::string const & | report_divider () const noexcept |
| Get the current divider string for reporting. | |
| Reporter & | report_divider (std::string const &val) |
| Set the divider string for reporting. | |
| nanoseconds | report_every () const noexcept |
| Get the minimum elapsed time between reports. | |
| Reporter & | report_every (nanoseconds val) noexcept |
| Set the minimum elapsed time between reports in nanoseconds. | |
| template<typename Time> | |
| Reporter & | report_every (Time t) noexcept |
| Set the minimum elapsed time between reports in a unit of time other than nanoseconds. | |
| std::string const & | report_prefix () const noexcept |
| Get the current prefix string for reporting. | |
| Reporter & | report_prefix (std::string const &val) |
| Set the prefix string for reporting. | |
| Reporter const & | reset_last_report () const |
| Set the last report time point to now. | |
| Reporter const & | reset_start_time () const |
| Reset the start time (and last report) to now. | |
| time_point | start_time () const noexcept |
| Get the start time. | |
Additional Inherited Members | |
Related Symbols inherited from Reporter | |
| static std::chrono::nanoseconds | delta (std::chrono::high_resolution_clock::time_point const &t) |
| The time between a given point and now. | |
| using const_d_class_iterator = detail::ConstIteratorStateless<DClassIteratorTraits<DClass>> |
Type for const random access iterators through the \(\mathscr{D}\)-classes, in the order they were enumerated.
| using const_iterator |
| using const_reference |
| using const_regular_d_class_iterator = detail::ConstIteratorStateless<DClassIteratorTraits<RegularDClass>> |
A type for const random access iterators through the regular \(\mathscr{D}\)-classes, in the order they were enumerated.
| using D_class_index_type = size_t |
Type of indices of \(\mathscr{D}\)-classes.
| using Degree = typename Traits::Degree |
Defined in adapters.hpp.
Specialisations of this struct should be stateless trivially default constructible with a call operator of signature size_t operator()(Element const& x) const (possibly noexcept, inline and/or constexpr also).
The return value of the call operator ought to indicate the degree of a Element instance which may or may not depend on the parameter x. The degree of a permutation, for instance, would be the the number of points it acts on, the degree of a matrix is its dimension, and so on. This is used, for example, by SchreierSimsTraits in some member functions to determine whether it is known a priori that a permutation does not belong to the object, because it acts on too many points.
| Element | the type of the elements of a semigroup. |
The second template parameter exists for SFINAE.
| using EqualTo = typename Traits::EqualTo |
Defined in adapters.hpp.
This type should be a stateless trivially default constructible with a call operator of signature bool operator()(Value const&, Value const&) (possibly noexcept, inline and/or constexpr also) for use with, for example, std::unordered_map.
| Value | the type of objects to compare. |
The second template parameter exists for SFINAE.
| using Lambda = typename Traits::Lambda |
Defined in adapters.hpp.
This type should be a stateless trivially default constructible with an operator of signature void operator()(Point&, Element const&), which should modify the first argument in-place to contain the lambda value of the second argument. The kernel of the lambda function should be Green's \(\mathscr{L}\)-relation on the semigroup in question.
| Element | the type of elements. |
| Point | the type of the lambda points. |
The third template parameter exists for SFINAE.
| using Less = typename Traits::Less |
Defined in adapters.hpp.
This type should be a stateless trivially default constructible with a call operator of signature bool operator()(Value const&, Value const&) (possibly noexcept, inline and/or constexpr also) which defines a linear order on the objects of type Value.
| Value | the type of objects to compare. |
The second template parameter exists for SFINAE.
| using One = typename Traits::One |
Specialisations of this struct should be stateless trivially default constructible with two call operator of signatures:
Element operator()(size_t n) const (possibly noexcept, inline and/or constexpr also) returning a multiplicative identity element for the category Element and with Degree<Element>()(x) equal to the parameter n. For example, if Element is a type of n x n matrices, then this should return the n x n identity matrix.Element operator()(T const&) const (possibly noexcept, inline and/or constexpr also). This could be implemented as: | Element | the type of the elements of a semigroup. |
The second template parameter exists for SFINAE.
| using Product = typename Traits::Product |
Defined in adapters.hpp.
Specialisations of this struct should be stateless trivially default constructible with a call operator of signature void operator()(Element&, Element const&, Element const&, size_t = 0) (possibly noexcept, inline and/or constexpr also).
The call operator should change xy in-place to be the product of x and y. The 4th parameter is optional and it can be used as an index for static thread local storage, that might be required for forming the product of x and y. The purpose of the 1st parameter is to avoid repeated allocations of memory to hold temporary products that are discarded soon after they are created.
| Element | the type of the elements of a semigroup. |
The second template parameter exists for SFINAE.
| using Rank = typename Traits::Rank |
Defined in adapters.hpp.
This type should be default constructible and a call operator of signature size_t operator()(Element const&) if no additional data is required to compute the rank, or a call operator of signature size_t operator()(State<Element> const&, Element const&) if additional data is required.
The call operator should return the rank of the element given as argument. This must satisfy the following properties:
| Element | the type of elements. |
| State | the type of the data required to compute ranks of Elements; defaults to RankState<Element>. |
The third template parameter exists for SFINAE.
| using Rho = typename Traits::Rho |
Defined in adapters.hpp.
This type should be a stateless trivially default constructible with an operator of signature void operator()(Point&, Element const&), which should modify the first argument in-place to contain the rho value of the second argument. The kernel of the rho function should be Green's \(\mathscr{R}\)-relation on the semigroup in question.
| Element | the type of elements. |
| Point | the type of the rho points. |
The third template parameter exists for SFINAE.
| using Swap = typename Traits::Swap |
Defined in adapters.hpp.
This type should be a stateless trivially default constructible with a call operator of signature void operator()(Value&, Value&) (possibly noexcept, inline and/or constexpr also) which swaps its arguments.
| Value | the type of objects to swap. |
The second template parameter exists for SFINAE.
| Konieczny | ( | ) |
This is the standard constructor for a Konieczny instance with unspecified generators.
| Konieczny | ( | Konieczny< Element, Traits > const & | that | ) |
Constructs a new Konieczny which is an exact copy of that. No enumeration is triggered for either that or of the newly constructed Konieczny object.
| that | the Konieczny to copy. |
| Konieczny | ( | Konieczny< Element, Traits > && | that | ) |
Constructs a new Konieczny using the data from that. No enumeration is triggered for either that or of the newly constructed Konieczny object. The object that is left in a state which is undefined, though guaranteed to be independent from the new Konieczny object.
| that | the Konieczny to move from. |
|
inline |
It is possible, if perhaps not desirable, to add the same generator multiple times.
| gen | the generator to add. |
*this.| LibsemigroupsException | if any of the following hold:
|
| Konieczny & add_generators | ( | T const & | first, |
| T const & | last ) |
Add copies of the generators in the range first to last to this. See add_generator for a detailed description.
| the | type of an iterator pointing to an element_type. |
| first | iterator pointing to the first generator to add. |
| last | iterator pointing one past the last generator to add. |
*this.| LibsemigroupsException | if any of the following hold:
|
|
inline |
This function does not trigger any enumeration; the iterator returned may be invalidated by any call to a non-const member function of the Konieczny class.
const_d_class_iterator.
|
inline |
This function does not trigger any enumeration; the iterator returned may be invalidated by any call to a non-const member function of the Konieczny class.
const_d_class_iterator.
|
inline |
This function triggers the main algorithm to run fully.
const_d_class_iterator.
|
inlinenoexcept |
This function does not trigger any enumeration; the iterator returned may be invalidated by any call to a non-const member function of the Konieczny class.
const_iterator.noexcept and is guaranteed never to throw.
|
inline |
This function triggers the main algorithm to run fully.
const_d_class_iterator.
|
inlinenoexcept |
This function does not trigger any enumeration; the iterator returned may be invalidated by any call to a non-const member function of the Konieczny class.
const_d_class_iterator.
|
inlinenoexcept |
This function does not trigger any enumeration; the iterator returned may be invalidated by any call to a non-const member function of the Konieczny class.
const_d_class_iterator.
|
inline |
This function triggers the main algorithm to run fully.
const_d_class_iterator.
|
inlinenoexcept |
This function does not trigger any enumeration; the iterator returned may be invalidated by any call to a non-const member function of the Konieczny class.
const_iterator.noexcept and is guaranteed never to throw.
|
inline |
This function triggers the main algorithm to run fully.
const_d_class_iterator.
|
inline |
Returns true if x belongs to this and false if it does not.
| x | a const reference to a possible element. |
bool.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
| x | a const reference to a possible element. |
| LibsemigroupsException | if x does not belong to this. |
|
inlinenoexcept |
|
inline |
This function returns a const reference to the pos generators of this.
| pos | the index of the generator. |
| LibsemigroupsException | if the value of pos is greater than number_of_generators(). |
this may have more generators than unique generators.| Konieczny & init | ( | ) |
This function re-initializes a Konieczny instance so that it is in the same (logical) state as if it had just been default-constructed.
*this.
|
inline |
Returns true if x is a regular element and false if it is not.
| x | a const reference to a possible element. |
bool.
|
inline |
size_t.
|
inlinenoexcept |
This function returns the number of generators given to this. Note that there may be duplicate generators, and so this may have more generators than unique generators.
size_t.noexcept and is guaranteed never to throw.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.
|
inline |
size_t.