Candidates & Populations#

namespace gapp

class FitnessVector#

#include <population/candidate.hpp>
using gapp::FitnessVector = small_vector<double>#

The class used to represent the fitness of the candidates. Contains a fitness value for each objective.

class FitnessMatrix#

#include <population/candidate.hpp>
using gapp::FitnessMatrix = detail::Matrix<double>#

The class used to represent the fitness values of multiple candidates. Each row of the matrix is the fitness vector of a candidate.

The size of a fitness matrix is: [ number_of_candidates x number_of_objectives ].

class Chromosome#

#include <population/candidate.hpp>
template<typename T>
using gapp::Chromosome = std::vector<T>#

The type used to represent the chromosome of a candidate solution. Every gene of a chromosome is the same type.

Template Parameters:

T – The gene type.

class Candidate#

#include <population/candidate.hpp>
template<typename T>
struct Candidate#

The class that is used to represent candidate solutions in all of the algorithms.

Template Parameters:

T – The gene type used in the candidate’s chromosome.

Public Types

using Gene = T#

The type of the candidate’s genes.

Public Functions

inline explicit Candidate(size_t chrom_len)#

Create a candidate with an empty fitness vector and specific chromosome size. The genes of the chromosome will be default constructed.

Parameters:

chrom_len – The length of the chromosome.

inline explicit Candidate(const Chromosome<T> &chrom)#

Create a candidate with an empty fitness vector and a given chromosome.

Parameters:

chrom – The chromosome of the candidate.

inline explicit Candidate(Chromosome<T> &&chrom) noexcept#

Create a candidate with an empty fitness vector and a given chromosome.

Parameters:

chrom – The chromosome of the candidate.

inline Candidate(std::initializer_list<T> chrom)#

Create a candidate with an empty fitness vector from a list of genes.

Parameters:

chrom – A list of genes for the chromosome.

Public Members

FitnessVector fitness#

The fitness values of the solution (for every objective).

Chromosome<T> chromosome#

The chromosome encoding the solution.

bool is_evaluated = false#

True if the candidate’s fitness value doesn’t need to be computed.

template<typename T>
struct CandidatePair#

A pair of candidates.

class Population#

#include <population/population.hpp>
template<typename Gene>
using gapp::Population = std::vector<Candidate<Gene>>#

The population type used in all of the algorithms.

class Bounds#

#include <population/candidate.hpp>
template<typename T>
class Bounds#

The class used to represent the lower and upper bounds of a gene.

Template Parameters:

T – The gene type. The lower and upper bounds will also be this type.

Public Types

using Gene = T#

The type of the gene.

Public Functions

constexpr Bounds(const T &lower, const T &upper) noexcept#

Constructor for the closed range [lower, upper].

Parameters:
  • lower – The lower bound (inclusive).

  • upper – The upper bound (inclusive).

inline constexpr const T &lower() const noexcept#
Returns:

The lower bound (inclusive).

inline constexpr const T &upper() const noexcept#
Returns:

The upper bound (inclusive).

template<typename T>
using gapp::BoundsVector = std::vector<Bounds<T>>#

A vector of lower and upper gene bounds, containing the bounds for each gene of a chromosome.

Template Parameters:

T – The gene type.