GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
Loading...
Searching...
No Matches
Public Member Functions | List of all members
galib::StandardGA< GeneType > Class Template Reference

#include <StandardGA.h>

Inheritance diagram for galib::StandardGA< GeneType >:
[legend]

Public Member Functions

 StandardGA (FitnessFunction< GeneType > &ff, std::unique_ptr< Selection< GeneType > > sel, std::unique_ptr< Mutation< GeneType > > mu, std::unique_ptr< Crossover< GeneType > > cs, double m_rate, double c_rate, std::size_t max_gen, bool elitism=true, std::size_t threads=1)
 
void run (Population< GeneType > &population) override
 Executes the optimization process on the given population.
 
- Public Member Functions inherited from galib::Algorithm< GeneType >
virtual ~Algorithm ()=default
 
virtual void enableConsoleLogging (const std::size_t interval)
 Enables logging of progress to the standard output.
 
virtual void enableFileLogging (const std::string &path, std::size_t interval)
 Enables logging of population snapshots to a CSV file.
 
virtual void enableLogging (const std::string &)
 Placeholder for generic logging configuration.
 

Additional Inherited Members

- Protected Member Functions inherited from galib::Algorithm< GeneType >
void notifyLoggers (std::size_t gen, const Population< GeneType > &pop)
 Notifies all active loggers to record the current state.
 
- Protected Attributes inherited from galib::Algorithm< GeneType >
std::unique_ptr< utils::ConsoleLogger< GeneType > > console_logger_m
 
std::unique_ptr< utils::FileLogger< GeneType > > file_logger_m
 

Detailed Description

template<typename GeneType = double>
class galib::StandardGA< GeneType >

Definition at line 25 of file StandardGA.h.

Constructor & Destructor Documentation

◆ StandardGA()

template<typename GeneType = double>
galib::StandardGA< GeneType >::StandardGA ( FitnessFunction< GeneType > &  ff,
std::unique_ptr< Selection< GeneType > >  sel,
std::unique_ptr< Mutation< GeneType > >  mu,
std::unique_ptr< Crossover< GeneType > >  cs,
double  m_rate,
double  c_rate,
std::size_t  max_gen,
bool  elitism = true,
std::size_t  threads = 1 
)
inline

Definition at line 49 of file StandardGA.h.

Member Function Documentation

◆ run()

template<typename GeneType = double>
void galib::StandardGA< GeneType >::run ( Population< GeneType > &  population)
inlineoverridevirtual

Executes the optimization process on the given population.

This is a pure-virtual method that must be implemented by concrete algorithms (e.g., StandardGA, IslandGA).

Parameters
populationThe population to optimize. Modified in-place.
Note
The population must be initialized before calling this method.

Implements galib::Algorithm< GeneType >.

Definition at line 68 of file StandardGA.h.

References galib::Algorithm< GeneType >::console_logger_m, galib::Population< GeneType >::empty(), galib::Population< GeneType >::getBestIndividual(), galib::Population< GeneType >::getNumGenes(), galib::Algorithm< GeneType >::notifyLoggers(), and galib::Population< GeneType >::size().


The documentation for this class was generated from the following file: