shark::ExperimentBase::Options Class Reference

Collection of an extensible set of options for a multi-objective experiment. More...

#include <shark/Algorithms/DirectSearch/Experiments/Experiment.h>

+ Inheritance diagram for shark::ExperimentBase::Options:
+ Collaboration diagram for shark::ExperimentBase::Options:

Public Member Functions

virtual ~Options ()
 Virtual d'tor. More...
 
template<typename Tag >
Tag::type value (const Tag &t)
 Reads the value of the option specified by the tag. More...
 
template<typename Tag >
bool hasValue (const Tag &t)
 Checks whether the option specified by tag has been parsed. More...
 
template<typename Tag >
void addOption (const Tag &t)
 Adds the supplied option tag. More...
 
bool parse (int argc, char **argv)
 Parses the command line. More...
 
virtual void addDefaultOptions ()
 Inserts default options of the experiment. More...
 
template<typename Stream >
void printOptions (Stream &s) const
 Outputs the configured options to the supplied stream. More...
 
 DEFINE_OPTION (ObjectiveFunctionTag, objectiveFunction, std::string,"")
 Name of the objective function, passed to factory. More...
 
 DEFINE_OPTION (SeedTag, seed, unsigned int, 1)
 Seed for the RNG. More...
 
 DEFINE_OPTION (StorageIntervalTag, storageInterval, unsigned int, 100)
 Storage frequency for optimizer results. More...
 
 DEFINE_OPTION (SearchSpaceDimensionTag, searchSpaceDimension, unsigned int, 10)
 Dimension of the search space. More...
 
 DEFINE_OPTION (MaxNoEvaluationsTag, maxNoEvaluations, unsigned int, 50000)
 Termination criterion, maximum number of evaluations. More...
 
 DEFINE_OPTION (TimeLimitTag, timeLimit, unsigned int, 1000)
 Termination criterion, maximum runtime in hours. More...
 
 DEFINE_OPTION (FitnessLimitTag, fitnessLimit, double, 1E-10)
 Termination criterion, fitness limit. More...
 
 DEFINE_OPTION (ResultDirTag, resultDir, std::string,".")
 Directory to place results in. More...
 
 DEFINE_OPTION (AlgorithmConfigFile, algorithmConfigFile, std::string,"")
 Configuration file for the optimizer, JSON syntax. More...
 
 DEFINE_OPTION (ResultFormatTag, resultFormat, std::string,"JSON")
 Result format, either JSON or RawText. More...
 
 DEFINE_SIMPLE_OPTION (AlgorithmUsageTag, algorithmUsage)
 Reports configuration options of the optimizer. More...
 
 DEFINE_SIMPLE_OPTION (DefaultAlgorithmUsageTag, defaultAlgorithmUsage)
 Generates default algorithm configuration file in JSON syntax. More...
 

Protected Attributes

boost::program_options::options_description m_options
 Stores known options. More...
 
boost::program_options::variables_map m_variablesMap
 Stores parsed options. More...
 

Detailed Description

Collection of an extensible set of options for a multi-objective experiment.

Definition at line 85 of file Experiment.h.

Constructor & Destructor Documentation

virtual shark::ExperimentBase::Options::~Options ( )
inlinevirtual

Virtual d'tor.

Definition at line 94 of file Experiment.h.

Member Function Documentation

virtual void shark::ExperimentBase::Options::addDefaultOptions ( )
inlinevirtual

Inserts default options of the experiment.

Reimplemented in shark::moo::Experiment::Options.

Definition at line 168 of file Experiment.h.

References addOption().

Referenced by shark::moo::Experiment::Options::addDefaultOptions(), and shark::soo::InterruptibleAlgorithmRunner< Algo, Function >::main().

template<typename Tag >
void shark::ExperimentBase::Options::addOption ( const Tag &  t)
inline

Adds the supplied option tag.

Template Parameters
TagTag structure. Needs to provide:
  • static const bool HAS_VALUE
  • static const char * name();
  • static const char * description();
  • typename type;
    • static type defaultValue();

Definition at line 134 of file Experiment.h.

References m_options.

Referenced by addDefaultOptions(), shark::moo::Experiment::Options::addDefaultOptions(), main(), shark::moo::InterruptibleAlgorithmRunner< Algo, Function >::main(), and shark::soo::InterruptibleAlgorithmRunner< Algo, Function >::main().

shark::ExperimentBase::Options::DEFINE_OPTION ( ObjectiveFunctionTag  ,
objectiveFunction  ,
std::string  ,
""   
)

Name of the objective function, passed to factory.

shark::ExperimentBase::Options::DEFINE_OPTION ( SeedTag  ,
seed  ,
unsigned  int,
 
)

