44 #include "boost/algorithm/string.hpp"
46 #include <boost/archive/text_oarchive.hpp>
47 #include <boost/archive/text_iarchive.hpp>
48 #include <boost/serialization/map.hpp>
53 #include <boost/property_tree/ptree.hpp>
54 #include <boost/property_tree/json_parser.hpp>
64 template<
template <
class>
class CO,
template <
class>
class MO >
71 std::vector<double> hypervolRef,
74 , statistics_(new
Statistics<size_t>(
"individuals"))
76 , objectives_m(objectives)
77 , constraints_m(constraints)
81 , num_workergroups_m(nrWorkerGroups)
82 , hvol_ref_m(hypervolRef)
87 dump_freq_m = args->getArg<
int>(
"dump-freq", 1,
false);
89 dump_dat_m = args->getArg<
bool>(
"dump-dat",
false,
false);
92 resultFile_m = args->getArg<std::string>(
"outfile",
"-th_generation.dat",
false);
93 resultDir_m = args->getArg<std::string>(
"outdir",
"generations",
false);
97 if(stat(resultDir_m.c_str(),&dirInfo) != 0)
98 mkdir((
const char*)(resultDir_m.c_str()), 0777);
104 hvol_eps_ = args->getArg<
double>(
"epsilon", 1
e-3,
false);
111 lambda_m = args->getArg<
int>(
"num-ind-gen", 2,
false);
112 alpha_m = args->getArg<
int>(
"initialPopulation",
true);
124 file_param_descr_ +=
'%' + it->first +
',';
126 file_param_descr_ +=
" DVAR: ";
129 std::vector<std::string> dNames;
132 std::string dName = boost::get<VAR_NAME>(itr->second);
133 file_param_descr_ +=
'%' + dName +
',';
134 dNames.push_back(dName);
136 std::pair<double, double>
137 (boost::get<LOWER_BOUND>(itr->second),
138 boost::get<UPPER_BOUND>(itr->second)));
140 file_param_descr_ = file_param_descr_.substr(0,
141 file_param_descr_.size()-1);
148 std::ostringstream trace_filename;
152 std::shared_ptr<TraceComponent>(
153 new FileSink(trace_filename.str())));
155 std::ostringstream prog_filename;
158 progress_->registerComponent(
"timestamp",
159 std::shared_ptr<TraceComponent>(
new Timestamp()));
161 std::shared_ptr<TraceComponent>(
162 new FileSink(prog_filename.str())));
169 template <
class>
class CO
170 ,
template <
class>
class MO
176 template <
class>
class CO
177 ,
template <
class>
class MO
181 curState_m = Initialize;
182 initialized_m =
false;
185 run_clock_start_ = std::chrono::system_clock::now();
186 last_clock_ = std::chrono::system_clock::now();
190 bool compHyvol = (objectives_m.size() > (
hyper_opt / 2 + 1));
193 variator_m->population()->computeHypervolume(comms_.island_id, hvol_ref_m);
195 std::chrono::duration<double> total =
196 std::chrono::system_clock::now() - run_clock_start_;
197 std::ostringstream stats;
198 stats <<
"__________________________________________" <<
std::endl;
199 stats <<
"GENERATION " << act_gen <<
std::endl;
200 stats <<
"TOTAL = " << total.count() <<
"s" <<
std::endl;
202 stats <<
"HYPERVOLUME = " << current_hvol_ <<
std::endl;
203 stats <<
"time per accepted ind = "
204 << total.count()/statistics_->getStatisticValue(
"accepted")
206 stats <<
"time per infeasible ind = "
207 << (statistics_->getStatisticValue(
"infeasible") ? total.count()/statistics_->getStatisticValue(
"infeasible") : 0)
209 statistics_->dumpStatistics(stats);
210 stats <<
"__________________________________________" <<
std::endl;
211 progress_->log(stats);
214 template<
template <
class>
class CO,
template <
class>
class MO >
222 size_t buf_size = length;
223 size_t pilot_rank = status.MPI_SOURCE;
225 std::ostringstream dump;
226 dump <<
"new results from other cores " << buf_size <<
std::endl;
227 job_trace_->log(dump);
229 char *buffer =
new char[buf_size];
230 MPI_Recv(buffer, buf_size, MPI_CHAR, pilot_rank,
234 dump.str(std::string());
235 dump <<
"got results from other cores " << buf_size <<
std::endl;
236 job_trace_->log(dump);
239 std::istringstream
is(buffer);
240 boost::archive::text_iarchive ia(is);
244 std::set<unsigned int> new_state_ids;
248 if(variator_m->population()->isRepresentedInPopulation(ind.genes_m))
252 new_ind->genes_m = ind.genes_m;
253 new_ind->objectives_m = ind.objectives_m;
257 variator_m->population()->add_individual(new_ind);
258 finishedBuffer_m.push_back(
id);
261 dump.str(std::string());
262 dump <<
"individual (ID: " <<
id
263 <<
") successfully migrated from another island" <<
std::endl;
264 job_trace_->log(dump);
272 unsigned int jid =
static_cast<unsigned int>(length);
274 it = jobmapping_m.find(jid);
276 std::ostringstream dump;
277 dump <<
"job with ID " << jid <<
" delivered results" <<
std::endl;
278 job_trace_->log(dump);
280 if(it == jobmapping_m.end()) {
281 dump <<
"\t |-> NOT FOUND!" <<
std::endl;
282 job_trace_->log(dump);
283 std::cout <<
"NON-EXISTING JOB with ID = " << jid <<
std::endl;
289 jobmapping_m.erase(it);
298 ind->objectives_m.clear();
302 for(; itr != res.end(); ++itr) {
304 if(!itr->second.is_valid || (itr->second.value.size() > 1 && !itr->second.value[0])) {
305 std::ostringstream dump;
306 if (!itr->second.is_valid) {
307 dump <<
"invalid individual, objective or constraint \"" << itr->first
308 <<
"\" failed to be evaluated correctly"
311 dump <<
"invalid individual, constraint \"" << itr->first
312 <<
"\" failed to yield true; result: " << itr->second.value[1]
315 job_trace_->log(dump);
316 variator_m->infeasible(ind);
317 statistics_->changeStatisticBy(
"infeasible", 1);
318 dispatch_forward_solves();
322 if(itr->second.value.size() == 1)
323 ind->objectives_m.push_back(itr->second.value[0]);
327 finishedBuffer_m.push_back(jid);
328 statistics_->changeStatisticBy(
"accepted", 1);
330 checkParetoFront(jid);
336 std::cout <<
"(FixedPisaNsga2) Error: unexpected MPI_TAG: "
344 template<
template <
class>
class CO,
template <
class>
class MO >
354 if(finishedBuffer_m.size() >= lambda_m && curState_m == Variate) {
356 std::cout <<
"░" << std::flush;
358 bool compHyvol = (objectives_m.size() > (
hyper_opt / 2 + 1));
361 variator_m->population()->computeHypervolume(comms_.island_id, hvol_ref_m);
362 hvol_progress_ =
fabs(current_hvol_ - hvol) / current_hvol_;
363 current_hvol_ = hvol;
366 std::chrono::duration<double> total =
367 std::chrono::system_clock::now() - run_clock_start_;
368 std::chrono::duration<double> dt =
369 std::chrono::system_clock::now() - last_clock_;
370 last_clock_ = std::chrono::system_clock::now();
371 std::ostringstream stats;
372 stats <<
"__________________________________________" <<
std::endl;
373 stats <<
"Arriving at generation " << act_gen + 1 <<
std::endl;
374 stats <<
"dt = " << dt.count() <<
"s, total = " << total.count()
377 stats <<
"Hypervolume = " << current_hvol_ <<
std::endl;
378 stats <<
"__________________________________________" <<
std::endl;
379 progress_->log(stats);
382 if((act_gen + 1) % dump_freq_m == 0) {
383 dumpPopulation(variator_m->population());
388 toSelectorAndCommit();
390 exchangeSolutionStates();
404 template<
template <
class>
class CO ,
template <
class>
class MO >
407 size_t num_masters = args_m->getArg<
size_t>(
"num-masters", 1,
false);
409 if(num_masters <= 1 ||
410 exchangeSolStateFreq_m == 0 ||
411 act_gen % exchangeSolStateFreq_m != 0)
414 int pilot_rank = comms_.master_local_pid;
416 std::ostringstream os;
417 boost::archive::text_oarchive oa(os);
421 for(itr = variator_m->population()->begin();
422 itr != variator_m->population()->end(); itr++) {
425 ind.
genes_m = std::vector<double>(itr->second->genes_m);
426 ind.
objectives_m = std::vector<double>(itr->second->objectives_m);
427 population.push_back(ind);
432 size_t buf_size = os.str().length();
434 std::ostringstream dump;
435 dump <<
"sending my buffer size " << buf_size <<
" bytes to PILOT"
437 job_trace_->log(dump);
439 MPI_Send(&buf_size, 1, MPI_UNSIGNED_LONG, pilot_rank,
442 char *buffer =
new char[buf_size];
443 memcpy(buffer, os.str().c_str(), buf_size);
444 MPI_Send(buffer, buf_size, MPI_CHAR, pilot_rank,
449 dump.str(std::string());
450 dump <<
"Sent " << buf_size <<
" bytes to PILOT" <<
std::endl;
451 job_trace_->log(dump);
455 template<
template <
class>
class CO,
template <
class>
class MO >
458 to_selector_.clear();
459 const size_t size = finishedBuffer_m.size();
460 for(
size_t i = 0; i < size; i++) {
461 unsigned int id = finishedBuffer_m.front();
462 to_selector_.insert(
id);
463 finishedBuffer_m.pop_front();
466 variator_m->population()->commit_individuals(to_selector_);
470 template<
template <
class>
class CO,
template <
class>
class MO >
473 while(variator_m->hasMoreIndividualsToEvaluate()) {
491 individual ind = variator_m->popIndividualToEvaluate();
492 if (ind == NULL)
continue;
496 for(itr = dvars_m.begin(); itr != dvars_m.end(); itr++, i++) {
498 std::pair<std::string, double>
499 (boost::get<VAR_NAME>(itr->second),
503 size_t jid =
static_cast<size_t>(ind->id_m);
504 int pilot_rank = comms_.master_local_pid;
507 MPI_Send(&jid, 1, MPI_UNSIGNED_LONG, pilot_rank,
OPT_NEW_JOB_TAG, comms_.opt);
514 std::pair<size_t, individual >(jid, ind));
516 std::ostringstream dump;
517 dump <<
"dispatched simulation with ID " << jid <<
std::endl;
518 job_trace_->log(dump);
524 template <
class>
class CO
525 ,
template <
class>
class MO
536 if( (maxGenerations_m > 0 && act_gen > maxGenerations_m) ||
537 (hvol_progress_ < conv_hvol_progress_) ||
538 (expected_hvol_ > 0.0 &&
fabs(current_hvol_ - expected_hvol_) < hvol_eps_)
542 if(parent_queue_.size() > 0) {
543 std::vector<unsigned int> parents(parent_queue_.begin(),
544 parent_queue_.end());
545 parent_queue_.
clear();
550 std::set<unsigned int> survivors(pp_all.begin(),
553 variator_m->population()->keepSurvivors(survivors);
558 variator_m->variate(parents);
559 dispatch_forward_solves();
561 curState_m = Variate;
570 if(initialized_m ==
false) {
571 variator_m->initial_population(alpha_m, file_start_m);
572 if (initialOptimization_m ==
true && birthControl_m ==
false && file_start_m.empty()) {
574 variator_m->initial_population(num_workergroups_m,
"");
576 dispatch_forward_solves();
577 initialized_m =
true;
582 if(finishedBuffer_m.size() >= alpha_m) {
583 if(dump_offspring_m ==
true) {
584 dumpPopulation(variator_m->population());
587 toSelectorAndCommit();
588 curState_m = InitializeSelector;
591 if (initialOptimization_m ==
false && birthControl_m ==
false && file_start_m.empty()) {
593 variator_m->initial_population(num_workergroups_m,
"");
594 dispatch_forward_solves();
603 if (dump_offspring_m ==
false) {
604 dumpPopulation(variator_m->population());
607 std::ostringstream filename;
608 filename << resultDir_m <<
"/" <<
"ParetoFront_" << resultFile_m
609 <<
"_" << comms_.island_id;
610 dumpPopulationToJSON(paretoFront_m, filename,
false);
612 curState_m = VariatorStopped;
617 MPI_Isend(&dummy, 1, MPI_INT, comms_.master_local_pid,
650 case InitializeSelector: {
655 typename std::map<unsigned int, individual >
657 for(it = variator_m->population()->begin();
658 it != variator_m->population()->end(); it++) {
660 pp_all.push_back(it->first);
663 curState_m = Variate;
670 curState_m = Variate;
676 case VariatorStopped: {
677 curState_m = VariatorTerminate;
693 case VariatorTerminate:
700 template<
template <
class>
class CO,
template <
class>
class MO >
702 std::ostringstream filename;
703 int fileNumber = act_gen;
704 if (dump_offspring_m ==
false) fileNumber--;
705 filename << resultDir_m <<
"/" << fileNumber <<
"_" << resultFile_m
706 <<
"_" << comms_.island_id;
709 if (dump_dat_m ==
true)
710 dumpPopulationToFile(population, filename, dump_offspring_m);
712 dumpPopulationToJSON(population, filename, dump_offspring_m);
715 template<
template <
class>
class CO,
template <
class>
class MO >
717 std::ostringstream& filename,
718 bool dump_offspring) {
721 file.open(filename.str().c_str(), std::ios::out);
724 it = population->begin();
726 auto maxID = it->first;
727 for(it ++; it != population->end(); it++) {
728 if (it->first > maxID)
731 const size_t numDigits = std::to_string(maxID).length();
732 size_t next = 0, last = 0;
733 std::string delimiter =
",";
734 next = file_param_descr_.find(delimiter, last);
735 file << std::setw(numDigits + 1) << file_param_descr_.substr(last, next - last) <<
" ";
737 while ((next = file_param_descr_.find(delimiter, last)) != std::string::npos) {
738 size_t next2 = file_param_descr_.substr(last, next - last).find(
":");
739 if (next2 != std::string::npos) {
743 file << std::setw(14) << file_param_descr_.substr(last, next - last) <<
" ";
746 file << std::setw(14) << file_param_descr_.substr(last) <<
std::endl;
749 file << std::scientific;
751 if (dump_offspring ==
true) {
752 for (
auto id : finishedBuffer_m) {
753 auto ind = population->get_staging(
id);
755 dumpIndividualToFile(
id, ind, file, numDigits);
757 std::cout <<
"Individual " <<
id <<
" from buffer not found!" <<
std::endl;
760 for(it = population->begin(); it != population->end(); it++) {
761 dumpIndividualToFile(it->first, it->second, file, numDigits);
768 template<
template <
class>
class CO,
template <
class>
class MO >
772 const size_t numDigits) {
774 file << std::setw(numDigits + 1) << idx <<
" ";
776 for(
size_t i=0; i<ind->objectives_m.size(); i++)
777 file << std::setw(14) << ind->objectives_m[i] <<
" ";
779 for(
size_t i=0; i<ind->genes_m.size(); i++)
780 file << std::setw(14) << ind->genes_m[i] <<
" ";
785 template<
template <
class>
class CO,
template <
class>
class MO >
787 std::ostringstream& filename,
788 bool dump_offspring) {
790 typedef boost::property_tree::ptree ptree_t;
793 tree.put(
"name",
"opt-pilot");
800 it != dVarBounds_m.end(); ++
it, ++itr)
802 std::string dvar = boost::get<VAR_NAME>(itr->second);
803 bounds <<
"[ " <<
it->first <<
", " <<
it->second <<
" ]";
804 tree.put(
"dvar-bounds." + dvar, bounds.str());
811 it != constraints_m.end(); ++
it )
813 std::string s =
it->second->toString();
815 s.erase(std::remove(s.begin(), s.end(),
'"'), s.end());
820 constraint.put(
"", s);
821 constraints.push_back(std::make_pair(
"", constraint));
824 tree.add_child(
"constraints", constraints);
826 if (dump_offspring ==
true) {
827 for (
auto id : finishedBuffer_m) {
828 auto ind = population->get_staging(
id);
830 dumpIndividualToJSON(
id, ind, tree);
832 std::cout <<
"Individual " <<
id <<
" from buffer not found!" <<
std::endl;
835 for (
auto it = population->begin();
it != population->end();
it++) {
836 dumpIndividualToJSON(
it->first,
it->second, tree);
841 boost::property_tree::write_json(filename.str(), tree);
844 template<
template <
class>
class CO,
template <
class>
class MO >
847 boost::property_tree::ptree& tree) {
849 std::string
id = std::to_string(idx);
852 expr_it = objectives_m.begin();
854 for(
size_t i=0; i < ind->objectives_m.size(); i++, expr_it++) {
855 std::string
name = expr_it->first;
856 tree.put(
"population." +
id +
".obj." + name, ind->objectives_m[i]);
861 std::string
name = boost::get<VAR_NAME>(itr->second);
862 tree.put(
"population." +
id +
".dvar." + name, ind->genes_m[i]);
869 template<
template <
class>
class CO,
template <
class>
class MO >
875 int size = pp_all.size();
880 for (
int i = 0; i < size; i++) front.push_back(std::vector<int>(size));
891 environmentalSelection();
904 template<
template <
class>
class CO,
template <
class>
class MO >
906 pp_all.insert(pp_all.end(), to_selector_.begin(), to_selector_.end());
907 to_selector_.clear();
911 template<
template <
class>
class CO,
template <
class>
class MO >
915 int size = pp_all.size();
917 std::vector<int> d(size,0);
918 std::vector<int> f(size,1);
921 for (i = 0; i < size; i++) {
922 fitness_.insert(std::pair<size_t, double>(pp_all[i], 0.0));
928 for (l = 0; l < size; l++) {
930 for (i = 0; i < size; i++) {
932 if (f[i] == -1)
continue;
933 for (j = 0; j < size && j != i; j++) {
934 if (f[j] == -1)
continue;
935 individual ind_i = variator_m->population()->get_individual(pp_all[i]);
936 individual ind_j = variator_m->population()->get_individual(pp_all[j]);
937 if (dominates(ind_j, ind_i)) {
945 for (i = 0; i < size; i++) {
946 if (f[i] != -1 && d[i] == 0) {
948 fitness_[pp_all[i]] = l;
962 template<
template <
class>
class CO,
template <
class>
class MO >
966 int size = pp_all.size();
967 double dmax = 1E99 / (dim_m + 1);
969 for (i = 0; i < size; i++) {
973 for (l = 0; l < size; l++) {
974 for (
size_t d = 0; d < dim_m; d++) {
976 for (i = 0; i <
copies[l]; i++) {
979 size_t idx1 = pp_all[front[l][i]];
981 variator_m->population()->get_individual(idx1);
982 double obj_min = ind1->objectives_m[d];
984 for (j = i + 1; j < copies[l]; j++) {
987 size_t idx2 = pp_all[front[l][j]];
991 variator_m->population()->get_individual(idx2);
993 double obj2 = ind2->objectives_m[d];
995 if ( obj2 < obj_min ) {
1000 min_index = front[l][
min];
1001 front[l][
min] = front[l][i];
1002 front[l][i] = min_index;
1006 for (i = 0; i < copies[l]; i++) {
1007 if (i == 0 || i == copies[l] - 1)
1008 dist[front[l][i]] += dmax;
1010 size_t idx1 = pp_all[front[l][i+1]];
1011 size_t idx2 = pp_all[front[l][i-1]];
1013 variator_m->population()->get_individual(idx1);
1015 variator_m->population()->get_individual(idx2);
1016 double obj1 = ind1->objectives_m[d];
1017 double obj2 = ind2->objectives_m[d];
1019 dist[front[l][i]] += obj1 -
obj2;
1027 template<
template <
class>
class CO,
template <
class>
class MO >
1030 int size = pp_all.size();
1032 for (
int i = 0; i < size; i++)
1033 fitness_[pp_all[i]] += 1.0 / dist[i];
1036 for (
size_t i = 0; i < alpha_m; i++) {
1038 for (
int j = i + 1; j < size; j++) {
1039 if (fitness_[pp_all[j]] < fitness_[pp_all[min]])
1043 std::swap(pp_all[min], pp_all[i]);
1046 pp_all.erase(pp_all.begin() + alpha_m, pp_all.end());
1051 template<
template <
class>
class CO,
template <
class>
class MO >
1054 for (
size_t i = 0; i < lambda_m; i++) {
1055 int winner = irand(pp_all.size());
1056 for (
int j = 0; j < tournament_m; j++) {
1057 int opponent = irand(pp_all.size());
1058 if (fitness_[pp_all[opponent]] < fitness_[pp_all[winner]]
1059 || winner == opponent) {
1063 parent_queue_.push_back(pp_all[winner]);
1070 template<
template <
class>
class CO,
template <
class>
class MO >
1073 int a_is_worse = 0, b_is_worse = 0;
1076 for (
size_t i = 0; i < ind_a->objectives_m.size(); i++) {
1077 if (ind_a->objectives_m[i] > ind_b->objectives_m[i]) a_is_worse = 1;
1078 if (ind_a->objectives_m[i] < ind_b->objectives_m[i]) b_is_worse = 1;
1083 return (b_is_worse && !a_is_worse);
1087 template<
template <
class>
class CO,
template <
class>
class MO >
1089 individual newInd = variator_m->population()->get_staging(newid);
1091 for (
auto it = paretoFront_m->begin();
it != paretoFront_m->end();
it++) {
1092 if (dominates(
it->second, newInd) ==
true)
return false;
1095 if (paretoFront_m->isRepresentedInPopulation(newInd->genes_m) ==
true)
1098 for (
auto it = paretoFront_m->begin();
it != paretoFront_m->end();
it++) {
1099 if (dominates(newInd,
it->second) ==
true) {
1101 it = paretoFront_m->erase(
it);
1104 paretoFront_m->add_individual(newInd);
1105 paretoFront_m->commit_individuals();
1110 template<
template <
class>
class CO,
template <
class>
class MO >
1114 return "Initialize";
1115 case InitializeSelector:
1116 return "InitializeSelector";
1123 case VariatorStopped:
1124 return "VariatorStopped";
1125 case VariatorTerminate:
1126 return "VariatorTerminate";
void dumpIndividualToFile(int id, individual &ind, std::ofstream &file, const size_t numDigits)
bool dump_dat_m
dump old data format
namedVariableCollection_t Param_t
std::unique_ptr< Variator_t > variator_m
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
double conv_hvol_progress_
#define OPAL_PROJECT_VERSION
void dispatch_forward_solves()
std::string file_param_descr_
file header for result files contains this parameter description
std::string getGitRevision()
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)
objectives_t objectives_m
values of objectives of an individual
#define OPAL_PROJECT_NAME
bool dump_offspring_m
dump offspring / parents flag
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a and you may at your option offer warranty protection in exchange for a fee You may modify your copy or copies of the Program or any portion of thus forming a work based on the and copy and distribute such modifications or work under the terms of Section provided that you also meet all of these that in whole or in part contains or is derived from the Program or any part to be licensed as a whole at no charge to all third parties under the terms of this License c If the modified program normally reads commands interactively when run
std::map< std::string, DVar_t > DVarContainer_t
void bounds(const PETE_Expr< T1 > &expr, Vektor< T2, D > &minval, Vektor< T2, D > &maxval)
std::unique_ptr< Trace > progress_
#define MPI_EXCHANGE_SOL_STATE_DATA_TAG
const std::unique_ptr< Statistics< size_t > > statistics_
collect some statistics of rejected and accepted individuals
Inform & endl(Inform &inf)
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
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
bounds_t dVarBounds_m
bounds on each specified gene
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
PETE_TUTree< FnFabs, typename T::PETE_Expr_t > fabs(const PETE_Expr< T > &l)
size_t lambda_m
number of parents the selector chooses
std::string::iterator iterator
CmdArguments_t args_m
command line arguments specified by the user
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
#define MPI_EXCHANGE_SOL_STATE_RES_TAG
size_t maxGenerations_m
maximal generation (stopping criterion)
DVarContainer_t dvars_m
design variables
virtual bool onMessage(MPI_Status status, size_t length)
implementing poller hooks
std::string getStateString(PisaState_t) const
Expressions::Named_t constraints_m
constraints
#define MPI_OPT_CONVERGED_TAG
optimizer notifies pilot that optimization has converged (EXIT)
void MPI_Recv_reqvars(reqVarContainer_t &reqvars, size_t pid, MPI_Comm comm)
void environmentalSelection()
void dumpPopulationToFile(std::shared_ptr< Population_t >, std::ostringstream &filename, bool dump_offspring)
bundles all communicators for a specific role/pid
virtual void initialize()
Starting selection algorithm and variator PISA state machine.
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
Variator< Individual_t, CrossoverOperator, MutationOperator > Variator_t
b mention the algorithm in the References section The appropriate citation is
void MPI_Send_params(Param_t params, size_t pid, MPI_Comm comm)
int dominates(individual ind_a, individual ind_b)
constexpr double e
The value of .
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
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_
std::map< std::string, reqVarInfo_t > reqVarContainer_t
genes_t genes_m
genes of an individual
void dumpPopulationToJSON(std::shared_ptr< Population_t >, std::ostringstream &filename, bool dump_offspring)
void clear()
Clear the occurrence counter.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is and will automatically terminate your rights under this License parties who have received copies
Expressions::Named_t objectives_m
objectives
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)
bool checkParetoFront(unsigned int id)
check if individual in pareto front and add if not