Documentation ¶
Overview ¶
Evo is a framework for implementing evolutionary algorithms in Go.
Evo exposes a clean and flexible API oriented around two interfaces: `Genome` and `Population`. Genomes represent both the function being optimized and the representation of solutions. Populations represent the architecture under which genomes are evolved. Multiple population types are provided by Evo to enable the construction of both common and novel architectures.
The body of the evolutionary loop is defined by an evolve function. For each genome in a population, the evolve function is called, receiving some subset of the population, called the suitors, as arguments. The evolve function then applies the user's variation operators (selection, mutation, etc) and returns a genome for the next iteration. common operators for a variety of representations are provided as subpackages of Evo.
Populations model the evolution patterns of genomes. A few different population types are provided by Evo under the package `evo/pop`. Populations themselves implement the Genome interface, making them composeable. Migration functions are provided to be used in this context, allowing go novel architectures like the island model.
Index ¶
- type ConditionFn
- type EvolveFn
- type Genome
- type Population
- type Stats
- func (s Stats) Count() int
- func (s Stats) Max() float64
- func (s Stats) Mean() float64
- func (s Stats) Merge(t Stats) Stats
- func (s Stats) Min() float64
- func (s Stats) Put(x float64) Stats
- func (s Stats) RSD() float64
- func (s Stats) Range() float64
- func (s Stats) SD() float64
- func (s Stats) String() string
- func (s Stats) Var() float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConditionFn ¶ added in v0.2.0
type ConditionFn func() bool
A ConditionFn describes a termination condition.
type EvolveFn ¶ added in v0.2.0
An EvolveFn describes an iteration of the evolution loop. The evolve function is called once for each member of the population, possibly in parrallel, and is responsible for producing new Genomes given some subset of the population, called the suitors. The replacement Genome replaces the current Genome within the population.
type Genome ¶
type Genome interface { // The Fitness method is the function being maximized. // For minimization problems, return the negative or the inverse. Fitness() float64 }
A Genome describes the function being optimized and the representation of solutions. Genomes are provided by the user, and Evo provides convenience packages for common representations.
type Population ¶
type Population interface { // Fitness returns the maximum fitness of the population. Fitness() float64 // Evolve starts the evolution of the population in a separate goroutine. // Genomes are evolved in place; it is not safe to access the genome slice // while the evolution is running. Evolve([]Genome, EvolveFn) // Stop terminates the optimization. Stop() // Poll executes a function at some frequency for the duration of the // current optimization. If the function returns true, the current // optimization is halted. Use a frequency of 0 for continuous polling. Poll(freq time.Duration, cond ConditionFn) // Wait blocks until the evolution terminates. Wait() // Stats returns various statistics about the population. Stats() Stats }
A Population models the interaction between Genomes during evolution. In practice, this determines the kind of parallelism and number of suitors during the optimization.
Populations implement Genome, making them composable. For example, an island model can be built by composing generational populations into a graph population.
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
A Stats object is a statistics collector. A common source of Stats objects is the return value of Population.Stats() which gives statistics about the fitness of genomes in the population.
func (Stats) RSD ¶
RSD returns the population relative standard deviation of the data, also known as the coefficient of variation.
Directories ¶
Path | Synopsis |
---|---|
Package perm provides common operators and helpers for integer permutations.
|
Package perm provides common operators and helpers for integer permutations. |
pop
|
|
gen
Package gen provides a traditional generational population.
|
Package gen provides a traditional generational population. |
graph
Package graph provides a spatial population for diffusion and island models.
|
Package graph provides a spatial population for diffusion and island models. |
Package sel provides helpers for different selection techniques.
|
Package sel provides helpers for different selection techniques. |