panga
Individual.h
1 //-------------------------------------------------------------------------------------------------------
2 // Copyright (C) Taylor Woll and panga contributors. All rights reserved.
3 // Licensed under the MIT license. See LICENSE.txt file in the project root for
4 // full license information.
5 //-------------------------------------------------------------------------------------------------------
6 
7 #ifndef INDIVIDUAL_H__
8 #define INDIVIDUAL_H__
9 
10 #include "Chromosome.h"
11 
12 namespace panga {
13 
14 class BitVector;
15 class Genome;
16 
20 class Individual : public Chromosome {
21  public:
22  explicit Individual(const Genome& genome);
23  Individual(const Genome& genome, const BitVector& chromosome);
24  Individual(const Individual& rhs) = delete;
25  Individual(Individual&& rhs) = default;
26  ~Individual() = default;
27 
31  Individual& operator=(const Individual& rhs);
32 
36  bool operator<(const Individual& rhs) const;
37 
43  double GetScore() const;
44  void SetScore(double score);
45 
51  double GetFitness() const;
52  void SetFitness(double fitness);
53 
54  private:
58  double fitness_ = 0.0;
59 
63  double score_ = 0.0;
64 };
65 
66 } // namespace panga
67 
68 #endif // INDIVIDUAL_H__
panga::Chromosome
Definition: Chromosome.h:28
panga::Genome
Definition: Genome.h:31
panga::Individual::operator=
Individual & operator=(const Individual &rhs)
Definition: Individual.cc:26
panga::Individual::operator<
bool operator<(const Individual &rhs) const
Definition: Individual.cc:35
panga::Individual::GetScore
double GetScore() const
Definition: Individual.cc:41
panga::Individual
Definition: Individual.h:20
panga::BitVector
Definition: BitVector.h:19
panga::Individual::GetFitness
double GetFitness() const
Definition: Individual.cc:39