33 #ifndef __FIXED_PISA_NSGA2_H__
34 #define __FIXED_PISA_NSGA2_H__
58 #include <boost/property_tree/ptree.hpp>
64 template <
class>
class CrossoverOperator
65 ,
template <
class>
class MutationOperator
88 std::vector<double> hypervolRef,
104 using individual = std::shared_ptr<typename FixedPisaNsga2::Individual_t>;
112 virtual bool onMessage(MPI_Status status,
size_t length);
168 std::vector< std::vector<int> >
front;
281 void dumpPopulationToFile(std::shared_ptr<Population_t>, std::ostringstream& filename,
bool dump_offspring);
282 void dumpPopulationToJSON(std::shared_ptr<Population_t>, std::ostringstream& filename,
bool dump_offspring);
286 const size_t numDigits);
289 boost::property_tree::ptree& tree);
297 return (
int) ((double) range * (
double) rand() / (RAND_MAX + 1.0));
void dumpIndividualToFile(int id, individual &ind, std::ofstream &file, const size_t numDigits)
bool dump_dat_m
dump old data format
std::deque< unsigned int > finishedBuffer_m
buffer holding all finished job id's
std::unique_ptr< Variator_t > variator_m
bool initialized_m
indicating if initial population has been created
void startSelector(std::string filename_base)
double conv_hvol_progress_
void dispatch_forward_solves()
std::vector< std::vector< int > > front
individuals in each front
std::string file_param_descr_
file header for result files contains this parameter description
virtual void prePoll()
executed before checking for new request
std::string resultFile_m
result file name
std::string file_start_m
population file to be started from
void dumpIndividualToJSON(int id, individual &ind, boost::property_tree::ptree &tree)
void writeVariatorCfg()
Write the variator config file.
std::vector< double > hvol_ref_m
hypervolume reference point
bool dump_offspring_m
dump offspring / parents flag
std::map< std::string, DVar_t > DVarContainer_t
std::vector< double > dist
std::unique_ptr< Trace > progress_
const std::unique_ptr< Statistics< size_t > > statistics_
collect some statistics of rejected and accepted individuals
Comm::Bundle_t comms_
communicator bundle for the optimizer
std::map< std::string, Expressions::Expr_t * > Named_t
type of an expressions with a name
PisaState_t
all PISA states
std::chrono::system_clock::time_point run_clock_start_
bounds_t dVarBounds_m
bounds on each specified gene
size_t lambda_m
number of parents the selector chooses
CmdArguments_t args_m
command line arguments specified by the user
std::vector< std::pair< double, double > > bounds_t
type of bounds for design variables
std::vector< Individual > SolutionState_t
type used in solution state exchange with other optimizers
void exchangeSolutionStates()
if necessary exchange solution state with other optimizers
FixedPisaNsga2(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)
std::shared_ptr< CmdArguments > CmdArguments_t
size_t maxGenerations_m
maximal generation (stopping criterion)
virtual void setupPoll()
executed before starting polling loop
DVarContainer_t dvars_m
design variables
PisaState_t curState_m
the current state of the state machine
virtual bool onMessage(MPI_Status status, size_t length)
implementing poller hooks
std::string getStateString(PisaState_t) const
Expressions::Named_t constraints_m
constraints
void environmentalSelection()
void dumpPopulationToFile(std::shared_ptr< Population_t >, std::ostringstream &filename, bool dump_offspring)
std::chrono::system_clock::time_point last_clock_
bundles all communicators for a specific role/pid
virtual void initialize()
Starting selection algorithm and variator PISA state machine.
std::map< size_t, individual > jobmapping_m
mapping from unique job ID to individual
std::map< size_t, double > fitness_
map between id and fitness (sum of front number and dist)
void dumpPopulation(std::shared_ptr< Population_t >)
bool initialOptimization_m
initial population optimization flag (increases initial population)
double hvol_eps_
convergence accuracy if maxGenerations not set
int num_workergroups_m
number of individuals running
size_t dim_m
number of objectives
std::vector< unsigned int > pp_all
IDs of population.
std::set< unsigned int > to_selector_
Successfully run IDs to go into population.
Variator< Individual_t, CrossoverOperator, MutationOperator > Variator_t
Individual Individual_t
type of our variator
int dominates(individual ind_a, individual ind_b)
void runStateMachine()
executes one loop of the PISA state machine
void toSelectorAndCommit()
passes finished individuals to the selector
size_t alpha_m
size of initial population
bool birthControl_m
enforce strict population size
size_t act_gen
current generation
virtual void onStop()
enable implementation to react to STOP tag
virtual void postPoll()
executed after handling (if any) new request
Population< Individual_t > Population_t
size_t exchangeSolStateFreq_m
how often do we exchange solutions with other optimizers
std::unique_ptr< Trace > job_trace_
void dumpPopulationToJSON(std::shared_ptr< Population_t >, std::ostringstream &filename, bool dump_offspring)
Expressions::Named_t objectives_m
objectives
std::vector< int > copies
number of individuals in the n-th front
std::shared_ptr< typename FixedPisaNsga2::Individual_t > individual
alias for usage in template
std::shared_ptr< Population_t > paretoFront_m
population of pareto-front (for final output)
std::vector< unsigned int > parent_queue_
IDs that will make new offspring.
bool checkParetoFront(unsigned int id)
check if individual in pareto front and add if not