|
OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
|
#include <Sampler.h>
Public Types | |
| typedef std::vector< SampleIndividual > | SolutionState_t |
| type used in solution state exchange with other optimizers | |
| typedef std::vector< std::pair< double, double > > | bounds_t |
| type of bounds for design variables | |
Public Member Functions | |
| Sampler (Expressions::Named_t objectives, Expressions::Named_t constraints, DVarContainer_t dvars, size_t dim, Comm::Bundle_t comms, CmdArguments_t args, std::vector< double > hypervolRef, int nrWorkerGroups) | |
| Sampler (const std::map< std::string, std::shared_ptr< SamplingMethod > > &sampleMethods, Expressions::Named_t objectives, DVarContainer_t dvars, Comm::Bundle_t comms, CmdArguments_t args) | |
| virtual void | initialize () |
| Initialization and start algorithm. | |
Protected Member Functions | |
| bool | onMessage (MPI_Status status, size_t length) |
| void | postPoll () |
| executed after handling (if any) new request | |
| void | setupPoll () |
| executed before starting polling loop | |
| void | prePoll () |
| executed before checking for new request | |
| void | onStop () |
| enable implementation to react to STOP tag | |
| void | dispatch_forward_solves () |
| virtual void | run () |
Protected Attributes | |
| MPI_Comm | comm_m |
| communicator the poller listens to requests | |
| bool | is_running_ |
| double | last_polled_ |
| time of last MPI_Test | |
| double | poll_delay_ |
| delay in seconds between polls | |
Private Types | |
| enum | State { SUBMIT , STOP , TERMINATE } |
| typedef SampleIndividual | Individual_t |
Private Member Functions | |
| void | writeJsonHeader () |
| void | dumpIndividualsToJSON () |
| void | addIndividualToJSON (const std::shared_ptr< Individual_t > &ind) |
| void | runStateMachine () |
| void | createNewIndividual () |
Private Attributes | |
| std::map< std::string, std::shared_ptr< SamplingMethod > > | sampleMethods_m |
| int | gid |
| int | my_local_pid_ |
| Comm::Bundle_t | comms_ |
| communicator bundle for the optimizer | |
| std::map< size_t, std::shared_ptr< Individual_t > > | jobmapping_m |
| mapping from unique job ID to individual | |
| std::queue< std::shared_ptr< Individual_t > > | individuals_m |
| bounds_t | dVarBounds_m |
| bounds on each specified gene | |
| DVarContainer_t | dvars_m |
| design variables | |
| Expressions::Named_t | objectives_m |
| objectives | |
| int | nSamples_m |
| CmdArguments_t | args_ |
| command line arguments specified by the user | |
| int | act_sample_m |
| current generation | |
| int | done_sample_m |
| State | curState_m |
| std::size_t | jsonDumpFreq_m |
| Dumps id, design variables and bound. | |
| std::string | jsonFname_m |
| std::list< Individual_t > | individualsToDump_m |
|
inherited |
type of bounds for design variables
Definition at line 39 of file Optimizer.h.
|
private |
| typedef std::vector< SampleIndividual > Sampler::SolutionState_t |
|
private |
| Sampler::Sampler | ( | Expressions::Named_t | objectives, |
| Expressions::Named_t | constraints, | ||
| DVarContainer_t | dvars, | ||
| size_t | dim, | ||
| Comm::Bundle_t | comms, | ||
| CmdArguments_t | args, | ||
| std::vector< double > | hypervolRef, | ||
| int | nrWorkerGroups ) |
This constructor should never be called. It's provided due to the inheritance of SamplePilot from Pilot
Definition at line 38 of file Sampler.cpp.
References Optimizer::Optimizer().
| Sampler::Sampler | ( | const std::map< std::string, std::shared_ptr< SamplingMethod > > & | sampleMethods, |
| Expressions::Named_t | objectives, | ||
| DVarContainer_t | dvars, | ||
| Comm::Bundle_t | comms, | ||
| CmdArguments_t | args ) |
Retrieves all (for the sampler) relevant arguments specified on the command line, initializes the variator and sets up statistics and debug traces.
| [in] | sampleMethods | per design variable (dvar) |
| [in] | dvars | of sampling |
| [in] | comms | available to the sampler |
| [in] | args | the user passed on the command line |
Definition at line 52 of file Sampler.cpp.
References args_, comms_, dVarBounds_m, dvars_m, CmdArguments::getArg(), jsonDumpFreq_m, jsonFname_m, my_local_pid_, objectives_m, Optimizer::Optimizer(), sampleMethods_m, and writeJsonHeader().
|
private |
Definition at line 294 of file Sampler.cpp.
References dumpIndividualsToJSON(), individualsToDump_m, and jsonDumpFreq_m.
Referenced by onMessage().
|
private |
Definition at line 192 of file Sampler.cpp.
References dvars_m, gid, individuals_m, and sampleMethods_m.
Referenced by postPoll().
|
protected |
Definition at line 339 of file Sampler.cpp.
References act_sample_m, comms_, dvars_m, individuals_m, jobmapping_m, MPI_Send_params(), and OPT_NEW_JOB_TAG.
Referenced by runStateMachine().
|
private |
Definition at line 241 of file Sampler.cpp.
References dvars_m, SampleIndividual::genes, SampleIndividual::getIndex(), SampleIndividual::id, individualsToDump_m, jsonFname_m, name, SampleIndividual::objectives, and objectives_m.
Referenced by addIndividualToJSON(), and runStateMachine().
|
virtual |
Initialization and start algorithm.
Implements Optimizer.
Definition at line 94 of file Sampler.cpp.
References act_sample_m, args_, comms_, curState_m, done_sample_m, gid, nSamples_m, Poller::run(), and SUBMIT.
|
protectedvirtual |
User specific behavior on receiving a message.
Implements Optimizer.
Definition at line 131 of file Sampler.cpp.
References addIndividualToJSON(), comms_, done_sample_m, jobmapping_m, MPI_Recv_reqvars(), and REQUEST_FINISHED.
|
inlineprotectedvirtual |
|
protectedvirtual |
executed after handling (if any) new request
Implements Optimizer.
Definition at line 182 of file Sampler.cpp.
References act_sample_m, createNewIndividual(), nSamples_m, and runStateMachine().
|
inlineprotectedvirtual |
|
inlineprotectedvirtualinherited |
The poll loop stops when receiving a 'MPI_STOP_TAG' otherwise passes message to user.
Reimplemented in Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >.
Definition at line 79 of file Poller.h.
References comm_m, is_running_, last_polled_, MPI_STOP_TAG, onMessage(), onStop(), poll_delay_, postPoll(), prePoll(), and setupPoll().
Referenced by Sampler::initialize(), SampleWorker< Sim_t >::SampleWorker(), and Worker< Sim_t >::Worker().
|
private |
Definition at line 303 of file Sampler.cpp.
References act_sample_m, comms_, curState_m, dispatch_forward_solves(), done_sample_m, dumpIndividualsToJSON(), MPI_OPT_CONVERGED_TAG, nSamples_m, STOP, SUBMIT, and TERMINATE.
Referenced by postPoll().
|
inlineprotectedvirtual |
|
private |
Definition at line 217 of file Sampler.cpp.
References bounds(), dVarBounds_m, dvars_m, Util::getGitRevision(), and jsonFname_m.
Referenced by Sampler().
|
private |
current generation
Definition at line 142 of file Sampler.h.
Referenced by dispatch_forward_solves(), initialize(), postPoll(), and runStateMachine().
|
private |
command line arguments specified by the user
Definition at line 139 of file Sampler.h.
Referenced by initialize(), and Sampler().
|
protectedinherited |
communicator the poller listens to requests
Definition at line 52 of file Poller.h.
Referenced by SampleWorker< Sim_t >::onMessage(), Worker< Sim_t >::onMessage(), Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::parseInputFile(), Poller(), run(), and Worker< Sim_t >::setupPoll().
|
private |
communicator bundle for the optimizer
Definition at line 119 of file Sampler.h.
Referenced by dispatch_forward_solves(), initialize(), onMessage(), runStateMachine(), and Sampler().
|
private |
Definition at line 152 of file Sampler.h.
Referenced by initialize(), and runStateMachine().
|
private |
Definition at line 144 of file Sampler.h.
Referenced by initialize(), onMessage(), and runStateMachine().
|
private |
bounds on each specified gene
Definition at line 127 of file Sampler.h.
Referenced by Sampler(), and writeJsonHeader().
|
private |
design variables
Definition at line 130 of file Sampler.h.
Referenced by createNewIndividual(), dispatch_forward_solves(), dumpIndividualsToJSON(), Sampler(), and writeJsonHeader().
|
private |
Definition at line 112 of file Sampler.h.
Referenced by createNewIndividual(), and initialize().
|
private |
Definition at line 124 of file Sampler.h.
Referenced by createNewIndividual(), and dispatch_forward_solves().
|
private |
Definition at line 158 of file Sampler.h.
Referenced by addIndividualToJSON(), and dumpIndividualsToJSON().
|
protectedinherited |
Definition at line 54 of file Poller.h.
Referenced by Poller(), run(), Worker< Sim_t >::runCoWorker(), and SampleWorker< Sim_t >::runSlave().
|
private |
mapping from unique job ID to individual
Definition at line 122 of file Sampler.h.
Referenced by dispatch_forward_solves(), and onMessage().
|
private |
Dumps id, design variables and bound.
Definition at line 155 of file Sampler.h.
Referenced by addIndividualToJSON(), and Sampler().
|
private |
Definition at line 156 of file Sampler.h.
Referenced by dumpIndividualsToJSON(), Sampler(), and writeJsonHeader().
|
protectedinherited |
|
private |
|
private |
Definition at line 135 of file Sampler.h.
Referenced by initialize(), postPoll(), and runStateMachine().
|
private |
objectives
Definition at line 133 of file Sampler.h.
Referenced by dumpIndividualsToJSON(), and Sampler().
|
protectedinherited |
|
private |
Definition at line 109 of file Sampler.h.
Referenced by createNewIndividual(), and Sampler().