Selection

This section describes how selection works. Related classes can be found in the package org.evolvica.core.select.

Basics

Selection is a little bit difficult because it breaks the concept of operators that send and receive individual sets. In principle a selection operator select pairs of two (at least mostly, but there may be more) individuals from a selection pool. More abstract: a selector takes an inidividual set as input and creates an individual set as its output. So far so good, but the created individual set has one major difference to normal sets: it may contain references to one and the same individual more than once! For this reason a user must make sure that the successing operator (the receiver of the set) is able handle this. A the moment there's NO differentiation between sets which contain individuals more than once and normal sets.
Beside this fact there's not so much to say about selection. The appropriate interface is org.evolvica.core.select.ISelector and an abstract base class for a selector is org.evolvica.core.select.AbstractSelector. Basically a selector must implement the method IIndividual[] select( IIndividual[] pool ) which takes the selection pool (the input of the operator) and creates a new array of individuals as an output. This array does not indicate in any way if there selected pairs of triples or what else. The first pair is just the first two individuals in the array, the second pair the second two and so on. It must be ensured that a successing operator can deal with this structure. A recombinator that takes three individuals as parents will also work with such an array but it may produce strange results.
There are several predefined selection operators already provided, please refer to the API documentation to find out what they do.