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