Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/ECJClient/src/ec/vector/README @ 10207

Last change on this file since 10207 was 6152, checked in by bfarka, 14 years ago

added ecj and custom statistics to communicate with the okb services #1441

File size: 6.2 KB
Line 
1This package, and the 'breed' subpackage contained inside, implement basic
2vector representations common in evolution
3strategies and genetic algorithms.  The package is straightforward.  There
4are various VectorIndividuals, each with an associated VectorSpecies that
5it uses to maintain certain constraints (such as the minimum and maximum
6gene values in the vector).
7
8VectorIndividuals can be used with any breeding pipeline you care to design,
9but since certain crossover and mutation methods are so common, the individuals
10themselves implement those methods, and the VectorMutationPipeline and
11VectorCrossoverPipeline are designed not to perform those methods but simply
12to trigger the individuals into performing it themselves.  Thus if you
13want to create a custom crossover procedure that's different from the
14standard ones, you can do so simply by overriding the appropriate
15defaultCrossover() method in the individual class, rather than making
16a new pipeline.
17
18VectorIndividuals also have significant numbers of hooks for variable-length
19vector representations.
20
21Note that there are different VectorIndividuals for different basic types.  For
22example, there's a BitVectorIndividual and a FloatVectorIndividual, etc.
23This doesn't use Java's generics facility.  Why?  Because Java's generics
24are *extremely* slow.  They simplify the implementation of code like this but
25at a very very high cost, and so ECJ just breaks out the individuals on a per-
26type basis for efficiency purposes.
27
28The various vector representations and their associated species and basic
29types are:
30
31INDIVIDUAL      SPECIES     BASIC TYPE
32BitVectorIndividual   VectorSpecies   boolean
33ByteVectorIndividual    IntegerVectorSpecies  byte
34ShortVectorIndividual   IntegerVectorSpecies  short
35IntegerVectorIndividual   IntegerVectorSpecies  int
36LongVectorIndividual    IntegerVectorSpecies  long
37FloatVectorIndividual   FloatVectorSpecies  float
38DoubleVectorIndividual    FloatVectorSpecies  double
39GeneVectorIndividual    GeneVectorSpecies VectorGene
40
41
42Some items to note about certain species:
43
44
45ec.vector.VectorSpecies
46
47This is the superclass of all vector species, and defines three kinds of
48crossover: one-point, two-point, and uniform crossover (referred to as 'any'),
49with a per-gene crossover probability for uniform crossover.  Additionally,
50a mutation probability specifies a per-gene likelihood of performing
51mutation on that gene (the kind of mutation depends on the particular
52vector individual being used).
53
54VectorSpecies also allows you to specify a *chunk size*.  Chunks are regions
55in which no crossover is allowed.  Crossover only occurs on chunk boundaries.
56This allows you, for example, to indicate that an individual consists of
57chunks 12 boolean values long (say), and that they are to be treated as atomic
58units by the crossover operator -- it can't cross over within the chunk.
59
60VectorSpecies is the species for BitVectorIndividual, as BitVectorIndividual
61doesn't need any special features.
62
63
64ec.vector.IntegerVectorSpecies
65
66IntegerVectorSpecies is a VectorSpecies and so has all the same features as it.
67Also, it allows you to specify min and max gene values for each
68gene in three different ways.  First, you can specify a global min and max
69value for all genes.  Second, you can specify _segments_ (regions in the
70genome) which all share the same min and max values.  Third, you can specify
71individual min and max values for each independent gene.  These three methods
72can be mixed as well: independent gene values override segments, which override
73global values.  Note that segments are not the same thing as chunks.
74
75The default mutation procedure for IntegerVectorSpecies genes is gene
76randomization.  Override this as you see fit.
77
78
79ec.vector.FloatVectorSpecies
80
81This class, like IntegerVectorSpecies, has all the features of VectorSpecies,
82and furthermore has min and max gene values specified on a global, segment,
83and per-gene basis. 
84
85The default mutation procedure for FloatVectorSpecies can be either
86randomization or adding gaussian random noise with a specified mutation
87standard deviation.  If the random noise exceeds the min and max bounds
88for that gene, FloatVectorSpecies will retry (you can specify how many
89times) before giving up and not mutating the gene.
90
91
92ec.vector.GeneVectorSpecies
93
94This class is a VectorSpecies and so has all of its features.  However the
95atomic type of the vector array isn't a number or boolean, but rather a
96specific object called a VectorGene; or more specifically, a subclass of
97VectorGene which you specify (with the 'gene' parameter).  The objective
98of this Species and GeneVectorIndividual is to enable you to have arbitrary
99genes of any kind you like -- just stick your data in your VectorGene
100subclass.
101
102
103
104
105Other classes of importance:
106
107
108ec.vector.VectorGene
109
110This class is used with GeneVectorIndividual and GeneVectorSpecies to give you
111flexibility with regard to the makeup of genes in the individual.  To implement
112a VectorGene subclass, you'll need to provide a few basic methods (equality
113testing, hash codes, the reset method, the mutation method) and optionally some
114print facilities, depending on your needs.
115
116
117ec.vector.breed.VectorMutationPipeline
118
119Defines a basic mutation breeding pipeline for vector individuals.  The class
120is very simple: when it is charged to produce a child, it requests a child
121from its source, then calls defaultMutate() on that child and returns it.
122
123
124ec.vector.breed.VectorCrossoverPipeline
125
126Defines a basic crossover breeding pipeline for vector individuals.  The class
127is very simple: when it is charged to produce children, it requests a child
128from each of its sources, then calls defaultCrossover() on one child, passing
129in the other child, to get them to cross over with one another. It then returns
130the children.
131
132
133ec.vector.breed.ListCrossoverPipeline [UNTESTED]
134
135Defines one-point and two-point crossover for vector individuals whose length may
136vary.  This crossover pipeline may be useful for representations which are lists
137rather than fixed-length vectors.
138
139
140ec.vector.breed.MultiCrossoverPipeline  [UNTESTED]
141
142Performs a version of N-person multiple crossover.  The size of N is determined
143by the number of sources provided to the pipeline.  For each gene, the gene
144values among the N indivdiuals are shuffled.  The resulting children are then
145returned.
146
147
Note: See TracBrowser for help on using the repository browser.