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

Implementation of the Island Model Genetic Algorithm (Coarse-Grained Parallel GA). More...

#include <IslandGA.h>

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

Public Member Functions

 IslandGA (FitnessFunction< GeneType > &ff, std::unique_ptr< Selection< GeneType > > sel, std::unique_ptr< Mutation< GeneType > > mu, std::unique_ptr< Crossover< GeneType > > cs, std::unique_ptr< DemeReplacer< GeneType > > replacer, std::unique_ptr< DemeSelector< GeneType > > selector, std::unique_ptr< internal::MigrationBuffer< GeneType > > buffer, std::unique_ptr< internal::Communicator< GeneType > > comm, std::unique_ptr< const Topology > topology, std::unique_ptr< internal::Serializer< GeneType > > serializer, const IslandGAParams &config, const bool elitism=true)
 Constructs an IslandGA instance.
 
void run (Population< GeneType > &population) override
 Runs the evolutionary loop for this island.
 
- 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::IslandGA< GeneType >

Implementation of the Island Model Genetic Algorithm (Coarse-Grained Parallel GA).

This algorithm manages a single "Island" in an Archipelago. It evolves a local population independently and periodically migrates individuals to/from neighboring islands based on a defined topology. Parallelization within the island is handled via OpenMP.

Template Parameters
GeneTypeThe numeric type of each gene (default: double).

Definition at line 39 of file IslandGA.h.

Constructor & Destructor Documentation

◆ IslandGA()

template<typename GeneType = double>
galib::IslandGA< GeneType >::IslandGA ( FitnessFunction< GeneType > &  ff,
std::unique_ptr< Selection< GeneType > >  sel,
std::unique_ptr< Mutation< GeneType > >  mu,
std::unique_ptr< Crossover< GeneType > >  cs,
std::unique_ptr< DemeReplacer< GeneType > >  replacer,
std::unique_ptr< DemeSelector< GeneType > >  selector,
std::unique_ptr< internal::MigrationBuffer< GeneType > >  buffer,
std::unique_ptr< internal::Communicator< GeneType > >  comm,
std::unique_ptr< const Topology >  topology,
std::unique_ptr< internal::Serializer< GeneType > >  serializer,
const IslandGAParams &  config,
const bool  elitism = true 
)
inline

Constructs an IslandGA instance.

Parameters
ffFitness function to minimize.
selSelection operator for reproduction.
muMutation operator.
csCrossover operator.
replacerPolicy for integrating arrived migrants.
selectorPolicy for choosing individuals to migrate out.
bufferThread-safe buffer for incoming migrants.
commMPI communicator for network transport.
topologyThe logical graph structure of the archipelago.
serializerObject responsible for binary serialization.
configIsland-specific parameters (migration interval, size, etc.).
elitismWhether to preserve the best individual locally (default: true).

Definition at line 177 of file IslandGA.h.

Member Function Documentation

◆ run()

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

Runs the evolutionary loop for this island.

Executes the local GA loop while handling asynchronous migration events and final global synchronization of the best result.

Parameters
populationThe local population to evolve.
Note
The population must be initialized before calling this method.

Implements galib::Algorithm< GeneType >.

Definition at line 212 of file IslandGA.h.

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


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