Artificial Life Lecture 16 - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

Artificial Life Lecture 16

Description:

... in Evolutionary Algorithms. GA CTRNN exercise, strong hints ... Rules: s- ab a- 1c b- 00 c- 00 d- 11 e- 10. cd 01 11 10 00 01. Growth: s ab 1c00. cd 0111 ... – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 36
Provided by: InmanH
Category:

less

Transcript and Presenter's Notes

Title: Artificial Life Lecture 16


1
Artificial Life Lecture 15
  • Genotype to Phenotype mappings in Evolutionary
    Algorithms
  • GACTRNN exercise, strong hints
  • Morphogenesis recap

You want to translate any possible trial-solution
to your problem into (typically) a string of
numbers of artificial DNA so that any arbitrary
string of DNA can be mapped back into a possible
solution, and then evaluated.
2
Your decision
This is where you have to decide what is most
reasonable for your particular problem, bearing
in mind
  • Ideally similar-ish potential-solutions (in
    phenotype space) should be encoded by similar-ish
    strings (in genotype space
  • Simpler methods generally better
  • But pretty much all reasonable mappings will
    work, so dont get too paranoid!

3
Suppose
  • Suppose you wanted to evolve the weights of a
    Neural Network (plus perhaps the biases, and
    maybe the time-parameters if it is a DRNN).
  • Choices
  • Shall I encode in real values or binary?
  • What about lower/upper limits of range?

4
Encoding in real values
Use doubles or floats on your genotype float
my_genotypeLENGTH Initialise random population
typically to random numbers drawn from an
appropriate range. Maybe -1,1, or -2,2 for
a NN, depending on what is reasonable for
specific job.
5
Mutating Real numbers
Various possibilities for mutating real
numbers One possibility is to change any
mutated locus to a randomly chosen real number
within the appropriate range -- but this is
very disruptive. So more usually a form of
'creep mutation' is used eg. add a random number
in range -0.1 0.1 or add a random number drawn
from a Gaussian distribution with mean zero, and
appropriate range.
6
Mutating real numbers
Important whereas when mutating bit-strings, a
rule of thumb is mutate around 1 bit per
(non-junk part of the) genotype, when mutating
real numbers a rule of thumb is mutate all of
them a little bit. Cheap way add a (ve/-ve)
small creep factor to every real number on the
genotype. Probably OK, but has biases towards
corners of the hypercube.
7
More principled way
To get a small random change to the vector in
N-space that a genotype of N real numbers
represents-
  • On each of N axes in N-space, construct a vector,
    length is from a Gaussian mean 0.0 std. dev 1.0
  • Add to make a vector in N-space. Normalise length
    to 1.0.
  • Multiply by a creep factor, from Gaussian mean
    0.0, length creep (e.g. 0.1). This is the
    mutation.

8
Limits for real-valued genes
Typically there may be no need to impose
lower/upper limits on real-valued genes. But
sometimes there is, eg for a time-parameter in a
CTRNN it definitely should remain positive. But
in this special case it is probably best to have
the gene encode a real-value T, and then the
actual time parameter is (eg) translated as
10T. Then no absolute need to bound range of T.
9
Limits (ctd)
Nevertheless, there may be some circumstances in
which you want lower/upper bounds on a real value
under mutation. Simplest solution have normal
creep mutation, and check result after mutated
if over top bound, reduce back to top bound, and
likewise with lower bound.
10
Encoding with binary
  • Here you have 2 basic decisions
  • How many bits precision? Is 4 bits enough? 8
    bits?
  • Depends on problem, initially start with rather
    few!
  • (2) And here you definitely have to decide on
    lower and upper bounds

8 bits gives numbers in range 0 to 255. For NN
weights you might linearly scale this into eg
-2,2 or -10,10, depending on what seems
reasonable. Decisions!
11
Gray Coding
This is a 1-1 mapping which means that any 2
adjoining numbers are encoded by genes only 1
mutation apart (tho note reverse is not true!)
-- no Hamming Cliffs Rule of thumb to translate
binary to Gray Start from left, copy the first
bit, thereafter when digit changes write
1 otherwise write 0. Example with 3 bit
numbers --
Bin Actual Gray 000 0
000 001 1 001 010 2
011 011 3 010 100 4
110 101 5 111 110 6
101 111 7 100
12
Gray Program Code
/ Gray ltgt binary conversion routines /
/ written by Dan T. Abell, 7 October 1993 /
/ please send any comments or suggestions /
/ to dabell_at_quark.umd.edu / For genotypes of
length n F. Gray, "Pulse Code Communication",
U. S. Patent 2 632 058, March 17, 1953.
13
Gray to Binary
void gray_to_binary (allele Cg, allele Cb,int
n) int j Cb Cg
/ copy the high-order bit /
for (j 0 j lt n-1 j) Cb--
Cg-- / for the remaining bits /
Cb (Cb1)Cg / do the appropriate
XOR /
14
Binary to Gray
void binary_to_gray(allele Cb,allele Cg,int n)
int j Cg Cb
/ copy the high-order bit / for
(j 0 j lt n-1 j) Cg--
Cb-- / for the remaining bits /
Cg (Cb1)Cb / do the appropriate
XOR / / difference from
gray_to_binary in very last term Cb/Cg /
15
Different virtues of binary and real encoding
Some problems just naturally seem to ask for
real-value encoding. But it is not entirely clear
from GA theory how to set mutation rates. One way
is to consider the N-valued genotype as a point
in N-dim space, and mutation as a small shift of
this point. Creep, with a high probability
(maybe even 100) of shifting each value by a
small amount, is a crude way of doing this.
16
Binary encoding
On the one hand, binary encoding seems a bit
unnatural for some problems. However, on the
other hand there is an unambiguous method of
mutating binary. And clearer notions of
preferred mutation rates. With standard selection
pressure (eg tournament selection size 2), around
1 mutation per genotype (possibly more if
redundancy in encoding).
17
The GA CTRNN exercise
  • One way (out of many possible ways) will be
    posted on the website next week...but here are
    some strong hints
  • Choices to make genotype will encode parameters
    of a CTRNN with say NN nodes (NN2? NN3?)
  • How many real numbers?
  • Weights from each node to all others (jnc self)
    NNNN
  • Each node has a bias, time parameter 2NN more
  • Total NNNN 2NN real numbers

18
Ranges of numbers
Define a range for the weights, biases, eg -5.0,
5.0 What about the time parameters? These
cannot be negative, or indeed zero! So if they
are also initialised in the range -5,5, they
must get translated into some positive
values. Code on website takes 1.0 absolute
value, i.e. -5.0, 5.0 -gt actual time parameters
1.0, 6.0 Or, you could make actual time
parameter 10T
19
How do you update the nodes?
Have an array with current values at each
node. Initialise at random. Or (professional)
look into center-crossing, Mathayomchan, B. and
Beer, RD (2002
Update rule, where yi is the current value of ith
node
20
Translate update rule
Delta_y_i (Delta_t / tau_i) RHS of above
eqn. It is crucially important to make a sensible
choice of your update time-step Delta_t !!!
Setting it equal to 1 is almost certainly wrong,
and a criminal offence!!! Delta_t should be made
significantly smaller than the smallest time
parameter in the system.
21
Why should timesteps be small?
Consider this parabola y x2
This represents the slope of the tangent. But if
you are sliding down the hill, you cannot assume
the slope is constant for a distance 1.0,
It is only nearly constant for a tiny distance
delta_x
22
Timesteps rule of thumb
Take the shortest length of real time within
which the system might change more than a minute
fraction e.g. with a CTRNN, the smallest
possible time parameter is a guideline, Then,
make your update time-step smaller than that, eg
1/10 (or at a pinch, 1/3). Reality check if
making your timestep even smaller will affect the
results you get, then it wasnt small enough!
23
Euler integration
So your succession of updates of node values are
an approximation (hopefully a close one) to the
real-time continuous version. Set up your trial
conditions, to see how well the CTRNN performs at
this task. In this case provide a steadily
changing input value on one node, and keep track
of the output of a designated output-node how
close to right value?
24
More decisions
How long should the trial be? Should I wait a
bit, before testing for answer-output? Should I
take an instantaneous output, or average over
time? Probably the latter. Several trials with
different test-cases. Etc, etc.
25
Morphogenesis origin of shape (recap)
How does one cell split and double, time and
again, and differentiate into all the cells of a
plant, animal or human ? All the cells of a body
have the same DNA, but different genes are
'turned on' in different cells, so some are skin,
some liver, some blood ... .....
General assumption the DNA does not specify 'as
some kind of description' the final form of the
body. More like 'a recipe' for baking a cake.
26
Morphogenesis in Alife
Biological morphogenesis has been the great black
hole in biological theory -- though some see
promising signs of real progress in the last
decade or so. A typical Alife approach is to
look at possible, very general, ways to generate
complex forms from relatively simple rules --
often very abstract. See many references in
Proceedings of Alife conferences
27
Different approaches - formal
One style of approach is top-down and
mathematical, often based on formal language
theory. Set up some formal language such that a
string gets translated through re-write rules
into a 2-D or 3-D structure. Lindenmayer
languages, Gruau and Kitano (lec 3)
28
Developing ANNs - Kitano
  • Kitano invented a 'Graph Generating Grammar'
  • This is a Graph L-System that generates not a
    'tree',
  • but a connectivity matrix for a network.
  • Eg see
  • Designing Neural Networks Using Genetic
    Algorithms
  • with Graph Generation System.
  • Hiroaki Kitano. Complex Systems, 4(4), 1990.

29
Graph Generating Grammar
Genes encode the rewrite rules that are
repeatedly applied to a seed, creating a matrix
of 0s and 1s
0 1 2 3 0 0 0 1 1 1 1 0 1 0 2 0
1 0 1 3 1 1 0 0
If the matrix is 4x4, this can specify all the
possible connections between nodes ('neurons')
in an ANN with 4 nodes -- specifies the
architecture, not the weights. 1connection, 0
no connection
30
From Genotype string to graph
Gene sabcd b0011 a1c01 c001e d1100
e1001 Rules s-gt ab a-gt 1c b-gt00 c-gt00
d-gt11 e-gt10 cd 01
11 10 00 01 Growth
s ab 1c00
cd 0111
0011
1000
01234567 0 11000000 1 11100000 2 00111111 3
00111111 4 00001111
5 00111111 6
11000000 7 11000000
31
Different approaches more biological
There have been many attempts at a more organic
method of development. Eg for NNs, have the
genotype specify for each Artificial Neuron its
2-D location in some notional space, and have
rules (either fixed or genetically specified) for
how dendrites grow out from each neuron until
they naturally bump into a neighbour (or
neighbours) Cf. eg Jakobi on www.cogs.susx.ac.uk/u
sers/nickja.
32
Virtues of biological
The main practical justification is that
neighbouring genotypes in gene-space will produce
similar-ish ANNs or phenotypes in
phenotype-space. And that there is some natural
fit to the problem. There is often some separate
implicit agenda, of trying to understand some
small part of natural morphogenesis
33
Different approaches - practical
For engineering purposes, eg evolving the shape
of rotor blades or wing-boxes, typically some
very simple practical method is adequate. Eg the
GAME project, optimising the design of a wing-box
for British Aerospace
34
Wingbox
First gene specified in binary (eg 8 bits, Gray
coded), thickness of section 1.
Successive genes encoded in binary (eg 4 bits,
Gray coded) the difference in thickness
(decrease) compared to the previous
section. Simple, practical, worked fine
35
Summary
To repeat, you have to decide what is most
reasonable for your particular problem, bearing
in mind
  • Ideally similar-ish potential-solutions (in
    phenotype space) should be encoded by similar-ish
    strings (in genotype space
  • Simpler methods generally better
  • But pretty much all reasonable mappings will
    work, so dont get too paranoid!
Write a Comment
User Comments (0)
About PowerShow.com