(N+1)-ES Simple Evolutionary Algorithm

class pagmo::sea

(N+1)-ES Simple Evolutionary Algorithm

../../_images/sea.png

Evolutionary strategies date back to the mid 1960s when P. Bienert, I. Rechenberg, and H.-P. Schwefel at the Technical University of Berlin, Germany, developed the first bionics-inspired schemes for evolving optimal shapes of minimal drag bodies in a wind tunnel using Darwin’s evolution principle.

This c++ class represents the simplest evolutionary strategy, where a population of \( \lambda \) individuals at each generation produces one offspring by mutating its best individual uniformly at random within the bounds. Should the offspring be better than the worst individual in the population it will substitute it.

Note
The algorithm does not work for multi-objective problems, nor for constrained optimization
Note
The mutation is uniform within box-bounds. Hence, unbounded problems will produce an error.
See
Oliveto, Pietro S., Jun He, and Xin Yao. “Time complexity of evolutionary algorithms for combinatorial optimization: A decade of results.” International Journal of Automation and Computing 4.3 (2007): 281-293.
See
http://www.scholarpedia.org/article/Evolution_strategies

Public Types

typedef std::tuple<unsigned int, unsigned long long, double, double, vector_double::size_type> log_line_type

Single entry of the log (gen, fevals, best, improvement, mutations)

typedef std::vector<log_line_type> log_type

The log.

Public Functions

sea(unsigned int gen = 1u, unsigned int seed = pagmo::random_device::next ())

Constructor.

Constructs a sea algorithm from the number of generations and the random seed.

Parameters
  • gen -

    Number of generations to consider. Each generation will compute the objective function once

  • seed -

    seed used by the internal random number generator

population evolve(population pop) const

Algorithm evolve method (juice implementation of the algorithm)

Return
evolved population
Parameters
  • pop -

    population to be evolved

Exceptions
  • std::invalid_argument -

    if the problem is multi-objective or constrained

void set_seed(unsigned int seed)

Sets the algorithm seed.

void set_verbosity(unsigned int level)

Sets the algorithm verbosity.

Sets the verbosity level of the screen output and of the log returned by get_log(). level can be:

  • 0: no verbosity
  • 1: will only print and log when the population is improved
  • >1: will print and log one line each level generations.

Example (verbosity 1): Gen, is the generation number, Fevals the number of function evaluation used, Best is the best fitness function currently in the population, Improvement is the improvement made by the las mutation and Mutations is the number of mutated componnets of the decision vector

Gen:        Fevals:          Best:   Improvement:     Mutations:
632           3797        1464.31        51.0203              1
633           3803        1463.23        13.4503              1
635           3815        1562.02        31.0434              3
667           4007         1481.6        24.1889              1
668           4013        1487.34        73.2677              2

Parameters
  • level -

    verbosity level

unsigned int get_seed() const

Gets the seed.

unsigned int get_verbosity() const

Gets the verbosity level.

std::string get_name() const

Algorithm name.

std::string get_extra_info() const

Extra informations.

const log_type &get_log() const

Get log.

A log containing relevant quantities monitoring the last call to evolve. Each element of the returned std::vector is a sea::log_line_type containing: Gen, Fevals, Best, Improvement, Mutations as described in sea::set_verbosity

Return
an std::vector of sea::log_line_type containing the logged values Gen, Fevals, Best, Improvement, Mutations

template <typename Archive>
void serialize(Archive &ar)

Serialization.