Seed for the RNG.

shark::ExperimentBase::Options::DEFINE_OPTION ( StorageIntervalTag  ,
storageInterval  ,
unsigned  int,
100   
)

Storage frequency for optimizer results.

shark::ExperimentBase::Options::DEFINE_OPTION ( SearchSpaceDimensionTag  ,
searchSpaceDimension  ,
unsigned  int,
10   
)

Dimension of the search space.

shark::ExperimentBase::Options::DEFINE_OPTION ( MaxNoEvaluationsTag  ,
maxNoEvaluations  ,
unsigned  int,
50000   
)

Termination criterion, maximum number of evaluations.

shark::ExperimentBase::Options::DEFINE_OPTION ( TimeLimitTag  ,
timeLimit  ,
unsigned  int,
1000   
)

Termination criterion, maximum runtime in hours.

shark::ExperimentBase::Options::DEFINE_OPTION ( FitnessLimitTag  ,
fitnessLimit  ,
double  ,
1E-  10 
)

Termination criterion, fitness limit.

shark::ExperimentBase::Options::DEFINE_OPTION ( ResultDirTag  ,
resultDir  ,
std::string  ,
"."   
)

Directory to place results in.

shark::ExperimentBase::Options::DEFINE_OPTION ( AlgorithmConfigFile  ,
algorithmConfigFile  ,
std::string  ,
""   
)

Configuration file for the optimizer, JSON syntax.

shark::ExperimentBase::Options::DEFINE_OPTION ( ResultFormatTag  ,
resultFormat  ,
std::string  ,
"JSON"   
)

Result format, either JSON or RawText.

shark::ExperimentBase::Options::DEFINE_SIMPLE_OPTION ( AlgorithmUsageTag  ,
algorithmUsage   
)

Reports configuration options of the optimizer.

shark::ExperimentBase::Options::DEFINE_SIMPLE_OPTION ( DefaultAlgorithmUsageTag  ,
defaultAlgorithmUsage   
)

Generates default algorithm configuration file in JSON syntax.

template<typename Tag >
bool shark::ExperimentBase::Options::hasValue ( const Tag &  t)
inline

Checks whether the option specified by tag has been parsed.

Template Parameters
TagTag structure. Needs to provide:
  • static const bool HAS_VALUE
  • static const char * name();
  • static const char * description();
  • typename type;
    • static type defaultValue();

Definition at line 120 of file Experiment.h.

References m_variablesMap.

Referenced by main(), shark::moo::InterruptibleAlgorithmRunner< Algo, Function >::main(), and shark::soo::InterruptibleAlgorithmRunner< Algo, Function >::main().

bool shark::ExperimentBase::Options::parse ( int  argc,
char **  argv 
)
inline

Parses the command line.

Returns
true if parsing was successful, false otherwise.

Definition at line 155 of file Experiment.h.

References m_options, and m_variablesMap.

Referenced by main(), shark::moo::InterruptibleAlgorithmRunner< Algo, Function >::main(), and shark::soo::InterruptibleAlgorithmRunner< Algo, Function >::main().

template<typename Stream >
void shark::ExperimentBase::Options::printOptions ( Stream &  s) const
inline

Outputs the configured options to the supplied stream.

Template Parameters
StreamType of thream, needs to provide operator<<.
Parameters
[in,out]sInstance of the stream.

Definition at line 189 of file Experiment.h.

References m_options.

Referenced by shark::moo::InterruptibleAlgorithmRunner< Algo, Function >::main(), and shark::soo::InterruptibleAlgorithmRunner< Algo, Function >::main().

template<typename Tag >
Tag::type shark::ExperimentBase::Options::value ( const Tag &  t)
inline

Reads the value of the option specified by the tag.

Template Parameters
TagTag structure. Needs to provide:
  • static const bool HAS_VALUE
  • static const char * name();
  • static const char * description();
  • typename type;
    • static type defaultValue();

Definition at line 106 of file Experiment.h.

References m_variablesMap.

Referenced by main(), shark::moo::InterruptibleAlgorithmRunner< Algo, Function >::main(), and shark::soo::InterruptibleAlgorithmRunner< Algo, Function >::main().

Member Data Documentation

boost::program_options::options_description shark::ExperimentBase::Options::m_options
protected

Stores known options.

Definition at line 88 of file Experiment.h.

Referenced by addOption(), parse(), and printOptions().

boost::program_options::variables_map shark::ExperimentBase::Options::m_variablesMap
protected

Stores parsed options.

Definition at line 90 of file Experiment.h.

Referenced by hasValue(), parse(), and value().


The documentation for this class was generated from the following file: