OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
#include <Sampler.h>
Public Types | |
typedef std::vector< SampleIndividual > | SolutionState_t |
type used in solution state exchange with other optimizers More... | |
Public Types inherited from Optimizer | |
typedef std::vector< std::pair< double, double > > | bounds_t |
type of bounds for design variables More... | |
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. More... | |
Public Member Functions inherited from Optimizer | |
Optimizer (MPI_Comm comm) | |
virtual | ~Optimizer () |
virtual void | initialize ()=0 |
entry point for optimizer More... | |
Protected Member Functions | |
bool | onMessage (MPI_Status status, size_t length) |
void | postPoll () |
executed after handling (if any) new request More... | |
void | setupPoll () |
executed before starting polling loop More... | |
void | prePoll () |
executed before checking for new request More... | |
void | onStop () |
enable implementation to react to STOP tag More... | |
void | dispatch_forward_solves () |
virtual void | setupPoll ()=0 |
executed before starting polling loop More... | |
virtual void | prePoll ()=0 |
executed before checking for new request More... | |
virtual void | postPoll ()=0 |
executed after handling (if any) new request More... | |
virtual void | onStop ()=0 |
enable implementation to react to STOP tag More... | |
virtual bool | onMessage (MPI_Status status, size_t length)=0 |
Protected Member Functions inherited from Poller | |
virtual bool | onMessage (MPI_Status status, size_t recv_value)=0 |
virtual void | onStop ()=0 |
enable implementation to react to STOP tag More... | |
virtual void | setupPoll ()=0 |
executed before starting polling loop More... | |
virtual void | prePoll ()=0 |
executed before checking for new request More... | |
virtual void | postPoll ()=0 |
executed after handling (if any) new request More... | |
virtual void | run () |
Poller (MPI_Comm comm, double delay=0.1) | |
virtual | ~Poller () |
Private Types | |
enum | State { SUBMIT , STOP , TERMINATE } |
typedef SampleIndividual | Individual_t |
Private Member Functions | |
void | writeJsonHeader () |
void | dumpIndividualsToJSON () |
void | addIndividualToJSON (const boost::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 More... | |
std::map< size_t, boost::shared_ptr< Individual_t > > | jobmapping_m |
mapping from unique job ID to individual More... | |
std::queue< boost::shared_ptr< Individual_t > > | individuals_m |
bounds_t | dVarBounds_m |
bounds on each specified gene More... | |
DVarContainer_t | dvars_m |
design variables More... | |
Expressions::Named_t | objectives_m |
objectives More... | |
int | nSamples_m |
CmdArguments_t | args_ |
command line arguments specified by the user More... | |
int | act_sample_m |
current generation More... | |
int | done_sample_m |
State | curState_m |
std::size_t | jsonDumpFreq_m |
Dumps id, design variables and bound. More... | |
std::string | jsonFname_m |
std::list< Individual_t > | individualsToDump_m |
Additional Inherited Members | |
Protected Attributes inherited from Poller | |
MPI_Comm | comm_m |
communicator the poller listens to requests More... | |
bool | is_running_ |
double | last_polled_ |
time of last MPI_Test More... | |
double | poll_delay_ |
delay in seconds between polls More... | |
|
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 39 of file Sampler.cpp.
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 53 of file Sampler.cpp.
References comms_, dVarBounds_m, dvars_m, Comm::Bundle_t::island_id, jsonDumpFreq_m, jsonFname_m, my_local_pid_, Comm::Bundle_t::opt, and writeJsonHeader().
|
private |
Definition at line 295 of file Sampler.cpp.
References dumpIndividualsToJSON(), individualsToDump_m, and jsonDumpFreq_m.
Referenced by onMessage().
|
private |
Definition at line 193 of file Sampler.cpp.
References dvars_m, gid, individuals_m, and sampleMethods_m.
Referenced by postPoll().
|
protected |
Definition at line 340 of file Sampler.cpp.
References act_sample_m, comms_, dvars_m, individuals_m, jobmapping_m, Comm::Bundle_t::master_local_pid, MPI_Send_params(), Comm::Bundle_t::opt, and OPT_NEW_JOB_TAG.
Referenced by runStateMachine().
|
private |
Definition at line 242 of file Sampler.cpp.
References individualsToDump_m.
Referenced by addIndividualToJSON(), and runStateMachine().
|
virtual |
Initialization and start algorithm.
Implements Optimizer.
Definition at line 95 of file Sampler.cpp.
References act_sample_m, args_, comms_, curState_m, done_sample_m, gid, Comm::Bundle_t::island_id, nSamples_m, Poller::run(), and SUBMIT.
|
protectedvirtual |
User specific behavior on receiving a message.
Implements Optimizer.
Definition at line 132 of file Sampler.cpp.
References addIndividualToJSON(), comms_, done_sample_m, endl(), jobmapping_m, MPI_Recv_reqvars(), Comm::Bundle_t::opt, and REQUEST_FINISHED.
|
inlineprotectedvirtual |
|
protectedvirtual |
executed after handling (if any) new request
Implements Optimizer.
Definition at line 183 of file Sampler.cpp.
References act_sample_m, createNewIndividual(), nSamples_m, and runStateMachine().
|
inlineprotectedvirtual |
|
private |
Definition at line 304 of file Sampler.cpp.
References act_sample_m, comms_, curState_m, dispatch_forward_solves(), done_sample_m, dumpIndividualsToJSON(), Comm::Bundle_t::master_local_pid, MPI_OPT_CONVERGED_TAG, nSamples_m, Comm::Bundle_t::opt, STOP, SUBMIT, and TERMINATE.
Referenced by postPoll().
|
inlineprotectedvirtual |
|
private |
Definition at line 218 of file Sampler.cpp.
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().
|
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 |
|
private |
design variables
Definition at line 130 of file Sampler.h.
Referenced by createNewIndividual(), dispatch_forward_solves(), and Sampler().
|
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().
|
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 |
|
private |
|
private |
Definition at line 135 of file Sampler.h.
Referenced by initialize(), postPoll(), and runStateMachine().
|
private |
|
private |
Definition at line 109 of file Sampler.h.
Referenced by createNewIndividual().