Application interface

This article briefly describes the application interface of nage's evolutionary algorithms library.
The core module contains the main classes and interfaces for writing evolutionary algorithms, along with many abstract high-level implementations.

Note about parameterized strategies

Most strategies in solution packages are parameterized by some TSol suptype of ISolution.
This is usually the type of solution they are able to perform some operations on
(e.g. factories, mutations, etc.). Instances of these strategies need to provide
an actual type parameter. That way, we can be type-safely put together multiple genetic
operators which can inter-operate together, while being sure that any of them won't
get solutions of a type it does not support.

Solution

solution.png

Nage.Algorithms.Solution.ISolution

ISolution is the most general interface for describing potential solutions in an evolutionary algorithm. It consists of a representation, which can be associated with some evaluation in the context of a given population.

Nage.Algorithms.Solution.ISolutionFactory

ISolutionFactory<TSol> is a factory and strategy interface for creating and copying solutions. To keep solutions as simple as possible, the responsibility of creating new instances is given to this dedicated strategy.
Factories can create empty solutions, solutions initialized with respect to some problem or copy existing ones. They also decide of representations actual implementation.
ISolutionFactory<TSol> is a parameterized type - its type parameter TSol reflects the type of solutions being created by some given factory.

Nage.Algorithms.Solution.ISolutionEvaluator

ISolutionEvaluator<TSol> is a strategy interface for evaluating solutions. It is parameterized by the type of solutions it supports.
When given a solution, evaluators should return a double value. This value is the fitness of the solution in the context of the problem being solved.

Generally, evolutionary algorithms aim to maximize the fitness function. If you are given with a cost function you need to minimize instead, you will need to transform it somehow into a fitness function. It may be usually done by negating the cost function.

Evaluators may or may not be idempotent - they may return the same value when asked about an identical solution (with regard to representation), or they may return a different value on each consecutive evaluation.

Population

population.png

Nage.Algorithms.Population.IPopulation

IPopulation<TSol> is a general interface for describing populations, that is collections of solutions, along with their evaluations.
It is a parameterized type - its type parameter TSol reflects the type of solutions being held in the population.

Populations associate solutions' representation with some evaluation. This evaluation reflects the quality of the representation in the context of the problem being solved.

IPopulation represents a mapping between solutions and their evaluations. A solution can then have multiple evaluations during its lifecycle - each is defined in the context of some population.

Nage.Algorithms.Population.IPopulationFactory

IPopulationFactory<TSol> is a factory and strategy interface for creating populations. It is parameterized just like the populations it creates.

Implementations should rely on ISolutionFactory<TSol> instances to create the actual solutions. However, different strategies may be implemented in order to assemble populations out of such solutions, effectively defining initial conditions of the evolutionary algorithm.

Evolution

evolution.png

Nage.Algorithms.Evolution.IPopulationMutation

IPopulationMutation<TSol> defines a strategy for mutating a population.

Nage.Algorithms.Evolution.IPopulationRecombination

IPopulationRecombination<TSol> defines a strategy for recombining a population.

Nage.Algorithms.Evolution.ISolutionMutation

ISolutionMutation<TSol> is the strategy that actually performs the mutation of a given solution.

Nage.Algorithms.Evolution.ISolutionRecombination

ISolutionRecombination<TSol> is the strategy that actually performs the recombination of two given solutions.

Nage.Algorithms.Evolution.IEvolution

IEvolution<TSol> is the basic interface for transforming populations.

Stop

stop.png

Nage.Algorithms.Stop.IStopCondition

IStopCondition defines when the generation should stop.

Nage.Algorithms.Stop.FixedStepsStopCondition

FixedStepsStopCondition is a basic implementation of IStopCondition interface. It stops the workplaces after a given number of steps, specified to the constructor.

Wrappers

wrappers.png

Nage.Algorithms.IGeneticAlgorithm

IGeneticAlgorithm<TSol> defines an abstraction layer of genetic algorithm putting togeter all of the components like evolution operators or stop condition etc.

Nage.Algorithms.GeneticAlgorithm

GeneticAlgorithm<TSol> provides a basic skeleton implementation of genetic algorithm

Nage.Algorithms.IGAWrapper

IGAWrapper provides a solution-type unaware wrapper interface for IGeneticAlgorithm

Nage.Algorithms.GAWrapper

GAWrapper<TSol> provides a basic implementation of GA wrapper that prints every generation to standard output while proceeding.

Last edited Jan 8, 2013 at 3:21 PM by marochm, version 6

Comments

No comments yet.