summaryrefslogtreecommitdiffstats
path: root/watchmaker/book/src/xml/islands.xml
blob: e7943f8506de579950133be315b9e9e81d77cb60 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<chapter xmlns="http://docbook.org/ns/docbook"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://docbook.org/ns/docbook http://www.docbook.org/xml/5.0/xsd/docbook.xsd">
  <title>Island Models</title>
  <indexterm><primary>island models</primary></indexterm>
  <indexterm><primary>Australia</primary></indexterm>
  <para>
    In the natural world, populations of organisms might be separated by geography.  Left to evolve in isolation
    over millions of years, vastly different species will occur in different locations.  Consider Australia,
    an island continent protected by its seas.  With little opportunity for outside organisms to
    interfere, and few opportunities for its land-based organisms to migrate to other land masses, Australian
    wildlife evolved to be distinctly different from that of other continents and countries.  The majority of
    Australia's plant and animal species, including 84% of its mammals, are endemic.  They occur nowhere else
    in the world.
  </para>
  <indexterm><primary>Darwin, Charles</primary></indexterm>
  <indexterm><primary>Galápagos Islands</primary></indexterm>
  <para>
    Australia is not the only island to exhibit such levels of endemism.  It was a visit to the Galápagos
    Islands in 1835 that started Charles Darwin on the path to formulating his theory of evolution.  Darwin
    noticed the pronounced differences between the species of mocking birds and tortoises present on the
    different islands of the archipelago and began to speculate on how such variations might have occurred.
  </para>
  <para>
    In the world of evolutionary computation we can mimic this idea of having multiple isolated populations
    evolving in parallel.  Having additional populations would increase the likelihood of finding a solution that
    is close to the global optimum.  However, it is not just a question of having a larger global population.
    A system of 10 islands each with a population of 50 individuals is not equivalent to a single island with a
    population of 500.  The reason for this is that the island system partitions the search.  If one island
    prematurely converges on a sub-optimal solution it does not affect the evolution happening on the other
    islands; they are following their own paths.  A single large population does not have this in-built
    resilience.
  </para>
  <section>
    <title>Migration</title>
    <indexterm><primary>migration</primary></indexterm>
    <indexterm><primary>island models</primary><secondary>migration</secondary></indexterm>
    <para>
      There is of course no real difference between evolving 10 completely separate islands in parallel and running
      the same single-population evolution 10 times in a row, other than how the computing resources are utilised.
      In practice the populations are not kept permanently isolated from each other and there are occasional
      opportunities for individuals to migrate between islands.
    </para>
    <para>
      In nature external species have been introduced to foreign ecosystems in several ways. In an ice age the waters
      that previously separated two land masses might freeze providing a route for land animals to migrate to
      previously unreachable places. Microorganisms and insects have often strayed beyond their usual environment by
      hitching a ride with larger species.
    </para>
    <indexterm><primary>rabbits</primary></indexterm>
    <indexterm><primary>Austin, Thomas</primary></indexterm>
    <para>
      The effect of introducing a foreign species to a new environment can vary.  The new species might be
      ill-adapted to its new surroundings and quickly perish.  Alternatively, a lack of natural predators
      may cause it to flourish, often to the detriment of indigenous species.  One such example is the
      introduction of rabbits to Australia.  Australia was a land without rabbits until the arrival of European
      settlers.  An Englishman named Thomas Austin released 24 rabbits into the wild of Victoria in October 1859
      with the intention of hunting them.  If rabbits are famous for one thing it is for reproducing prodigiously.
      The mild winters allowed year-round breeding and the absence of any natural rabbit predators, such as foxes,
      allowed the Australian rabbit population to explode unchecked.  Within 10 years an annual cull of two million
      rabbits was having no noticeable effect on rabbit numbers and the habitats of some native animals were being
      destroyed by the floppy-eared pests.  Today there are hundreds of millions of rabbits in Australia, despite
      efforts to reduce the population, and the name of Thomas Austin is widely cursed for his catastrophic lack
      of foresight.
    </para>
    <para>
      While such invasions of separate species provide a useful analogy for what can happen when we introduce migration
      into island model evolutionary algorithms, we are specifically interested in the effects of migration involving
      genetically different members of the same species.  This is because, in our simplified model of evolution,
      all individuals are compatible and can reproduce.  The island model of evolution provides the isolation necessary
      for diversity to thrive while still providing opportunities for diverse individuals to be combined to produce
      potentially fitter offspring.
    </para>
    <para>
      In an island model, the isolation of the separate populations often leads to different traits originating on
      different islands.  Migration brings these diverse individuals together occasionally to see what happens when
      they are combined.  Remember that, even if the immigrants are weak, cross-over can result in offspring that are
      fitter than either of their parents.  In this way, the introduction to the population of new genetic building
      blocks may result in evolutionary progress even if the immigrants themselves are not viable in the new
      population.
    </para>
  </section>
  <section>
    <title>Islands in the Watchmaker Framework</title>
    <indexterm><primary><classname>IslandEvolution</classname></primary></indexterm>
    <para>
      The Watchmaker Framework for Evolutionary Computation supports islands models via the
      <classname>IslandEvolution</classname> class.  Each island is a self-contained
      <classname>EvolutionEngine</classname> just like those we have been using previously for single-population
      evolutionary algorithms.  The evolution is divided into <emphasis>epochs</emphasis>.  Each epoch consists
      of a fixed number of generations that each island completes in isolation.  At the end of an epoch migration
      occurs.  Then, if the termination conditions are not yet satisfied, a new epoch begins.
    </para>
    <para>
      The <classname>IslandEvolution</classname> supports pluggable migration strategies via different implementations
      of the <interfacename>Migration</interfacename> interface.  An island version of the string evolution example
      from <xref linkend="watchmaker_chapter" /> might look something like this:
    </para>
    <indexterm><primary><interfacename>Migration</interfacename></primary></indexterm>
    <indexterm><primary><classname>RingMigration</classname></primary></indexterm>
    <informalexample>
      <programlisting language="java">
