NOMAD Source
Version 4.0.0 Beta
|
Template class for the stop reason of a stop type. More...
#include <StopReason.hpp>
Public Member Functions | |
StopReason () | |
Constructor. More... | |
~StopReason () | |
Destructor. More... | |
T | get () const |
The stop reason. More... | |
void | set (T s) |
Set the stop reason if it is listed in dictionnary. More... | |
void | setStarted () |
Reset the stop reason to the default STARTED state. More... | |
bool | isStarted () const |
Check if it is in STARTED state. More... | |
std::string | getStopReasonAsString () const |
Translate the stop reason into a string for display. More... | |
bool | checkTerminate () const |
Check if the stop reason requires a termination. More... | |
Private Member Functions | |
std::map< T, std::string > & | dict () const |
Dictionnary to translate a stop type into a string. More... | |
void | testValidity () const |
Helper for constructor (check sanity) More... | |
Private Attributes | |
T | _stopReason |
The stop reason stored as a stop type. More... | |
Template class for the stop reason of a stop type.
The possible stop types can be generic: IterStopType, EvalStopType, BaseStopType, or specific to an algorithm: MadsStopType, PhaseOneStopType, NMStopType ,....
The default stop type is STARTED (no stop). A stop reason different than STARTED indicates what is the cause of termination. Some stop reasons indicate a normal termination that don't need propagation and other must be propagated to stop an algorithm (see StopReason::checkTerminate()).
Definition at line 99 of file StopReason.hpp.
|
inlineexplicit |
Constructor.
Upon construction, the validity of the stop reason is verified (sanity check).
By default the stop reason is set to STARTED.
Definition at line 147 of file StopReason.hpp.
|
inline |
bool StopReason< T >::checkTerminate | ( | ) | const |
Check if the stop reason requires a termination.
This is implemented for each stop type (template specialization of the function).
Except for EvalStopType, a stop reason different than STARTED indicates that an algorithm or a sub-algorithm must terminate.
true
if a termination is required, false
otherwise.
|
private |
Dictionnary to translate a stop type into a string.
We have template specializations of this function for each stop type. This function is called to display the stop reason.
|
inline |
The stop reason.
Definition at line 160 of file StopReason.hpp.
|
inline |
Translate the stop reason into a string for display.
Definition at line 189 of file StopReason.hpp.
|
inline |
Check if it is in STARTED state.
Definition at line 183 of file StopReason.hpp.
|
inline |
Set the stop reason if it is listed in dictionnary.
Definition at line 166 of file StopReason.hpp.
|
inline |
Reset the stop reason to the default STARTED state.
Definition at line 177 of file StopReason.hpp.
|
inlineprivate |
Helper for constructor (check sanity)
Definition at line 114 of file StopReason.hpp.
|
private |
The stop reason stored as a stop type.
Definition at line 104 of file StopReason.hpp.