Member functions inherited from Runner

This page contains a description of the member functions of the congruence::Kambites class inherited from Runner.

inline bool libsemigroups::fpsemigroup::Kambites::dead() const noexcept

Check if the runner is dead.

This function can be used to check if we should terminate run() because it has been killed by another thread.

See also

kill()

Parameters

(None)

Throws

(None) – This function is noexcept and is guaranteed never to throw.

Returns

A bool.

inline bool libsemigroups::fpsemigroup::Kambites::finished() const

Check if run has been run to completion or not.

Returns true if run() has been run to completion. For this to work, the implementation of run() in a derived class of Runner must implement a specialisation of finished_impl.

See also

started()

Parameters

(None)

Returns

A bool.

inline void libsemigroups::fpsemigroup::Kambites::kill() noexcept

Stop run from running (thread-safe).

This function can be used to terminate run() from another thread. After kill() has been called the Runner may no longer be in a valid state, but will return true from dead() .

See also

finished()

Parameters

(None)

Throws

(None) – This function is noexcept and is guaranteed never to throw.

Returns

(None).

inline bool libsemigroups::fpsemigroup::Kambites::report() const

Check if it is time to report.

This function can be used in an implementation of run() (in a derived class of Runner) to check if enough time has passed that we should report again.

Parameters

(None)

Returns

A bool.

inline std::chrono::nanoseconds libsemigroups::fpsemigroup::Kambites::report_every() const noexcept

Get the minimum elapsed time between reports.

Parameters

(None)

Returns

The number of nanoseconds between reports.

template<typename TIntType>
inline void libsemigroups::fpsemigroup::Kambites::report_every(TIntType t)

Set the minimum elapsed time between reports.

This function can be used to specify at run time the minimum elapsed time between two calls to report() that return true. If report() returns true at time s, then report() will only return true again after time s + t has elapsed.

Parameters

t – the amount of time (in TIntType) between reports.

Returns

(None)

void libsemigroups::fpsemigroup::Kambites::report_every(std::chrono::nanoseconds t)

Set the minimum elapsed time between reports.

This function can be used to specify at run time the minimum elapsed time between two calls to report() that return true. If report() returns true at time s, then report() will only return true again after time s + t has elapsed.

Parameters

t – the amount of time (in nanoseconds) between reports.

Returns

(None)

void libsemigroups::fpsemigroup::Kambites::report_why_we_stopped() const

Report why run stopped.

Reports whether run() was stopped because it is finished(), timed_out(), or dead().

Parameters

(None)

Returns

(None)

inline void libsemigroups::fpsemigroup::Kambites::run()

Run until finished.

Run the main algorithm implemented by a derived class derived of Runner.

Parameters

(None)

Returns

(None)

template<typename TIntType>
inline void libsemigroups::fpsemigroup::Kambites::run_for(TIntType t)

Run for a specified amount of time.

For this to work it is necessary to periodically check if timed_out() returns true, and to stop if it is, in the run() member function of any derived class of Runner.

Parameters

t – the time to run for (in TIntType).

Returns

(None)

void libsemigroups::fpsemigroup::Kambites::run_for(std::chrono::nanoseconds t)

Run for a specified amount of time.

For this to work it is necessary to periodically check if timed_out() returns true, and to stop if it is, in the run() member function of any derived class of Runner.

Parameters

t – the time in nanoseconds to run for.

Returns

(None)

template<typename T>
inline void libsemigroups::fpsemigroup::Kambites::run_until(T &&func)

Run until a nullary predicate returns true or finished.

Parameters

func – a callable type that will exist for at least until this function returns, or a function pointer.

Returns

(None)

inline void libsemigroups::fpsemigroup::Kambites::run_until(bool (*func)())

Run until a nullary predicate returns true or finished.

Parameters

func – a function pointer.

Returns

(None)

inline bool libsemigroups::fpsemigroup::Kambites::running() const noexcept

Check if currently running.

See also

finished()

Parameters

(None)

Returns

true if run() is in the process of running and false it is not.

Returns

A bool.

inline bool libsemigroups::fpsemigroup::Kambites::running_for() const noexcept

Check if the runner is currently running for a particular length of time.

If the Runner is currently running because its member function run_for has been invoked, then this function returns true. Otherwise, false is returned.

Complexity

Constant.

Parameters

(None)

Throws

(None) – This function is noexcept and is guaranteed never to throw.

Returns

A bool.

inline bool libsemigroups::fpsemigroup::Kambites::running_until() const noexcept

Check if the runner is currently running until a nullary predicate returns true.

If the Runner is currently running because its member function run_until has been invoked, then this function returns true. Otherwise, false is returned.

Complexity

Constant.

Parameters

(None)

Throws

(None) – This function is noexcept and is guaranteed never to throw.

Returns

A bool.

inline bool libsemigroups::fpsemigroup::Kambites::started() const

Check if run has been called at least once before.

Returns true if run() has started to run (it can be running or not).

See also

finished()

Parameters

(None)

Returns

A bool.

inline bool libsemigroups::fpsemigroup::Kambites::stopped() const

Check if the runner is stopped.

This function can be used to check whether or not run() has been stopped for whatever reason. In other words, it checks if timed_out(), finished(), or dead().

Parameters

(None)

Returns

A bool.

inline bool libsemigroups::fpsemigroup::Kambites::stopped_by_predicate() const

Check if the runner was, or should, stop because of the argument for run_until.

If this is running, then the nullary predicate is called and its return value is returned. If this is not running, then true is returned if and only if the last time this was running it was stopped by a call to the nullary predicate passed to run_until().

Complexity

Constant.

Parameters

(None)

Throws

(None) – This function guarantees not to throw a LibsemigroupsException.

Returns

A bool.

inline bool libsemigroups::fpsemigroup::Kambites::timed_out() const

Check if the amount of time passed to run_for has elapsed.

Parameters

(None)

Returns

A bool