ECF 1.5
AlgNSGA2.h
1#include "Algorithm.h"
2#include "MOFitness.h"
3#include <iostream>
4#include <fstream>
5
6
7
8class AlgNSGA2 : public Algorithm
9{
10protected:
11 std::vector <IndividualP> *parentPop;
12 boost::shared_ptr<std::vector <std::vector <IndividualP> > > fronts;
13 SelectionOperatorP selRandomOp, selWorstOp;
14
15public:
16 AlgNSGA2();
17
18 bool initialize(StateP state);
19
20 bool advanceGeneration(StateP state, DemeP deme);
21
22 // sortira se uvijek od najmanje vrijednosti prema najvecoj,
23 // bez obzira na to da li se u konkretnom slucaju radi o maksimizaciji ili minimizaciji
24 void quickSort(std::vector <IndividualP> *group, int left, int right, std::string prop, int objective);
25
26 // sortira populaciju prema fitness-u jedinki s obzirom na jednu odabranu fukciju cilja
27 void sortBasedOnProperty(std::vector <IndividualP>* deme, double* fMin, double* fMax, std::string prop, int objective);
28
29 // provjerava dominantnost izmedu dva multi-objective fitnessa
30 // vraca -1 ako fitness1 dominira fitnessom2
31 // vraca 0 ako niti jedan ne dominira drugim
32 // vraca 1 ako fitness2 dominira fitnessom1
33 // ne uzima u obzir nikakve druge stvari poput 'nc' ili 'crowding-distance', gledaju se samo vrijednosti funkcijā ciljeva
34 int checkDominance(MOFitnessP fitness1, MOFitnessP fitness2);
35
36 // azurira rank polje u MOFitness-u jedinki
37 void nonDomSorting(boost::shared_ptr<std::vector <IndividualP> > pool, int N, boost::shared_ptr<std::vector <std::vector <IndividualP> > > fronts);
38
39 // azurira crowding_distance polje u MOFitness-u jedinki
40 void crowdedDistanceEst(StateP state, std::vector <IndividualP> *deme);
41
42 void makeNewPop(StateP state, DemeP deme);
43
44};
45typedef boost::shared_ptr<AlgNSGA2> AlgNSGA2P;
bool advanceGeneration(StateP state, DemeP deme)
Perform a single generation on a single deme.
Definition: AlgNSGA2.cpp:305
bool initialize(StateP state)
Initialize the algorithm, read parameters from the system, do a sanity check.
Definition: AlgNSGA2.cpp:23
Algorithm base class.
Definition: Algorithm.h:20