Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKBJavaConnector/ECJClient/src/ec/README @ 13402

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

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

File size: 8.3 KB
Line 
1This README is with regard to the 'ec' package in this directory.  Various
2subdirectories contain READMEs of their own for their respective packages.
3If you're looking for overall documentation for ECJ, see the README file
4for the parent directory of this one (that is, the 'ecj' directory).
5
6The 'ec' package contains top-level abstract classes defining most of the
7major elements of evolutionary or stochastic search processes.  You probably
8don't want abstract classes: instead you may wish to examine the 'simple'
9subpackage for concrete implementations of these classes which perform
10basic evolutionary tasks.
11
12
13
14
15DESIGN PATTERNS IN ECJ
16----------------------
17
18ECJ's basic classes sit on a set of simple interfaces defining what would now
19be called 'design patterns'.  Nearly all classes in ECJ use one or more of
20these interfaces, and together the interfaces are largely responsible for
21ECJ's dynamic loading facilities.
22
23
24ec.Setup
25
26ec.Setup is ECJ's top-level design pattern interface.  Setup defines a single
27method, setup(...), which acts as a sort of alternative constructor for
28instances which implement it.  In ECJ most classes are loaded at runtime
29from ECJ's ParameterDatabase.  Instances from such classes are dynamically
30instantiated using their default (no-argument) constructor; the setup(...)
31method then is called to give the objects a chance to set themselves up
32properly from the ParameterDatabase.  This approach was largely done because
33early versions of reflection in Java were inadequate.
34
35ec.Prototype
36
37Prototypes are Setups which are cloneable.  An class implementing Prototype
38is meant to have a single instance of the class (the "prototypical instance")
39loaded and setup from the Parameter Database; further instances of the class
40are constructed by cloning the prototypical instance. A large number of
41ECJ objects are Prototype, including Individuals and various components of
42Individuals (such as genetic programming tree nodes).
43
44Many ECJ Prototypes support the so-called "flyweight" design pattern, whereby
45large numbers of lightweight instances share a common single special object
46which acts as a repository of default information common to all of them.
47In Java this could be implemented using static members, but static members
48are challenging to serialize (an important thing in ECJ), and so ECJ instead
49uses an actual object instead. 
50
51ec.Group
52
53Groups are very similar to Prototypes: their primary difference is that there
54is no prototypical Group: rather, new Groups can be cloned from currently
55in-use Groups using the method emptyClone().  Examples of Groups include
56Populations and Subpopulations.
57
58ec.Singleton
59
60Singletons are also Setups but are meant to be global objects: only one
61instance is ever loaded and setup during the course of a run.  Most top-level
62objects (like ECJ's EvolutionState, Breeder, Evaluator, etc. objects) are
63Singletons.
64
65ec.Clique
66
67Cliques are Setups which are small groups of instances of a single class.
68Like Singletons, Cliques are global.  Once the collection of Cliques are loaded
69and setup, no more are usually created.  Cliques are associated with globally
70accessible tables which enable access to all members of the clique.  Cliques
71include genetic programming function sets, genetic programming types, etc.
72
73
74
75THE MAKEUP OF AN EVOLUTIONARY SYSTEM
76------------------------------------
77
78ec.Population
79ec.Subpopulation
80ec.Individual
81
82ECJ's evolutionary system is centered around a single Population, which
83contains an array of Subpopulations.  Each Subpopulation contains an array of
84Individuals.  This structure is largely to support techniques such as
85coevolution which require more than one "population".  In ECJ such methods
86use one or more Subpopulation class to support this.  Though you will likely
87use Population and Subpopulation classes directly, almost certainly you'll
88need to subclass Individual to define its representation.  A number of
89predefined Individuals are available for you.
90
91ec.Species
92
93Individuals in ECJ support the flyweight pattern (see discussion of
94ec.Prototype above) and ec.Species is their collective object.  Many Individuals
95in ECJ share a common Species.  Each Subpopulation is also associated
96with the Species used by Individuals in that Subpopulation.  Note that
97multiple subpopulations, and different groups of Individuals, might
98use the same Species in theory.
99
100The Species object contains the prototypical Individual from which other
101Individuals of that Species are cloned; and also contain Breeding Pipelines
102(see below) which enable Individuals to be bred from other Individuals of
103that Species.
104
105ec.Fitness
106
107Each ECJ individual contains a Fitness.  Different kinds of individuals
108can have different kinds of fitness objects (say, multiobjective fitness
109objects, or single-objective GA-style fitness objects, etc.).  The Fitness
110class is abstract: various Fitness subclasses perform different kinds of
111Fitness concepts.
112
113
114
115
116DOING EVOLUTION
117---------------
118
119ec.Evolve
120
121This class is the entry point for ECJ (it contains the main() method), but
122in fact it does relatively little: its main task is to load an EvolutionState
123from the parameter database, then get it going.
124
125ec.EvolutionState
126
127ECJ's top-level evolutionary loop is handled by subclasses of EvolutionState.
128EvolutionState also contains pointers to all the major elements of evolution,
129and ultimately everything in the entire evolutionary system.  Thus the entire
130process can be serialized (checkpointed) to disk simply by serializing
131EvolutionState.  When ECJ creates an evolutionary process, it first constructs
132an EvolutionState, then has the EvolutionState set up the rest of the process
133from the parameter database.  Because EvolutionState holds everything, it is
134often passed to many functions.
135
136ec.Initializer
137ec.Finisher
138
139To create a random  population and begin evolution, EvolutionState calls upon a
140subclass of Initializer. Likewise, just before quitting, EvolutionState
141calls upon some subclass of Finisher to clean up.
142
143ec.Evaluator
144ec.Problem
145
146EvolutionState calls upon Evaluator to evaluate the population.  Most
147Evaluators are straightforward: go through the population and evaluate each
148individual in turn.  But certain techniques require custom evaluation (such
149as coevolution).  The evaluator relies on a Problem subclass to do its dirty
150work: actually testing a given individual and assessing its fitness.  The
151experimenter (you) is required to provide a Problem subclass for his problem.
152Most of the examples in the "app" directory are largely Problem implementations.
153Often the Evaluator can work in parallel, cloning several Problems, then
154creating several threads, one thread per Problem, in order to assess the
155population more rapidly.
156
157ec.Breeder
158ec.BreedingSource
159ec.BreedingPipeline
160ec.SelectionMethod
161
162To breed a population to form a new population the EvolutionState relies on
163a subclass of Breeder.  Most Breeders work by constructing a "breeding
164pipeline" which selects individuals from the original population, mutates and
165crosses them over, and produces new children.  The breeding pipeline typically
166contains two kinds of objects: SelectionMethod objects, which pick individuals
167from the old population; and BreedingPipeline objects, which receive
168individuals from SelectionMethods or from other BreedingPipeline objects, and
169then mutate or cross over the individuals.  Both BreedingPipeline and
170SelectionMethod objects are BreedingSources (things other BreedingPipelines
171can get individuals from).  Many breeders can work in parallel,
172constructing several breeding pipelines, one per thread, to speed up the task
173of breeding individuals and forming the next generation.
174
175ec.Exchanger
176
177In between breeding and evaluation, the EvolutionState calls on a subclass
178of Exchanger.  The default implementations do nothing at all, but certain
179versions (like IslandExchange) take this opportunity to exchange individuals
180with far-of processes on other machines.
181
182
183
184STATISTICS
185----------
186
187ec.Statistics
188
189ECJ relies on one or more subclasses of Statistics to write out statistics
190information to various logs.  Statistics can be strung out in a chain, enabling
191you to include as many different Statistics objects as you like.  Different
192Statistics subclasses are available to do various tasks.  Statistics objects
193are called at all sorts of times in the run, in-between nearly every major
194operation, to give you a lot of hooks in which to probe the current state of
195the system.
196
Note: See TracBrowser for help on using the repository browser.