PaGMO  1.1.5
Data Structures | Public Member Functions | Protected Member Functions | Friends
pagmo::algorithm::sga_gray Class Reference

The Simple Genetic Algorithm with gray encoding (sga_gray) More...

#include <sga_gray.h>

Inheritance diagram for pagmo::algorithm::sga_gray:
Inheritance graph
[legend]

Data Structures

struct  crossover
 Crossover operator info. More...
 
struct  mutation
 Mutation operator info. More...
 
struct  selection
 Selection info. More...
 

Public Member Functions

 sga_gray (int gen=1, const double &cr=.95, const double &m=.02, int elitism=1, mutation::type mut=mutation::UNIFORM, selection::type sel=selection::ROULETTE, crossover::type cro=crossover::SINGLE_POINT)
 Constructor. More...
 
base_ptr clone () const
 Clone method.
 
void evolve (population &) const
 Evolve implementation. More...
 
std::string get_name () const
 Algorithm name.
 
- Public Member Functions inherited from pagmo::algorithm::base
 base ()
 Default constructor. More...
 
virtual ~base ()
 Trivial destructor. More...
 
std::string human_readable () const
 Return human readable representation of the algorithm. More...
 
void set_screen_output (const bool p)
 Setter-Getter for protected m_screen_output data. More...
 
bool get_screen_output () const
 Gets screen output. More...
 
void reset_rngs (const unsigned int) const
 Resets the seed of the internal rngs using a user-provided seed. More...
 

Protected Member Functions

std::string human_readable_extra () const
 Extra human readable algorithm info. More...
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Protected Attributes inherited from pagmo::algorithm::base
bool m_screen_output
 Indicates to the derived class whether to print stuff on screen.
 
rng_double m_drng
 Random number generator for double-precision floating point values.
 
rng_uint32 m_urng
 Random number generator for unsigned integer values.
 
unsigned int m_fevals
 A counter for the number of function evaluations.
 

Detailed Description

The Simple Genetic Algorithm with gray encoding (sga_gray)

Simple Genetic algorithms are very popular algorithms used widely by people of very different backgrounds. Contrary to PAGMO::SGA, this implementation uses a binary encoding and some common mutation and crossover strategies.

Mutation is random, crossover uniform and selection is roulette or best20 (i.e. 20% best of the population is selected and reproduced 5 times).

The algorithm works on single objective, box constrained problems.

Author
Jeremie Labroquere (jerem.nosp@m.ie.l.nosp@m.abroq.nosp@m.uere.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)

Definition at line 50 of file sga_gray.h.

Constructor & Destructor Documentation

pagmo::algorithm::sga_gray::sga_gray ( int  gen = 1,
const double &  cr = .95,
const double &  m = .02,
int  elitism = 1,
mutation::type  mut = mutation::UNIFORM,
selection::type  sel = selection::ROULETTE,
crossover::type  cro = crossover::SINGLE_POINT 
)

Constructor.

Allows to specify in detail all the parameters of the algorithm.

Parameters
[in]genNumber of generations to evolve.
[in]crCrossover probability (of each individual)
[in]mMutation probability (of each encoded bit)
[in]elitismthe best individual is reinserted in the population each elitism generations. If a elitism of 0 is set, then the elitism is avoided.
[in]mutMutation type. sga_gray::mutation::UNIFORM
[in]selSelection type. One of sga_gray::selection::BEST20, sga_gray::selection::ROULETTE
[in]croCrossover type. One of sga_gray::crossover::SINGLE_POINT
Exceptions
value_errorif gen is negative, crossover probability is not $ \in [0,1]$, mutation probability is not $ \in [0,1]$, elitism is <=0

Definition at line 59 of file sga_gray.cpp.

Member Function Documentation

void pagmo::algorithm::sga_gray::evolve ( population pop) const
virtual

Evolve implementation.

Run the simple genetic algorithm for the number of generations specified in the constructors. At each improvment velocity is also updated.

Parameters
[in,out]popinput/output pagmo::population to be evolved.

We now set the cleared pop. cur_x is the best_x, re-evaluated with new seed.

Implements pagmo::algorithm::base.

Definition at line 92 of file sga_gray.cpp.

std::string pagmo::algorithm::sga_gray::human_readable_extra ( ) const
protectedvirtual

Extra human readable algorithm info.

Will return a formatted string displaying the parameters of the algorithm.

Reimplemented from pagmo::algorithm::base.

Definition at line 233 of file sga_gray.cpp.


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