blob: 30a3c4ad5bdce7c2d4da7fab60661c245c2f295e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
package jcgp.backend.modules.es;
import jcgp.backend.modules.Module;
import jcgp.backend.modules.mutator.Mutator;
import jcgp.backend.population.Population;
import jcgp.backend.resources.Resources;
/**
* This class specifies the characteristics of an evolutionary strategy. The evolutionary
* strategy's job is to generate the next population of solutions. In JCGP this is done by modifying
* the provided population object rather than creating a new one.
* <br><br>
* A typical implementation of EvolutionaryStratey iterates through the chromosomes
* in the population and selects the individual(s) to be promoted. It then uses
* {@code mutator.mutate()} to generically mutate the promoted individual(s). Parameter-dependent
* strategies can be implemented by accessing the parameters via the resources
* argument.
* <br><br>
* Parameters may be specified to control the implemented strategy. Any parameters
* registered with {@code registerParameters()} should be displayed by the user interface,
* if it is being used. See {@link Module} for more information.
* <br><br>
* It is advisable to use {@code Resources.reportln()} and {@code Resources.report()}
* to print any relevant information. Note that reportln() and report() are affected
* by the report interval base parameter. Use {@code Resources.println()} and
* {@code Resources.print()} to print information regardless of the current generation.
* See {@link Resources} for more information.
*
* @see Module
* @author Eduardo Pedroni
*
*/
public abstract class EvolutionaryStrategy extends Module {
/**
* For internal use only, initialises the resources field.
*
* @param resources the experiment's resources.
*/
protected EvolutionaryStrategy(Resources resources) {
super(resources);
}
/**
* Performs the selection algorithm and uses the mutator to create
* the next generation of solutions.
*
* @param population the population to evolve.
* @param mutator the mutator with which to mutate the promoted individuals.
*/
public abstract void evolve(Population population, Mutator mutator);
}
|