dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
SteadyGA.h
1 //
2 // Created by amarrero on 19/10/19.
3 //
4 
5 #ifndef DIGNEA_STEADYGA_H
6 #define DIGNEA_STEADYGA_H
7 
9 #include <dignea/core/Solution.h>
13 #include <dignea/utilities/random/PseudoRandom.h>
14 
20 template <class S>
21 class SteadyGA : public AbstractGA<S> {
22  public:
23  SteadyGA();
24 
25  virtual ~SteadyGA() = default;
31  string getName() const override { return "Steady-State Genetic Algorithm"; }
37  string getID() const override { return "SSGA"; }
38 
39  protected:
40  vector<S> createMating() override;
41 
42  void updateProgress() override;
43 };
44 
50 template <class S>
52  this->replacement = make_unique<ReplaceWorst<S>>();
53 }
54 
60 template <class S>
62  vector<S> offspring(1);
63  S child1 = this->selection->select(this->population);
64  S child2 = this->selection->select(this->population);
65  // Aplicamos los operadores geneticos
66  this->reproduction(child1, child2);
67  offspring[0] = child1;
68  return offspring;
69 }
70 
76 template <class S>
78  this->performedEvaluations++;
79 }
80 
81 #endif // DIGNEA_STEADYGA_H
Class to represent an Abstract Genetic Algorithm. Base skeleton is defined here, to extend in particu...
Definition: AbstractGA.h:38
unique_ptr< Replacement< S > > replacement
Definition: AbstractGA.h:101
Class to represents a Steady State Genetic Algorithm (SSGA) At each generation, a new individual is i...
Definition: SteadyGA.h:21
void updateProgress() override
Updates the performed evaluations by one on each call.
Definition: SteadyGA.h:77
string getName() const override
Get the Name.
Definition: SteadyGA.h:31
vector< S > createMating() override
Creates the mating of individuals to be evaluated.
Definition: SteadyGA.h:61
SteadyGA()
Creates a RAW Steady GA instance.
Definition: SteadyGA.h:51
string getID() const override
Get the ID of the algorithm.
Definition: SteadyGA.h:37