<![CDATA[IslandEvolution<String> engine
    = new IslandEvolution<String>(5, // Number of islands.
                                  new RingMigration(),
                                  candidateFactory,
                                  evolutionaryOperator,
                                  fitnessEvaluator,
                                  selectionStrategy,
                                  rng);

engine.evolve(100, // Population size per island.
              5, // Elitism for each island.
              50, // Epoch length (no. generations).
              3, // Migrations from each island at each epoch.
              new TargetFitness(0, false));]]>
      </programlisting>
    </informalexample>
    <indexterm><primary><interfacename>IslandEvolutionObserver</interfacename></primary></indexterm>
    <indexterm><primary><methodname>populationUpdate</methodname></primary></indexterm>
    <indexterm><primary><methodname>islandPopulationUpdate</methodname></primary></indexterm>
    <para>
      We can add listeners to an <classname>IslandEvolution</classname> object, just as we can with individual
      <interfacename>EvolutionEngine</interfacename>s.  We use a different interface for this though,
      <interfacename>IslandEvolutionObserver</interfacename>, which provides two call-backs.
      The <methodname>populationUpdate</methodname> method reports the global state of the combined population
      of all islands at the end of each epoch.  The <methodname>islandPopulationUpdate</methodname> method reports
      the state of individual island populations at the end of each generation.
    </para>
    <section>
      <title>Advanced Usage</title>
      <indexterm><primary><classname>GenerationalEvolutionEngine</classname></primary><secondary>island evolution</secondary></indexterm>
      <para>
        In the example code above we specified how many islands we wanted to use and the
        <classname>IslandEvolution</classname> class created one <classname>GenerationalEvolutionEngine</classname>
        for each island.  Using this approach all of the islands have the same configuration; they use the same
        candidate factory, evolutionary operator(s) and selection strategy.  This is the easiest way to create an
        island system but it is also possible to construct each island individually for ultimate flexibility.
      </para>
      <informalexample>
        <programlisting language="java">
<![CDATA[List<EvolutionEngine<String>> islands
    = new ArrayList<EvolutionEngine<String>>();

// Create individual islands here and add them to the list.
// ...

IslandEvolution<String> engine
    = new IslandEvolution<String>(islands,
                                  new RingMigration(),
                                  false, // Natural fitness?
                                  rng);]]>
        </programlisting>
      </informalexample>
      <para>
        One reason you might choose to construct the islands explicitly is that it makes it possible to configure
        individual islands differently.  You may choose to have different islands use different parameters
        for evolutionary operators, or even to use different evolutionary operators all together.  Alternatively,
        you could use the same evolutionary operators and parameters but have different selection strategies so that
        some islands have stronger selection pressure than others.  You should generally use the same fitness function
        for all islands though, otherwise you might get some strange results.
      </para>
      <indexterm><primary><classname>SteadyStateEvolutionEngine</classname></primary><secondary>island evolution</secondary></indexterm>
      <indexterm><primary><classname>EvolutionStrategyEngine</classname></primary><secondary>island evolution</secondary></indexterm>
      <para>
        Another possible reason for creating the islands explicitly is so you don't have to use the standard
        <classname>GenerationalEvolutionEngine</classname> for the islands.  You can choose to use any implementation
        of the <interfacename>EvolutionEngine</interfacename> interface, such as the
        <classname>SteadyStateEvolutionEngine</classname> class or the <classname>EvolutionStrategyEngine</classname>
        class.  You can even use a mixture of different island types with the same
        <classname>IslandEvolution</classname> object.
      </para>
    </section>
  </section>
</chapter>