GA Toolbox in Matlab
GA Toolbox in Matlab
TOOLBOX
For Use with MATLAB
Andrew Chipperfield
Peter Fleming
Hartmut Pohlheim
Carlos Fonseca
Version 1.2
Users Guide
Acknowledgements
The production of this Toolbox was made possible by a UK SERC grant on
Genetic Algorithms in Control Systems Engineering (GR/J17920). Many thanks
are due to Hartmut Pohlheim, a visiting researcher from the Technical University
Ilmenau, Germany, for the support for real-valued genetic algorithms and his hard
work in coding and revising many of the routines in this Toolbox. Thanks are also
due to Carlos Fonseca for providing the initial prototype for this Toolbox.
Table of Contents
1 Tutorial .....................................................................................................1-1
Installation ..................................................................................................1-2
An Overview of Genetic Algorithms .........................................................1-3
What are Genetic Algorithms .........................................................1-3
GAs versus Traditional Methods ....................................................1-5
Major Elements of the Genetic Algorithm ................................................1-6
Population Representation and Initialisation ..................................1-6
The Objective and Fitness Functions..............................................1-8
Selection .........................................................................................1-9
Roulette Wheel Selection Methods ....................................1-10
Stochastic Universal Sampling ..........................................1-12
Crossover ........................................................................................1-12
Multi-point Crossover.........................................................1-12
Uniform Crossover ............................................................1-13
Other Crossover Operators .................................................1-14
Intermediate Recombination...............................................1-14
Line Recombination ...........................................................1-15
Discussion ..........................................................................1-15
Mutation .........................................................................................1-16
Reinsertion ......................................................................................1-18
Termination of the GA ...................................................................1-18
Data Structures ...........................................................................................1-20
Chromosomes .................................................................................1-20
Phenotypes .....................................................................................1-20
Objective Function Values .............................................................1-21
Fitness Values .................................................................................1-22
Support for Multiple Populations ..............................................................1-23
Examples ....................................................................................................1-26
The Simple GA ..............................................................................1-26
A Multi-population GA ..................................................................1-30
Demonstration Scripts.....................................................................1-36
References...................................................................................................1-37
2 Reference..............................................................................................2-1
Genetic Algorithm Toolbox Users Guide
1 Tutorial
MATLAB has a wide variety of functions useful to the genetic algorithm
practitioner and those wishing to experiment with the genetic algorithm for the
first time. Given the versatility of MATLABs high-level language, problems can be
coded in m-files in a fraction of the time that it would take to create C or Fortran
programs for the same purpose. Couple this with MATLABs advanced data
analysis, visualisation tools and special purpose application domain toolboxes and
the user is presented with a uniform environment with which to explore the
potential of genetic algorithms.
The Genetic Algorithm Toolbox uses MATLAB matrix functions to build a set of
versatile tools for implementing a wide range of genetic algorithm methods. The
Genetic Algorithm Toolbox is a collection of routines, written mostly in m-files,
which implement the most important functions in genetic algorithms.
1-1
Installation
Instructions for installing the Genetic Algorithm Toolbox can be found in the
MATLAB installation instructions. It is recommended that the files for this toolbox
are stored in a directory named genetic off the main matlab/toolbox directory.
A number of demonstrations are available. A single-population binary-coded
genetic algorithm to solve a numerical optimization problem is implemented in the
m-file sga.m. The demonstration m-file mpga.m implements a real-valued multipopulation genetic algorithm to solve a dynamic control problem. Both of these
demonstration m-files are discussed in detail in the Examples Section.
Additionally, a set of test functions, drawn from the genetic algorithm literature,
are supplied in a separate directory, test_fns, from the Genetic Algorithm
Toolbox functions. A brief description of these test functions is given at the end of
the Examples Section. A further document describes the implementation and use
of these functions.
1-2
where x1 is encoded with 10 bits and x2 with 15 bits, possibly reflecting the level of
accuracy or range of the individual decision variables. Examining the chromosome
string in isolation yields no information about the problem we are trying to solve.
It is only with the decoding of the chromosome into its phenotypic values that any
meaning can be applied to the representation. However, as described below, the
search process will operate on this encoding of the decision variables, rather than
the decision variables themselves, except, of course, where real-valued genes are
used.
Having decoded the chromosome representation into the decision variable domain,
it is possible to assess the performance, or fitness, of individual members of a
population. This is done through an objective function that characterises an
individuals performance in the problem domain. In the natural world, this would
be an individuals ability to survive in its present environment. Thus, the objective
1-3
function establishes the basis for selection of pairs of individuals that will be
mated together during reproduction.
During the reproduction phase, each individual is assigned a fitness value derived
from its raw performance measure given by the objective function. This value is
used in the selection to bias towards more fit individuals. Highly fit individuals,
relative to the whole population, have a high probability of being selected for
mating whereas less fit individuals have a correspondingly low probability of
being selected.
Once the individuals have been assigned a fitness value, they can be chosen from
the population, with a probability according to their relative fitness, and
recombined to produce the next generation. Genetic operators manipulate the
characters (genes) of the chromosomes directly, using the assumption that certain
individuals gene codes, on average, produce fitter individuals. The recombination
operator is used to exchange genetic information between pairs, or larger groups,
of individuals. The simplest recombination operator is that of single-point
crossover.
Consider the two parent binary strings:
P1 = 1 0 0 1 0 1 1 0, and
P2 = 1 0 1 1 1 0 0 0.
If an integer position, i, is selected uniformly at random between 1 and the string
length, l, minus one [1, l-1], and the genetic information exchanged between the
individuals about this point, then two new offspring strings are produced. The two
offspring below are produced when the crossover point i = 5 is selected,
O1 = 1 0 0 1 0 0 0 0, and
O2 = 1 0 1 1 1 1 1 0.
This crossover operation is not necessarily performed on all strings in the
population. Instead, it is applied with a probability Px when the pairs are chosen
for breeding. A further genetic operator, called mutation, is then applied to the new
chromosomes, again with a set probability, Pm. Mutation causes the individual
genetic representation to be changed according to some probabilistic rule. In the
binary string representation, mutation will cause a single bit to change its state,
0 1 or 1 0. So, for example, mutating the fourth bit of O1 leads to the new
string,
O1m = 1 0 0 0 0 0 0 0.
Mutation is generally considered to be a background operator that ensures that the
probability of searching a particular subspace of the problem space is never zero.
1-4
This has the effect of tending to inhibit the possibility of converging to a local
optimum, rather than the global optimum.
After recombination and mutation, the individual strings are then, if necessary,
decoded, the objective function evaluated, a fitness value assigned to each
individual and individuals selected for mating according to their fitness, and so the
process continues through subsequent generations. In this way, the average
performance of individuals in a population is expected to increase, as good
individuals are preserved and bred with one another and the less fit individuals die
out. The GA is terminated when some criteria are satisfied, e.g. a certain number of
generations, a mean deviation in the population, or when a particular point in the
search space is encountered.
1-5
1-6
1-7
f ( xi )
N ind
f ( xi)
i=1
where Nind is the population size and xi is the phenotypic value of individual i.
Whilst this fitness assignment ensures that each individual has a probability of
reproducing according to its relative fitness, it fails to account for negative
objective function values.
A linear transformation which offsets the objective function [1] is often used prior
to fitness assignment, such that,
F ( x ) = af ( x ) + b
where a is a positive scaling factor if the optimization is maximizing and negative
if we are minimizing. The offset b is used to ensure that the resulting fitness values
are non-negative.
1-8
The linear scaling and offsetting outlined above is, however, susceptible to rapid
convergence. The selection algorithm (see below) selects individuals for
reproduction on the basis of their relative fitness. Using linear scaling, the
expected number of offspring is approximately proportional to that individuals
performance. As there is no constraint on an individuals performance in a given
generation, highly fit individuals in early generations can dominate the
reproduction causing rapid convergence to possibly sub-optimal solutions.
Similarly, if there is little deviation in the population, then scaling provides only a
small bias towards the most fit individuals.
Baker [14] suggests that by limiting the reproductive range, so that no individuals
generate an excessive number of offspring, prevents premature convergence. Here,
individuals are assigned a fitness according to their rank in the population rather
than their raw performance. One variable, MAX, is used to determine the bias, or
selective pressure, towards the most fit individuals and the fitness of the others is
determined by the following rules:
MIN = 2.0 - MAX
INC = 2.0 (MAX -1.0) / Nind
LOW = INC / 2.0
where MIN is the lower bound, INC is the difference between the fitness of
adjacent individuals and LOW is the expected number of trials (number of times
selected) of the least fit individual. MAX is typically chosen in the interval [1.1,
2.0]. Hence, for a population size of Nind = 40 and MAX = 1.1, we obtain MIN =
0.9, INC = 0.05 and LOW = 0.025. The fitness of individuals in the population may
also be calculated directly as,
F ( x i ) = 2 MAX + 2 ( MAX 1 )
xi 1
,
N ind 1
Selection
Selection is the process of determining the number of times, or trials, a particular
individual is chosen for reproduction and, thus, the number of offspring that an
1-9
individual will produce. The selection of individuals can be viewed as two separate
processes:
1)
2)
The first part is concerned with the transformation of raw fitness values into a realvalued expectation of an individuals probability to reproduce and is dealt with in
the previous subsection as fitness assignment. The second part is the probabilistic
selection of individuals for reproduction based on the fitness of individuals relative
to one another and is sometimes known as sampling. The remainder of this
subsection will review some of the more popular selection methods in current
usage.
Baker [15] presented three measures of performance for selection algorithms, bias,
spread and efficiency. Bias is defined as the absolute difference between an
individuals actual and expected selection probability. Optimal zero bias is
therefore achieved when an individuals selection probability equals its expected
number of trials.
Spread is the range in the possible number of trials that an individual may achieve.
If f(i) is the actual number of trials that individual i receives, then the minimum
spread is the smallest spread that theoretically permits zero bias, i.e.
f ( i ) et ( i ) , et ( i )
1-10
expected selection probabilities or the sum of the raw fitness values over all the
individuals in the current population. Individuals are then mapped one-to-one into
contiguous intervals in the range [0, Sum]. The size of each individual interval
corresponds to the fitness value of the associated individual. For example, in Fig. 2
the circumference of the roulette wheel is the sum of all six individuals fitness
values. Individual 5 is the most fit individual and occupies the largest interval,
whereas individuals 6 and 4 are the least fit and have correspondingly smaller
intervals within the roulette wheel. To select an individual, a random number is
generated in the interval [0, Sum] and the individual whose segment spans the
random number is selected. This process is repeated until the desired number of
individuals have been selected.
The basic roulette wheel selection method is stochastic sampling with replacement
(SSR). Here, the segment size and selection probability remain the same
throughout the selection phase and individuals are selected according to the
procedure outlined above. SSR gives zero bias but a potentially unlimited spread.
Any individual with a segment size > 0 could entirely fill the next population.
5
2
1-11
selection between spins. RSSR provides zero bias and the spread is lower
bounded. The upper bound is limited only by the number of fractionally assigned
samples and the size of the integral part of an individual. For example, any
individual with a fractional part > 0 could win all the samples during the fractional
phase. Remainder stochastic sampling without replacement (RSSWR) sets the
fractional part of an individuals expected values to zero if it is sampled during the
fractional phase. This gives RSSWR minimum spread, although this selection
method is biased in favour of smaller fractions.
Crossover (Recombination)
The basic operator for producing new chromosomes in the GA is that of crossover.
Like its counterpart in nature, crossover produces new individuals that have some
parts of both parents genetic material. The simplest form of crossover is that of
single-point crossover, described in the Overview of GAs. In this Section, a
number of variations on crossover are described and discussed and the relative
merits of each reviewed.
Multi-point Crossover
For multi-point crossover, m crossover positions, k i { 1, 2, , l 1 } , where ki
are the crossover points and l is the length of the chromosome, are chosen at
random with no duplicates and sorted into ascending order. Then, the bits between
successive crossover points are exchanged between the two parents to produce two
1-12
new offspring. The section between the first allele position and the first crossover
point is not exchanged between individuals. This process is illustrated in Fig. 3.
The idea behind multi-point, and indeed many of the variations on the crossover
operator, is that the parts of the chromosome representation that contribute to the
most to the performance of a particular individual may not necessarily be
contained in adjacent substrings [16]. Further, the disruptive nature of multi-point
crossover appears to encourage the exploration of the search space, rather than
favoring the convergence to highly fit individuals early in the search, thus making
the search more robust [17].
Uniform Crossover
Single and multi-point crossover define cross points as places between loci where
a chromosome can be split. Uniform crossover [18] generalises this scheme to
make every locus a potential crossover point. A crossover mask, the same length
as the chromosome structures is created at random and the parity of the bits in the
mask indicates which parent will supply the offspring with which bits. Consider
the following two parents, crossover mask and resulting offspring:
P1
P2
Mask
O1
O2
=
=
=
=
=
1
0
0
0
1
0
0
0
0
0
1
0
1
1
0
1
1
1
1
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
1
1
0
1
1
0
1
0
0
0
1
1
0
0
0
1
Here, the first offspring, O1, is produced by taking the bit from P1 if the
corresponding mask bit is 1 or the bit from P2 if the corresponding mask bit is 0.
Offspring O2 is created using the inverse of the mask or, equivalently, swapping P1
and P2.
Uniform crossover, like multi-point crossover, has been claimed to reduce the bias
associated with the length of the binary representation used and the particular
coding for a given parameter set. This helps to overcome the bias in single-point
crossover towards short substrings without requiring precise understanding of the
1-13
Intermediate Recombination
Given a real-valued encoding of the chromosome structure, intermediate
recombination is a method of producing new phenotypes around and between the
values of the parents phenotypes [21]. Offspring are produced according to the
rule,
O1 = P1 ( P2 P1 ) ,
where is a scaling factor chosen uniformly at random over some interval,
typically [-0.25, 1.25] and P1 and P2 are the parent chromosomes (see, for
example, [21]). Each variable in the offspring is the result of combining the
variables in the parents according to the above expression with a new chosen for
each pair of parent genes. In geometric terms, intermediate recombination is
1-14
capable of producing new variables within a slightly larger hypercube than that
defined by the parents but constrained by the range of . as shown in Fig 4.
Gene 2
Gene1
Figure 4: Geometric Effect of Intermediate Recombination
Line Recombination
Gene 2
Parents
Potential offspring
Gene1
Figure 5: Geometric Effect of Line Recombination
Discussion
The binary operators discussed in this Section have all, to some extent, used
disruption in the representation to help improve exploration during recombination.
Whilst these operators may be used with real-valued populations, the resulting
1-15
changes in the genetic material after recombination would not extend to the actual
values of the decision variables, although offspring may, of course, contain genes
from either parent. The intermediate and line recombination operators overcome
this limitation by acting on the decision variables themselves. Like uniform
crossover, the real-valued operators may also be parameterised to provide a control
over the level of disruption introduced into offspring. For discrete-valued
representations, variations on the recombination operators may be used that ensure
that only valid values are produced as a result of crossover [22].
The GA Toolbox provides a number of crossover routines incorporating most of
the methods described above. Single-point, double-point and shuffle crossover are
implemented in the Toolbox functions xovsp, xovdp and xovsh, respectively,
and can operate on any chromosome representation. Reduced surrogate crossover
is supported with both single-point, xovsprs, and double-point, xovdprs,
crossover and with shuffle crossover, xovshrs. A further general multi-point
crossover routine, xovmp, is also provided. To support real-valued chromosome
representations, discrete, intermediate and line recombination operators are also
included. The discrete recombination operator, recdis, performs crossover on
real-valued individuals in a similar manner to the uniform crossover operators.
Line and intermediate recombination are supported by the functions reclin and
recint respectively. A high-level entry function to all of the crossover operators
is provided by the function recombin.
Mutation
In natural evolution, mutation is a random process where one allele of a gene is
replaced by another to produce a new genetic structure. In GAs, mutation is
randomly applied with low probability, typically in the range 0.001 and 0.01, and
modifies elements in the chromosomes. Usually considered as a background
operator, the role of mutation is often seen as providing a guarantee that the
probability of searching any given string will never be zero and acting as a safety
net to recover good genetic material that may be lost through the action of
selection and crossover [1].
The effect of mutation on a binary string is illustrated in Fig. 6 for a 10-bit
chromosome representing a real value decoded over the interval [0, 10] using both
standard and Gray coding and a mutation point of 3 in the binary string. Here,
binary mutation flips the value of the bit at the loci selected to be the mutation
point. Given that mutation is generally applied uniformly to an entire population of
1-16
strings, it is possible that a given binary string may be mutated at more than one
point.
mutation point
Original string - 0 0 0 1 1 0 0 0 1 0
Mutated string - 0 0 1 1 1 0 0 0 1 0
binary
0.9659
2.2146
Gray
0.6634
1.8439
1-17
Reinsertion
Once a new population has been produced by selection and recombination of
individuals from the old population, the fitness of the individuals in the new
population may be determined. If fewer individuals are produced by
recombination than the size of the original population, then the fractional
difference between the new and old population sizes is termed a generation gap
[27]. In the case where the number of new individuals produced at each generation
is one or two, the GA is said to be steady-state [28] or incremental [29]. If one or
more of the most fit individuals is deterministically allowed to propagate through
successive generations then the GA is said to use an elitist strategy.
To maintain the size of the original population, the new individuals have to be
reinserted into the old population. Similarly, if not all the new individuals are to be
used at each generation or if more offspring are generated than the size of the old
population then a reinsertion scheme must be used to determine which individuals
are to exist in the new population. An important feature of not creating more
offspring than the current population size at each generation is that the
generational computational time is reduced, most dramatically in the case of the
steady-state GA, and that the memory requirements are smaller as fewer new
individuals need to be stored while offspring are produced.
When selecting which members of the old population should be replaced the most
apparent strategy is to replace the least fit members deterministically. However, in
studies, Fogarty [30] has shown that no significant difference in convergence
characteristics was found when the individuals selected for replacement where
chosen with inverse proportional selection or deterministically as the least fit. He
further asserts that replacing the least fit members effectively implements an elitist
strategy as the most fit will probabilistically survive through successive
generations. Indeed, the most successful replacement scheme was one that selected
the oldest members of a population for replacement. This is reported as being more
in keeping with generational reproduction as every member of the population will,
at some time, be replaced. Thus, for an individual to survive successive
generations, it must be sufficiently fit to ensure propagation into future
generations.
The GA Toolbox provides a function for reinserting individuals into the population
after recombination, reins. Optional input parameters allow the use of either
uniform random or fitness-based reinsertion. Additionally, this routine can also be
selected to reinsert fewer offspring than those produced at recombination.
Termination of the GA
Because the GA is a stochastic search method, it is difficult to formally specify
convergence criteria. As the fitness of a population may remain static for a number
of generations before a superior individual is found, the application of
1-18
1-19
Data Structures
MATLAB essentially supports only one data type, a rectangular matrix of real or
complex numeric elements. The main data structures in the Genetic Algorithm
toolbox are:
chromosomes
phenotypes
objective function values
fitness values
These data structures are discussed in the following subsections.
Chromosomes
The chromosome data structure stores an entire population in a single matrix of
size Nind Lind, where Nind is the number of individuals in the population
and Lind is the length of the genotypic representation of those individuals. Each
row corresponds to an individuals genotype, consisting of base-n, typically binary,
values.
An example of the chromosome data structure is shown below.
Chrom =
g 1, 1
g 2, 1
g 3, 1
.
g 1, 2
g 2, 2
g 3, 2
.
g 1, 3
g 2, 3
g 3, 3
.
individual 1
g 1, Lind
individual 2
g 2, Lind
individual 3
g 3, Lind
.
.
g Nind, Lind individual Nind
This data representation does not force a structure on the chromosome structure,
only requiring that all chromosomes are of equal length. Thus, structured
populations or populations with varying genotypic bases may be used in the
Genetic Algorithm Toolbox provided that a suitable decoding function, mapping
chromosomes onto phenotypes, is employed. The role of the decoding function is
described below.
Phenotypes
The decision variables, or phenotypes, in the genetic algorithm are obtained by
applying some mapping from the chromosome representation into the decision
variable space. Here, each string contained in the chromosome structure decodes
1-20
x 1, 1
x 2, 1
x 3, 1
.
x 1, 2
x 2, 2
x 3, 2
.
x 1, 3
x 2, 3
x 3, 3
.
individual 1
x 1, Nvar
individual 2
x 2, Nvar
individual 3
x 3, Nvar
.
.
x Nind, Nvar individual Nind
The actual mapping between the chromosome representation and their phenotypic
values depends upon the DECODE function used. It is perfectly feasible using this
representation to have vectors of decision variables of different types. For
example, it is possible to mix integer, real-valued and alphanumeric decision
variables in the same Phen data structure.
1-21
y 1, 1
y 2, 1
y 3, 1
.
y 1, 2
y 2, 2
y 3, 2
.
% Objective Function
y 1, 3
y 2, 3
y 3, 3
.
individual 1
y 1, Nvar
individual 2
y 2, Nvar
individual 3
y 3, Nvar
.
.
y Nind, Nvar individual Nind
Fitness values
Fitness values are derived from objective function values through a scaling or
ranking function. Fitnesses are non-negative scalars and are stored in column
vectors of length Nind, an example of which is shown below. Again, FITNESS is
an arbitrary fitness function.
Fitn = FITNESS ( ObjV ) % Fitness Function
f1
f2
f3
.
f Nind
individual 1
individual 2
individual 3
.
individual Nind
1-22
Ind 1 SubPop 1
Ind 2 SubPop 1
Ind N SubPop 1
Ind 1 SubPop 2
Chrom =
Ind 2 SubPop 2
Ind N SubPop 2
1-23
mutation operators
recombin
reins
select
SubPop 2
SubPop 5
SubPop 3
SubPop 4
1-24
SubPop 2
SubPop 5
SubPop 3
SubPop 4
SubPop 2
SubPop 5
SubPop 3
SubPop 4
1-25
Examples
This Section contains two detailed examples using the GA Toolbox to solve
optimization problems:
A simple binary GA to solve De Jongs first test function [13].
A real-valued multi-population GA to solve the Harvest problem [9].
The Simple GA
This example demonstrates how a simple GA can be constructed using routines
from the GA Toolbox to solve an optimization problem. The objective function to
be minimized is an extended version of De Jongs first test function [13]:
n
f1 ( x) =
xi ,
2
512 x i 512
i=1
where n defines the number of dimensions of the problem. For this example, we
choose n = 20. The minimum of this function is, of course, located at xi = 0.
The computational element of the MATLAB objective function is encapsulated in
the code segment below.
function ObjVal = objfun1( Phen )
ObjVal = sum((Phen .* Phen));
An m-file implementing this objective function, objfun1, is included with the
GA Toolbox software.
Having written an m-file for the objective function, the GA code may now be
constructed. This can be done directly from the MATLAB command line, in a script
file or as a MATLAB function. Fig. 10 shows an outline of the script file sga
supplied with the toolbox that implements a simple GA to solve this problem.
The first five lines describe the major variables of the GA. The number of
individuals is set to NIND = 40 and the number of generations MAXGEN =
300. The number of variables used is NVAR = 20 and each variable uses a 20 bit
representation, PRECI = 20. This example uses a generation gap, GGAP =
0.9, and fitness-based reinsertion to implement an elitist strategy whereby the
four most fit individuals always propagate through to successive generations.
Thus, 36 (NIND GGAP) new individuals are produced at each generation.
1-26
NIND = 40;
MAXGEN = 300;
NVAR = 20;
PRECI = 20;
GGAP = 0.9;
%
%
%
%
%
Number of individuals
Maximum no. of generations
No. of variables
Precision of variables
Generation gap
% Counter
1-27
1-28
1-29
A Multi-population GA
This example shows how functions from the GA Toolbox may be used to
implement a real-valued, multi-population GA. A MATLAB m-file script mpga,
supplied with the Toolbox, implements the code described in this subsection. The
objective function chosen is that of the harvest problem [9] which is a onedimensional equation of growth:
xk + 1 = a xk uk ,
with one equality constraint,
x0 = xN ,
where x0 is the initial condition of the state, a is a scalar constant, and xk R and
uk R+ are the state and nonnegative control respectively. The objective function
is defined as:
N1
J = max
uk ,
k=0
where N is the number of control steps over which the problem is to be solved. An
m-file implementing this objective function, objharv, is supplied with the GA
Toolbox software. Note that as this is a maximisation problem and the Toolbox
routines are implemented to minimise, the objective function, objharv,
multiplies J by -1 to produce a minimisation problem. The initial condition is set to
x0 = 100 and the scalar is chosen as a = 1.1. Additionally, the exact optimal
solution for this problem can be determined analytically as:
N
J =
x0 ( a 1)
N1
( a 1)
The number of control steps for this problem is N = 20, thus, NVAR = 20
decision variables will be used, one for each control input, uk. The decision
variables are bounded in the range RANGE = [0, 200], limiting the maximum
control input, at any time-step, to 200. The field descriptor, FieldD, describing
the decision variables may be constructed using the matrix replication function,
rep, thus:
NVAR = 20;
RANGE = [0; 200];
FieldD = rep(RANGE,[1,NVAR]);
1-30
The parameters for the GA may be specified using MATLAB variables. For this
example the following parameters are defined:
% Define GA Parameters
GGAP = 0.8;
% Generation gap
XOVR = 1;
% Crossover rate
MUTR = 1/NVAR;
% Mutation rate
MAXGEN = 1200;
% Maximum no. of generations
INSR = 0.9;
% Insertion rate
SUBPOP = 8;
% No. of subpopulations
MIGR = 0.2;
% Migration rate
MIGGEN = 20;
% No. of gens / migration
NIND = 20;
% No. of individuals / subpop
As well as the conventional GA parameters, such as generation gap (GGAP) and
crossover rate (XOVR), a number of other parameters associated with multipopulation GAs are defined. Here, INSR = 0.9 specifies that only 90% of the
individuals produced at each generation are reinserted into the population,
SUBPOP = 8 subpopulations are to be used with a migration rate of MIGR =
0.2, or 20%, between subpopulations and migration occurring at every MIGGEN
= 20 generations. Each subpopulation contains NIND = 20 individuals.
The functions used by the script-file are specified using MATLAB strings:
% Specify other functions as strings
SEL_F = sus;
% Name of selection function
XOV_F = recdis;
% Name of recombination fun.
MUT_F = mutbga;
% Name of mutation function
OBJ_F = objharv; % Name of objective function
Because we are using discrete recombination, recdis, for the breeding of
offspring, the crossover rate is not used and, hence XOVR = 1 above.
The initial population is created using the function crtrp and the generation
counter, gen, set to zero:
Chrom = crtrp(SUBPOP*NIND,FieldD);
gen = 0;
This will consist of SUBPOP NIND individuals with individual decision
variables chosen uniformly at random in the range specified by FieldD. The
Chrom matrix contains all of the subpopulations and the objective function values
for all the individuals in all the subpopulations may be calculated directly,
ObjV = feval(OBJ_F, Chrom);
1-31
using the MATLAB feval command. feval performs function evaluation taking
the first input argument, in this case the name of our objective function, objharv,
contained in OBJ_F, as the function to be evaluated and calls that function with all
the remaining parameters as its input arguments. In this case, the function call is:
ObjV = objharv(Chrom);
As a real-valued coding is used, there is no need to convert the chromosomes into
a phenotypic representation. Like the previous example, the GA now enters a
generational while loop.
The MATLAB code for the generational loop of the multi-population GA is shown
in Fig. 11 below.
% Generational loop
while gen < MAXGEN,
% Fitness assignment to whole population
FitnV = ranking(ObjV,2,SUBPOP);
% Select individuals from population
SelCh = select(SEL_F, Chrom, FitnV, GGAP, SUBPOP);
% Recombine selected individuals
SelCh=recombin(XOV_F, SelCh, XOVR, SUBPOP);
% Mutate offspring
SelCh = mutate(MUT_F,SelCh,FieldD,[MUTR],SUBPOP);
% Calculate objective function for offsprings
ObjVOff = feval(OBJ_F,SelCh);
% Insert best offspring replacing worst parents
[Chrom, ObjV] = reins(Chrom, SelCh, SUBPOP, ...
[1 INSR], ObjV, ObjVOff);
% Increment counter
gen=gen+1;
% Migrate individuals between subpopulations
if (rem(gen,MIGGEN) == 0)
[Chrom, ObjV] = ...
migrate(Chrom, SUBPOP, [MIGR, 1, 1], ObjV);
end
end
Figure 11: Generational Loop of a Multipopulation GA
1-32
The first step of the generational loop is the assignment of fitness values to
individuals:
FitnV = ranking(ObjV, 2, SUBPOP);
Because we are using multiple subpopulations, ranking requires us to specify
the selective pressure required, here we use a selective pressure of 2, and the
number of subpopulations, SUBPOP. Each subpopulations individuals objective
values in ObjV are ranked separately and the resulting sets of fitness values
returned in the vector FitnV.
Within each subpopulation, individuals are selected for breeding independently
using the high-level selection function, select:
SelCh = select(SEL_F, Chrom, FitnV, GGAP, SUBPOP);
select calls the low-level selection function, SEL_F = sus for each
subpopulation and builds the matrix SelCh containing all the pairs of individuals
to be recombined. Like the previous example, the generation gap, GGAP = 0.8,
means that 0.8 20 = 16, GGAP NIND, individuals are selected from each
subpopulation. Thus, SelCh contains a total of GGAP NIND SUBPOP = 128
individuals.
In a similar manner, the high-level recombination function, recombin, is used to
recombine the pairs of individuals within each subpopulation of SelCh:
SelCh = recombin(XOV_F, SelCh, XOVR, SUBPOP);
The recombination function, XOV_F
=
recdis, performs discrete
recombination between pairs of individuals for each subpopulation. As discrete
recombination does not require the specification of a conventional crossover rate,
the variable XOVR = 1.0 is used only for compatibility.
The offspring are now mutated:
SelCh = mutate(MUT_F,SelCh,FieldD,MUTR,SUBPOP);
Here, the breeder genetic algorithm mutation function, MUT_F = mutbga, is
called using the high-level mutation routine, mutate, with a mutation rate of
MUTR = 1/NIND = 0.05. The breeder genetic algorithm mutation function
requires the field descriptor, FieldD, so that the result of mutation will not
produce values outside the bounds of the decision variables.
The objective values of all the offspring, ObjVOff may now be calculated, again
using feval:
ObjVOff = feval(OBJ_F, SelCh);
1-33
50
40
J 30
20
10
0
0
10
uk
12
14
16
18
20
1-34
Again, like the previous example, the results of the GA search are contained in the
matrix ObjV. The objective value and index of the best individual are found using
the function min, for example:
[Y, I] = min(ObjV)
Y =
-73.2370
I =
50
Remembering that the sign of the objective function has been changed to form a
minimisation problem, these results correspond to an objective function value of
73.2370. The exact solution is given as 73.2376. The GA optimal solution is
therefore accurate within a 10-5 error bound on the exact optimal solution. The
chromosome values are displayed in Fig. 12 using:
plot(Chrom(I,:))
1-35
Demonstration Scripts
A number of test functions have been implemented for use with the GA script files
supplied with the Toolbox. These test functions are supplied in a separate
directory, test_fns, from the main demonstrations and Toolbox routines and
are accompanied by a postscript file, test_fns.ps, giving full details of the
problems implemented. The Table below summarises the test functions supplied
with the Toolbox.
No.
m-file name
Description
objfun1
De Jongs function 1
objfun1a
objfun1b
rotated hyper-ellipsoid
objfun2
objfun6
Rastrigins function
objfun7
Schwefels function
objfun8
Griewangks function
objfun9
objdopi
double integrator
10
objharv
harvest problem
11
objlinq
12
objlinq2
13
objpush
push-cart problem
1-36
References
[1] D. E. Goldberg, Genetic Algorithms in Search, Optimization and Machine
Learning, Addison Wesley Publishing Company, January 1989.
[2] C. L. Karr, Design of an Adaptive Fuzzy Logic Controller Using a Genetic
Algorithm, Proc. ICGA 4, pp. 450-457, 1991.
[3] R. B. Holstien, Artificial Genetic Adaptation in Computer Control Systems,
PhD Thesis, Department of Computer and Communication Sciences,
University of Michigan, Ann Arbor, 1971.
[4] R. A. Caruana and J. D. Schaffer, Representation and Hidden Bias: Gray vs.
Binary Coding, Proc. 6th Int. Conf. Machine Learning, pp153-161, 1988.
[5] W. E. Schmitendorgf, O. Shaw, R. Benson and S. Forrest, Using Genetic
Algorithms for Controller Design: Simultaneous Stabilization and Eigenvalue
Placement in a Region, Technical Report No. CS92-9, Dept. Computer
Science, College of Engineering, University of New Mexico, 1992.
[6] M. F. Bramlette, Initialization, Mutation and Selection Methods in Genetic
Algorithms for Function Optimization, Proc ICGA 4, pp. 100-107, 1991.
[7] C. B. Lucasius and G. Kateman, Towards Solving Subset Selection Problems
with the Aid of the Genetic Algorithm, In Parallel Problem Solving from
Nature 2, R. Mnner and B. Manderick, (Eds.), pp. 239-247, Amsterdam:
North-Holland, 1992.
[8] A. H. Wright, Genetic Algorithms for Real Parameter Optimization, In
Foundations of Genetic Algorithms, J. E. Rawlins (Ed.), Morgan Kaufmann, pp.
205-218, 1991.
[9] Z. Michalewicz, Genetic Algorithms + Data Structures = Evolution Programs,
Springer Verlag, 1992.
[10] T. Bck, F. Hoffmeister and H.-P. Schwefel, A Survey of Evolution
Strategies, Proc. ICGA 4, pp. 2-10, 1991.
[11] J. J. Grefenstette, Incorporating Problem Specific Knowledge into Genetic
Algorithms, In Genetic Algorithms and Simulated Annealing, pp. 42-60, L.
Davis (Ed.), Morgan Kaufmann, 1987.
[12] D. Whitley, K. Mathias and P. Fitzhorn, Delta Coding: An Iterative Search
Strategy for Genetic Algorithms, Proc. ICGA 4, pp. 77-84, 1991.
[13] K. A. De Jong, Analysis of the Behaviour of a Class of Genetic Adaptive
Systems, PhD Thesis, Dept. of Computer and Communication Sciences,
University of Michigan, Ann Arbor, 1975.
[14] J. E. Baker, Adaptive Selection Methods for Genetic Algorithms, Proc.
ICGA 1, pp. 101-111, 1985.
Genetic Algorithm Toolbox Users Guide
1-37
[15] J. E. Baker, Reducing bias and inefficiency in the selection algorithm, Proc.
ICGA 2, pp. 14-21, 1987.
[16] L. Booker, Improving search in genetic algorithms, In Genetic Algorithms
and Simulated Annealing, L. Davis (Ed.), pp. 61-73, Morgan Kaufmann
Publishers, 1987.
[17] W. M. Spears and K. A. De Jong, An Analysis of Multi-Point Crossover, In
Foundations of Genetic Algorithms, J. E. Rawlins (Ed.), pp. 301-315, 1991.
[18] G. Syswerda, Uniform crossover in genetic algorithms, Proc. ICGA 3, pp.
2-9, 1989.
[19] W. M. Spears and K. A. De Jong, On the Virtues of Parameterised Uniform
Crossover, Proc. ICGA 4, pp.230-236, 1991.
[20] R. A. Caruana, L. A. Eshelman, J. D. Schaffer, Representation and hidden
bias II: Eliminating defining length bias in genetic search via shuffle crossover,
In Eleventh International Joint Conference on Artificial Intelligence, N. S.
Sridharan (Ed.), Vol. 1, pp. 750-755, Morgan Kaufmann Publishers, 1989.
[21] H. Mhlenbein and D. Schlierkamp-Voosen, Predictive Models for the
Breeder Genetic Algorithm, Evolutionary Computation, Vol. 1, No. 1, pp. 2549, 1993.
[22] H. Furuya and R. T. Haftka, Genetic Algorithms for Placing Actuators on
Space Structures, Proc. ICGA 5, pp. 536-542, 1993.
[23] C. Z. Janikow and Z. Michalewicz, An Experimental Comparison of Binary
and Floating Point Representations in Genetic Algorithms, Proc. ICGA 4, pp.
31-36, 1991.
[24] D. M. Tate and A. E. Smith, Expected Allele Convergence and the Role of
Mutation in Genetic Algorithms, Proc. ICGA 5, pp.31-37, 1993.
[25] L. Davis, Adapting Operator Probabilities in Genetic Algorithms, Proc.
ICGA 3, pp. 61-69, 1989.
[26] T. C. Fogarty, Varying the Probability of Mutation in the Genetic
Algorithm, Proc. ICGA 3, pp. 104-109, 1989.
[27] K. A. De Jong and J. Sarma, Generation Gaps Revisited, In Foundations of
Genetic Algorithms 2, L. D. Whitley (Ed.), Morgan Kaufmann Publishers,
1993.
[28] D. Whitley, The GENITOR algorithm and selection pressure: why rankbased allocations of reproductive trials is best, Proc. ICGA 3, pp. 116-121,
1989.
[29] R. Huang and T. C. Fogarty, Adaptive Classification and Control-Rule
Optimization Via a Learning Algorithm for Controlling a Dynamic System,
Proc. 30th Conf. Decision and Control, Brighton, England, pp. 867-868, 1991.
1-38
1-39
2 Reference
bs2rv .......................................................................................................2-5
crtbase ...................................................................................................2-7
crtbp ........................................................................................................2-8
crtrp ........................................................................................................2-10
migrate ...................................................................................................2-11
mut ............................................................................................................ 2-14
mutate ..................................................................................................... 2-16
mutbga ..................................................................................................... 2-17
ranking ...................................................................................................2-20
recdis ..................................................................................................... 2-24
recint ..................................................................................................... 2-26
reclin ..................................................................................................... 2-28
recmut ..................................................................................................... 2-30
recombin .................................................................................................2-33
reins ........................................................................................................2-34
rep .............................................................................................................2-37
rws .............................................................................................................2-38
scaling ...................................................................................................2-40
select ..................................................................................................... 2-41
sus ............................................................................................................ 2-44
xovdp ........................................................................................................2-46
xovdprs ...................................................................................................2-47
xovmp ........................................................................................................2-48
xovsh ........................................................................................................2-49
xovshrs ...................................................................................................2-50
xovsp ........................................................................................................2-51
xovsprs ...................................................................................................2-52
2-1
2 Reference
This Section contains detailed descriptions of all of the functions in the Genetic
Algorithm Toolbox. It begins with a list of functions grouped by subject area and
continues with Reference entries in alphabetical order. Information about
individual functions is also available through the on-line Help facility.
2-2
CREATING POPULATIONS
crtbase
crtbp
crtrp
FITNESS ASSIGNMENT
ranking
scaling
SELECTION FUNCTIONS
reins
rws
select
sus
MUTATION OPERATORS
mut
discrete mutation
mutate
mutbga
real-value mutation
2-3
CROSSOVER OPERATORS
recdis
discrete recombination
recint
intermediate recombination
reclin
line recombination
recmut
recombin
xovdp
double-point crossover
xovdprs
xovmp
xovsh
shuffle crossover
xovshrs
xovsp
single-point crossover
xovsprs
SUBPOPULATION SUPPORT
migrate
UTILITY FUNCTIONS
bs2rv
rep
matrix replication
2-4
bs2rv
Purpose
binary string to real value conversion
Synopsis
Phen = bs2rv(Chrom, FieldD)
Description
Phen = bs2rv(Chrom, FieldD) decodes the binary representation of the
population, Chrom, into vectors of reals. The chromosomes are seen as
concatenated binary strings of given length, and decoded into real numbers over a
specified interval using either standard binary or Gray coding according to the
decoding matrix, FieldD. The resulting matrix, Phen, contains the
corresponding population phenotypes.
The use of Gray coding for binary chromosome representation is recommended as
the regular Hamming distance between quantization intervals reportedly makes the
genetic search less deceptive (see, for example, [1, 2]). An option to set the scaling
between quantization points can be used to select either linear or logarithmic
decoding to real values from binary strings. Logarithmic scaling is useful when the
range of decision variable is unknown at the outset as a wider range of parametric
values can be searched with fewer bits [3], thus reducing the memory and
computational requirements of the GA.
The matrix FieldD has the following structure:
len
lb
ub
code ,
scale
lbin
ubin
where the rows of the matrix are composed as follows:
len, a row vector containing the length of each substring in Chrom. Note that
sum(len) should equal length(Chrom).
lb and ub are row vectors containing the lower and upper bounds respectively for
each variable used.
code is a binary row vector indicating how each substring is decoded. Select
code(i) = 0 for standard binary and code(i) = 1 for Gray coding.
2-5
Example
Consider the following binary population, created using the crtbp function,
representing a set of single decision variables in the range [-1, 10]. The code
extract shows how the function bs2rv may be used to convert the Gray code
binary representation to real-valued phenotypes using arithmetic scaling.
Chrom = crtbp(4,8) % create random chromosomes
Chrom =
0 0 0
1 0 0
0 0 1
1 1 0
0
0
0
1
0
1
1
1
1
0
0
0
1
0
0
1
1
1
0
1
Algorithm
bs2rv is implemented as an m-file in the GA Toolbox. If logarithmic scaling is
used then the range must not include zero.
Reference
[1] R. B. Holstien, Artificial Genetic Adaptation in Computer Control Systems,
Ph.D. Thesis, Department of Computer and Communication Sciences, University
of Michigan, Ann Arbor, 1971.
[2] R. A. Caruana and J. D. Schaffer, Representation and Hidden Bias: Gray vs.
Binary Coding, Proc. 6th Int. Conf. Machine Learning, pp153-161, 1988.
[3] W. E. Schmitendorgf, O. Shaw, R. Benson and S. Forrest, Using Genetic
Algorithms for Controller Design: Simultaneous Stabilization and Eigenvalue
Placement in a Region, Technical Report No. CS92-9, Dept. Computer Science,
College of Engineering, University of New Mexico, 1992.
2-6
crtbase
Purpose
Create a base vector.
Synopsis
BaseVec = crtbase(Lind, Base)
Description
crtbase produces a vector whose elements correspond to the base of the loci of
a chromosome structure. This function can be used in conjunction with crtbp
when creating populations using representations in different bases.
BaseVec = crtbase(Lind, Base) creates a vector of length Lind whose
individual elements are of base Base. If Lind is a vector, then
length(BaseVec)
=
sum(Lind). If Base is also a vector of
length(Lind), then BaseVec is composed of groups of bases of length
determined by the elements of Lind and base Base. This last option is useful
when describing populations with structure.
Example
To create a basevector for a population containing four elements in base 8 and five
elements in base four:
BaseV = crtbase([4 5], [8 4])
BaseV =
8 8 8 8 4 4 4 4 4
See Also
crtbp, bs2rv
2-7
crtbp
Purpose
Create an initial population.
Synopsis
[Chrom, Lind, BaseV] = crtbp(Nind, Lind)
[Chrom, Lind, BaseV] = crtbp(Nind, Lind, Base)
[Chrom, Lind, BaseV] = crtbp(Nind, BaseV)
Description
The first step in a genetic algorithm is to create an initial population consisting of
random chromosomes. crtbp produces a matrix, Chrom, containing random
values in its elements.
Chrom = crtbp(Nind, Lind) creates a random binary matrix of size
Nind Lind , where Nind specifies the number of individuals in the population
and Lind the length of the individuals. Additionally, Chrom
=
crtbp([Nind, Lind]) can be used to specify the dimensions of the
chromosome matrix.
Chrom = crtbp(Nind, Lind, Base) produces a chromosome matrix of
base Base. If Base is a vector, then the value of the elements of Base specify the
base of the loci of the chromosomes. In this case, the second right hand side
argument may be omitted, Chrom = crtbp(Nind, BaseV).
[Chrom, Lind, BaseV] = crtbp(Nind, BaseV) also returns the
length of the chromosome structure, Lind, and the base of the chromosome loci in
the vector BaseV.
Example
To create a random population of 6 individuals of length 8 where the first four loci
are base eight and the last five loci are base four:
BaseV = crtbase([4 5], [8 4])
Chrom = crtbp(6, BaseV)
or
Chrom = crtbp([6,8],[8 8 8 8 4 4 4 4 4])
2-8
Chrom =
4 3 1
1 4 7
1 3 0
1 5 5
4 5 7
4 2 4
1
5
1
7
7
0
2
2
0
2
0
3
0
1
0
0
1
3
2
1
0
2
3
1
0
1
0
3
0
1
3
0
2
1
3
0
Algorithm
crtbp is an m-file in the GA Toolbox that uses the MATLAB function rand.
See Also
crtbase, crtrp
2-9
crtrp
Purpose
Create a real-valued initial population
Synopsis
Chrom = crtrp(Nind, FieldDR)
Description
The first step in a genetic algorithm is to create an initial population consisting of
random individuals. crtrp produces a matrix, Chrom, containing uniformly
distributed random values in its elements.
Chrom = crtrp(Nind, FiedDR) creates a random real-valued matrix of
size Nind Nvar , where Nind specifies the number of individuals in the
population and Nvar the number of variables of each individual. Nvar is derived
from FieldDR with Nvar = size(FieldDR,2).
FieldDR (FieldDescriptionRealvalue) is a matrix of size 2 Nvar and contains
the boundaries of each variable of an individual. The first row contains the lower
bounds, the second row the upper bounds.
FieldDR is used in other functions (mutation).
Example
To create a random population of 6 individuals with 4 variables each:
Define boundaries on the variables,
FieldDR = [
-100 -50 -30 -20; % lower bound
100 50 30 20]; % upper bound
Create initial population
Chrom = crtrp(6, FieldDR)
Chrom =
40.23 -17.17 28.95 15.38
82.06 13.26 13.35 -9.09
52.43 25.64 15.20 -2.54
-47.50 49.10
9.09 10.65
-90.50 -13.46 -25.63 -0.89
47.21 -25.29
7.89 -10.48
See Also
mutbga, recdis, recint, reclin
2-10
migrate
Purpose
Migrate individuals between subpopulations
Synopsis
Chrom = migrate(Chrom, SUBPOP)
Chrom = migrate(Chrom, SUBPOP, MigOpt)
Chrom = migrate(Chrom, SUBPOP, MigOpt, ObjV)
[Chrom, ObjV] = migrate(Chrom, SUBPOP, MigOpt, ObjV)
Description
migrate performs migration of individuals between subpopulations in the
current population, Chrom, and returns the population after migration, Chrom.
Each row of Chrom corresponds to one individual. The number of subpopulations
is indicated by SUBPOP. The subpopulations in Chrom are ordered according to
the following scheme:
Ind 1 SubPop 1
Ind 2 SubPop 1
Ind N SubPop 1
Ind 1 SubPop 2
Chrom =
Ind 2 SubPop 2
Ind N SubPop 2
2-11
MigOpt(1):
scalar containing the rate of migration of individuals between
subpopulations in the range [0, 1]
If omitted or NaN, MigOpt(1) = 0.2 (20%) is assumed.
If the migration rate is greater than 0 at least one individual per
subpopulation will migrate.
MigOpt(2):
scalar specifying the migration selection method
0 - uniform migration
1 - fitness-based migration
If omitted or NaN, MigOpt(2) = 0 is assumed.
MigOpt(3):
scalar indicating the structure of the subpopulations for migration
0 - complete net structure
1 - neighbourhood structure
2 - ring structure
If omitted or NaN, MigOpt(3) = 0 is assumed
If MigOpt is omitted or NaN, then the default values are assumed.
ObjV is an optional column vector with as many rows as Chrom and contains the
corresponding objective values for all individuals in Chrom. For fitness-based
selection of individuals (MigOpt(2) = 1) ObjV is necessary. If ObjV is an
input and output parameter, the objective values are copied according to the
migration of the individuals. This saves the recomputation of the objective values
for the whole population.
Example
Chrom = migrate(Chrom, SUBPOP) chooses 20% of the individuals of
one subpopulation and replaces these individuals with uniformly chosen
individuals from all other subpopulations. This process is done for each
subpopulation. (MigOpt = [0.2, 0, 0])
Chrom = migrate(Chrom, SUBPOP, [NaN 1 NaN], ObjV]) chooses
20% of the individuals of one subpopulation and replaces these individuals with a
selection of the fittest individuals (smaller ObjV) from all other subpopulations.
(net structure) This process is repeated for each subpopulation.
[Chrom,ObjV] = migrate(Chrom,SUBPOP,[0.3 1 2],ObjV])
chooses 30% of the individuals of one subpopulation and replaces these
individuals with the fittest individuals (smaller ObjV) from an adjacent
subpopulation in a unidirectional ring structure. This process is repeated for each
subpopulation. The first subpopulation receives its new individuals from the last
subpopulation (SUBPOP). ObjV is returned according to the migration of
individuals.
2-12
See Also
select, recombin, mutate, reins
Reference
[1] H. Mhlenbein, M. Schomisch and J. Born, The Parallel Genetic Algorithm as
a Function Optimizer, Parallel Computing, No. 17, pp.619-632, 1991.
[2] T. Starkweather, D. Whitley and K. Mathias, Optimization using Distributed
Genetic Algorithms, In Parallel Problems Solving from Nature, Lecture Notes in
Computer Science, Vol. 496, pp. 176-185, Springer, 1991.
[3] R. Tanese, Distributed Genetic Algorithms, Proc. ICGA 3, pp. 434-439,
Morgan Kaufmann Publishers, 1989.
[4] H.-M. Voigt, J. Born and I. Santibanez-Koref, Modelling and Simulation of
Distributed Evolutionary Search Processes for Function Optimization, Parallel
Problems Solving from Nature, Lecture Notes in Computer Science, Vol. 496, pp.
373-380, Springer Verlag, 1991.
2-13
mut
Purpose
Discrete mutation operator
Synopsis
NewChrom = mut(OldChrom, Pm, BaseV)
Description
mut takes the representation of the current population and mutates each element
with a given probability. To allow for varying bases in the chromosome and
structured populations, mut allows an additional argument BaseV that specifies
the base of the individual elements of a chromosome.
NewChrom
=
mut(OldChrom,
Pm) takes the current population,
OldChrom, with each row corresponding to an individuals, and mutates each
element with probability Pm. If the mutation probability, Pm, is omitted, Pm=0.7/
Lind is assumed, where Lind is the length of the chromosome structure. This
value is selected as it implies that the probability of any one element of a
chromosome being mutated is approximately 0.5 (see [1]). Without a third input
argument, mut assumes that the population is binary coded.
NewChrom = (OldChrom, Pm, BaseV) uses a third argument to specify
the base of the mutation of the individual elements of the chromosomes. In this
case, length(BaseV) = Lind, where Lind is the length of the chromosome
structure.
mut is a low-level mutation function normally called by mutate.
Example
Consider a binary population OldChrom with 4 individuals each of length 8:
OldChrom
0 0 0
1 0 0
0 0 1
1 1 0
=[
0 0
0 1
0 1
1 1
1
0
0
0
1
0
0
1
1;
1;
0;
1]
2-14
NewChrom
0 0 1
1 1 0
0 0 0
1 1 0
=
0
0
0
1
0
0
1
1
1
0
0
0
1
0
0
1
1
1
0
1
See Also
mutate, mutbga
Reference
[1] Jrgen Hesser and Reinhard Mnner, Towards an Optimal Mutation Rate
Probability for Genetic Algorithms, In Parallel Problem Solving from Nature,
Lecture Notes in Computer Science, Vol. 496, pp23-32, 1990.
2-15
mutate
Purpose
Mutation of individuals (high-level function).
Synopsis
NewChrom = mutate(MUT_F, OldChrom, FieldDR)
NewChrom = mutate(MUT_F, OldChrom, FieldDR, MutOpt)
NewChrom = mutate(MUT_F, OldChrom, FieldDR, MutOpt,
SUBPOP)
Description
mutate performs mutation of individuals from a population, OldChrom, and
returns the mutated individuals in a new population, NewChrom. Each row of
OldChrom and NewChrom corresponds to one individual.
MUT_F is a string that contains the name of the low-level mutation function, e.g.
mutbga or mut.
FieldDR is a matrix of size 2 Nvar and contains the bounds of each variable
of an individual (real-valued variables) or a matrix of size 1 Nvar and
contains the base of each variable (discrete-valued variables). If FieldDR is
omitted, empty or NaN, a binary representation of the variables is assumed.
MutOpt is an optional parameter containing the mutation rate, the probability of
mutating a variable of an individual. If MutOpt is omitted, a default mutation
rate is assumed. For real-value mutation MutOpt can contain a second parameter
specifying a scalar for shrinking the mutation range (see mutbga).
SUBPOP is an optional parameter and determines the number of subpopulations in
OldChrom. If SUBPOP is omitted or NaN, SUBPOP = 1 is assumed. All
subpopulations in OldChrom must have the same size.
Example
For examples, see mutbga (real-value mutation) and mut (discrete-value
mutation).
Algorithm
mutate checks the consistency of the input parameters and calls the low-level
mutation function. If mutate is called with more than one subpopulation then the
low-level mutation function is called separately for each subpopulation.
See Also
mutbga, mut, recombin, select
2-16
mutbga
Purpose
Mutation of real-valued population (mutation operator of the breeder genetic
algorithm).
Synopsis
NewChrom = mutbga(OldChrom, FieldDR)
NewChrom = mutbga(OldChrom, FieldDR, MutOpt)
Description
mutbga takes the real-valued population, OldChrom, mutates each variable with
given probability and returns the population after mutation, NewChrom.
NewChrom = mutbga(OldChrom, FieldDR, MutOpt) takes the current
population, stored in the matrix OldChrom and mutates each variable with
probability MutOpt(1) by addition of small random values (size of the mutation
step). The mutation step can be shrunk with MutOpt(2).
FieldDR is a matrix containing the boundaries of each variable of an individual
(see crtrp).
MutOpt is an optional vector with a maximum of two parameters:
MutOpt(1):
scalar containing the mutation rate in the range [0, 1].
If omitted or NaN, MutOpt(1) = 1/Nvar is assumed, where Nvar is
the number of variables per individual defined by size(FieldDR,2).
This value is selected as it implies that the number of variables per
individual mutated is approximately 1.
MutOpt(2):
scalar containing a value in the range [0, 1] for shrinking the mutation
range.
If omitted or NaN, MutOpt(2) = 1 is assumed (no shrinking).
mutbga is a low-level mutation function normally called by mutate.
Example
Consider the following population with three real-valued individuals:
OldChrom =
40.2381
82.0642
52.4396
[
-17.1766
13.2639
25.6410
28.9530
13.3596
15.2014
15.3883;
-9.0916;
-2.5435]
2-17
FieldDR = [
-100 -50 -30 -20;
100 50 30 20]
To mutate OldChrom with mutation probability 1/4 and no shrinking of the
mutation range:
NewChrom = mutbga(OldChrom, FieldDR, [1/4 1.0])
mutbga produces an internal mask table, MutMx, determining which variable to
mutate and the sign for adding delta (see Algorithm), e.g.
MutMx = [
0 0 0 1;
0 0 -1 0;
0 0 -1 -1]
An second internal table, delta, specifies the normalized mutation step size, e.g.
delta = [
0.2500 0.2500 0.2500 0.2500;
0.0001 0.0001 0.0001 0.0001;
0.2505 0.2505 0.2505 0.2505]
Thus, after mutation NewChrom becomes:
NewChrom =
40.2381 -17.1766 28.9530 20.0000
82.0642 13.2638 13.3559 -9.0916
52.4396 25.6410 -7.6858 -7.5539
NewChrom - OldChrom shows the mutation steps
NewChrom - OldChrom =
0
0
0 4.6117
0
0 -0.0037
0
0
0 -7.5156 -5.0104
Algorithm
The mutation of a variable is computed as follows:
mutated variable = variable + MutMx range MutOpt ( 2 ) delta
MutMx = 1 with probability MutOpt(1), (+ or - with equal probability)
else 0
range = 0.5
m1
delta =
i 2
i=0
With m = 20, the mutation operator is able to locate the optimum up to a precision
19
of range M utOpt ( 2 ) 2 .
2-18
The mutation operator mutbga is able to generate most points in the hypercube
defined by the variables of the individual and the range of the mutation. However,
it tests more often near the variable, that is, the probability of small step sizes is
greater than that of larger step sizes.
See Also
mutate, recdis, recint, reclin
Reference
[1] H. Mhlenbein and D. Schlierkamp-Voosen, Predictive Models for the
Breeder Genetic Algorithm: I. Continuous Parameter Optimization, Evolutionary
Computation, Vol. 1, No. 1, pp.25-49, 1993.
2-19
ranking
Purpose
Rank-based fitness assignment
Synopsis
FitnV = ranking(ObjV)
FitnV = ranking(ObjV, RFun)
FitnV = ranking(ObjV, RFun, SUBPOP)
Description
ranking ranks individuals according to their objective values, ObjV, and returns
a column vector containing the corresponding individual fitness values, FitnV.
This function ranks individuals for minimisation.
RFun is an optional vector with 1, 2 or length(ObjV) parameters:
If RFun is a scalar in [1, 2], linear ranking is assumed and the scalar indicates
the selective pressure.
If RFun is a vector with 2 parameters:
RFun(1):
scalar indicating the selective pressure
for linear ranking RFun(1) must be in [1, 2]
for non-linear ranking RFun(1) must be in [1, length(ObjV)-2]
If NaN, RFun(1) = 2 is assumed.
RFun(2):
ranking method
0 - linear ranking
1 - non-linear ranking
If RFun is a vector of length(ObjV), it should contain the fitness values to be
assigned to each rank.
If RFun is omitted or NaN, linear ranking and a selective pressure of 2 are
assumed.
SUBPOP is an optional parameter and indicates the number of subpopulations in
ObjV. If SUBPOP is omitted or NaN, SUBPOP = 1 is assumed. All
subpopulations in ObjV must have the same size.
If ranking is called with more than one subpopulation then the ranking is
performed separately for each subpopulation.
2-20
Example
Consider a population with 10 individuals. The current objective values are:
ObjV = [1; 2; 3; 4; 5; 10; 9; 8; 7; 6]
Evaluate the fitness with linear ranking and selective pressure 2:
FitnV = ranking(ObjV)
FitnV =
2.00
1.77
1.55
1.33
1.11
0
0.22
0.44
0.66
0.88
Evaluate the fitness with non-linear ranking and selective pressure 2:
FitnV = ranking(ObjV, [2 1])
FitnV =
2.00
1.66
1.38
1.15
0.95
0.38
0.45
0.55
0.66
0.79
Evaluate the fitness with the values in RFun:
RFun = [3; 5; 7; 10; 14; 18; 25; 30; 40; 50]
FitnV = ranking(ObjV, RFun)
2-21
FitnV =
50
40
30
25
18
3
5
7
10
14
Evaluate the fitness with non-linear ranking and selective pressure 2 for 2
subpopulations in ObjV:
FitnV = ranking(ObjV, [2 1], 2)
FitnV =
2.00
1.28
0.83
0.53
0.34
0.34
0.53
0.83
1.28
2.00
Algorithm
The algorithms for both linear and non-linear ranking first sorts the objective
function values into descending order. The least fit individual is placed in position
1 in the sorted list of objective values and the most fit individual position Nind
where Nind is the number of individuals in the population. A fitness value is then
assigned to each individual depending on its position, Pos, in the sorted
population.
For linear ranking individuals are assigned fitness values according to:
FitnV(Pos) = 2 SP + 2 ( SP 1 ) ( Pos 1 ) ( Nind 1 ) , and
for non-linear ranking according to:
Pos 1
FitnV(Pos) =
Nind X
Nind
X ( i)
i=1
2-22
0 = ( SP 1 ) X Nind 1 + SP X Nind 2 + + SP X + SP .
The vector FitnV is then unsorted to reflect the order of the original input vector,
ObjV.
See Also
select, rws, sus
Reference
[1] D. Whitley, The GENITOR Algorithm and Selection Pressure: Why RankBased Allocation of Reproductive Trials is Best, Proc. ICGA 3, pp. 116-121,
Morgan Kaufmann Publishers, 1989.
2-23
recdis
Purpose
Discrete recombination
Synopsis
NewChrom = recdis(OldChrom)
Description
recdis performs discrete recombination between pairs of individuals in the
current population, OldChrom, and returns a new population after mating,
NewChrom. Each row of OldChrom corresponds to one individual.
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated and added at
the end of NewChrom. The population should therefore be organised into
contiguous pairs that require mating. This can be achieved by using the function
ranking to assign a fitness level to each individual and a selection function (e.g.
select) to select individuals with a probability related to their fitness in the
current population.
recdis is a low-level recombination function normally called by recombin.
Example
Consider the following population with five real-value individuals:
OldChrom = [
40.23 -17.17 28.95
82.06 13.26 13.35
52.43 25.64 15.20
-47.50 49.10
9.09
-90.50 -13.46 -25.63
15.38;
-9.09;
-2.54;
10.65;
-0.89]
%
%
%
%
%
parent1
parent2
parent3
parent4
parent5
2;
1;
1;
2]
%
%
%
%
for
for
for
for
producing
producing
producing
producing
offspring1
offspring2
offspring3
offspring4
2-24
NewChrom = [
40.23 13.26
82.06 13.26
-47.50 25.64
52.43 25.64
28.95
28.95
9.09
9.09
-9.09;
15.38;
-2.54;
10.65]
%
%
%
%
Mask(1,:)
Mask(2,:)
Mask(3,:)
Mask(4,:)
parent1&2
parent1&2
parent3&4
parent3&4
As the number of individuals in the parent population, OldChrom, was odd, the
last individual is appended without recombination to NewChrom and the offspring
returned to the users workspace, thus
NewChrom =
40.23 13.26 28.95
82.06 13.26 28.95
-47.50 25.64
9.09
52.43 25.64
9.09
-90.50 -13.46 -25.63
-9.09
15.38
-2.54
10.65
-0.89
Algorithm
Discrete recombination exchanges variable values between the individuals. For
each variable the parent who contributes its variable value to the offspring is
chosen randomly with equal probability.
Discrete recombination can generate the corners of the hypercube defined by the
parents.
See Also
recombin, recint, reclin, ranking, sus, rws
Reference
[1] H. Mhlenbein and D. Schlierkamp-Voosen, Predictive Models for the
Breeder Genetic Algorithm: I. Continuous Parameter Optimization, Evolutionary
Computation, Vol. 1, No. 1, pp.25-49, 1993.
2-25
recint
Purpose
Intermediate recombination
Synopsis
NewChrom = recint(OldChrom)
Description
recint performs intermediate recombination between pairs of individuals in the
current population, OldChrom, and returns a new population after mating,
NewChrom. Each row of OldChrom corresponds to one individual.
recint is a function only applicable to populations of real-value variables (and
not binary or integer).
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated and added at
the end of NewChrom. The population should therefore be organised into
contiguous pairs that require mating. This can be achieved by using the function
ranking to assign a fitness level to each individual and a selection function (e.g.
select) to select individuals with a probability related to their fitness in the
current population.
recint is a low-level recombination function normally called by recombin.
Example
Consider the following population with three real-value individuals:
OldChrom
40.23
82.06
52.43
= [
-17.17
13.26
25.64
28.95
13.35
15.20
15.38; % parent1
-9.09; % parent2
-2.54] % parent3
2-26
NewChrom = [
34.40 -1.92
87.11 -0.59
As the number of individuals in the parent population, OldChrom, was odd, the
last individual is appended without recombination to NewChrom and the offspring
returned to the users workspace, thus:
NewChrom
34.40
87.11
52.43
=
-1.92
-0.59
25.64
23.86 11.33
21.98 -13.04
15.20 -2.54
Algorithm
Intermediate recombination combines parent values using the following rule:
offspring = parent1 + Alpha ( parent2 parent1 )
where Alpha is a scaling factor chosen uniformly at random in the interval
[-0.25, 1.25]. recint produces a new Alpha for each pair of values to be
combined.
Intermediate recombination can generate any point within a hypercube slightly
larger than that defined by the parents.
Intermediate recombination is similar to line recombination reclin. Whereas
recint uses a new Alpha factor for each pair of values combined together,
reclin uses one Alpha factor for each pair of parents.
See Also
recombin, recdis, reclin, ranking, sus, rws
Reference
[1] H. Mhlenbein and D. Schlierkamp-Voosen, Predictive Models for the
Breeder Genetic Algorithm: I. Continuous Parameter Optimization, Evolutionary
Computation, Vol. 1, No. 1, pp.25-49, 1993.
2-27
reclin
Purpose
Line recombination
Synopsis
NewChrom = reclin(OldChrom)
Description
reclin performs line recombination between pairs of individuals in the current
population, OldChrom, and returns a new population after mating, NewChrom.
Each row of OldChrom corresponds to one individual.
reclin is a function only applicable to populations of real-value variables (not
binary or integer).
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated and added at
the end of NewChrom. The population should therefore be organised into
contiguous pairs that require mating. This can be achieved by using the function
ranking to assign a fitness level to each individual and a selection function (e.g.
select) to select individuals with a probability related to their fitness in the
current population.
reclin is a low-level recombination function normally called by recombin.
Example
Consider the following population with three real-value individuals:
OldChrom = [
40.23 -17.17
82.06 13.26
52.43 25.64
28.95
13.35
15.20
15.38; % parent1
-9.09; % parent2
-2.54] % parent3
2-28
NewChrom = [
72.97 6.64 16.74 -3.77; % Alpha(1) parent1&2
84.25 14.85 12.54 -10.37] % Alpha(2) parent1&2
As the number of individuals in the parent population, OldChrom, was odd, the
last individual is appended without recombination to NewChrom and the offspring
returned to the users workspace, thus:
NewChrom
72.97
84.25
52.43
=
6.64 16.74 -3.77
14.85 12.54 -10.37
25.64 15.20 -2.54
Algorithm
Line recombination combines parent values using the following rule:
offspring = parent1 + Alpha ( parent2 parent1 )
where Alpha is a scaling factor chosen uniformly at random in the interval
[-0.25, 1.25]. reclin produces a new Alpha for each pair of parents to be
combined.
Line recombination can generate any point on a slightly longer line than that
defined by the parents.
Line recombination is similar to intermediate recombination recint. Whereas
reclin uses one Alpha factor for each pair of parents combined together,
recint uses a new Alpha factor for each pair of values.
See Also
recombin, recdis, recint, ranking, sus, rws
Reference
[1] H. Mhlenbein and D. Schlierkamp-Voosen, Predictive Models for the
Breeder Genetic Algorithm: I. Continuous Parameter Optimization, Evolutionary
Computation, Vol. 1, No. 1, pp.25-49, 1993.
2-29
recmut
Purpose
Line recombination with mutation features
Synopsis
NewChrom = recmut(OldChrom, FieldDR)
NewChrom = recmut(OldChrom, FieldDR, MutOpt)
Description
recmut performs line recombination with mutation features between pairs of
individuals in the current population, OldChrom, and returns a new population
after mating, NewChrom. Each row of OldChrom corresponds to one individual.
FieldDR is a matrix containing the boundaries of each variable of an individual
(see crtrp).
MutOpt is an optional vector with a maximum of 2 parameters:
MutOpt(1):
scalar containing the recombination rate in the range [0, 1].
If omitted or NaN, MutOpt(1) = 1 is assumed.
MutOpt(2):
scalar containing a value in the range [0, 1] for shrinking the recombination
range.
If omitted or NaN, MutOpt(2) = 1 is assumed (no shrinking).
recmut is a function only applicable to populations of real-value variables (and
not binary or integer).
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated and added at
the end of NewChrom. The population should therefore be organised into
contiguous pairs that require mating. This can be achieved by using the function
ranking to assign a fitness level to each individual and a selection function (sus
or rws) to select individuals with a probability related to their fitness in the current
population.
recmut uses features of the mutation operator of the Breeder Genetic Algorithm
(see mutbga). Therefore, the calling syntax of this recombination function is
identical to this of the mutation function mutbga.
recmut is a low-level recombination function normally called by mutate.
2-30
Example
Consider the following population with four real-valued individuals:
OldChrom = [
40.2381 -17.1766
82.0642 13.2639
52.4396 25.6410
-47.5381 49.1963
28.9530
13.3596
15.2014
9.0954
15.3883;
-9.0916;
-2.5435;
10.6521]
%
%
%
%
parent1
parent2
parent3
parent4
30.0000 17.4281
11.4106 -11.1314
15.2112 -2.5576
9.0856 10.6662
Algorithm
The offsprings of a pair of two parents are computed as follows:
offspring1=parent1 + RecMx range MutOpt ( 2 ) delta Diff
offspring2=parent2 + RecMx range MutOpt ( 2 ) delta ( Diff )
2-31
delta =
i 2
i=0
Diff =
parent2 parent1
parent1 parent2
See Also
mutate, mutbga, reclin
Reference
[1] H. Mhlenbein, The Breeder Genetic Algorithm - a provable optimal search
algorithm and its application, IEE Colloquium, Applications of Genetic
Algorithms, Digest No. 94/067, London, 15th March 1994.
[2] H. Mhlenbein and D. Schlierkamp-Voosen, Predictive Models for the
Breeder Genetic Algorithm: I. Continuous Parameter Optimization, Evolutionary
Computation, Vol. 1, No. 1, pp.25-49, 1993.
2-32
recombin
Purpose
Recombination of individuals (high-level function).
Synopsis
NewChrom = recombin(REC_F, Chrom)
NewChrom = recombin(REC_F, Chrom, RecOpt)
NewChrom = recombin(REC_F, Chrom, RecOpt, SUBPOP)
Description
recombin performs recombination of individuals from a population, Chrom,
and returns the recombined individuals in a new population, NewChrom. Each
row of Chrom and NewChrom corresponds to one individual.
REC_F is a string that contains the name of the low-level recombination function,
e.g. recdis or xovsp.
RecOpt is an optional parameter specifying the crossover rate. If RecOpt is
omitted or NaN, a default value is assumed.
SUBPOP is an optional parameter and determines the number of subpopulations in
Chrom. If SUBPOP is omitted or NaN, SUBPOP = 1 is assumed. All
subpopulations in Chrom must have the same size.
Example
For examples see recdis, recint, reclin, xovsp, xovdp and xovmp.
Algorithm
recombin checks the consistency of the input parameters and calls the low-level
recombination function. If recombin is called with more than one subpopulation
then the low-level recombination function is called separately for each
subpopulation.
See Also
recdis, recint, reclin, xovsp, xovdp, xovsh, mutate, select
2-33
reins
Purpose
Reinsertion of offspring in the population.
Synopsis
Chrom = reins(Chrom, SelCh)
Chrom = reins(Chrom, SelCh, SUBPOP)
Chrom = reins(Chrom, SelCh, SUBPOP, InsOpt, ObjVCh)
[Chrom, ObjVCh]= reins(Chrom, SelCh, SUBPOP, InsOpt,
ObjVCh, ObjVSel)
Description
reins performs insertion of offspring into the current population, replacing
parents with offspring and returning the resulting population. The offspring are
contained in the matrix SelCh and the parents in the matrix Chrom. Each row in
Chrom and Selch corresponds to one individual.
SUBPOP is an optional parameter and indicates the number of subpopulations in
Chrom and SelCh. If SUBPOP is omitted or NaN, SUBPOP = 1 is assumed. All
subpopulations in Chrom and SelCh each must have the same size.
InsOpt is an optional vector with a maximum of 2 parameters:
InsOpt(1):
scalar indicating the selection method for replacing parents with offspring:
0 - uniform selection, offspring replace parents uniformly at random
1 - fitness-based selection, offspring replace least fit parents
If omitted or NaN, InsOpt(1) = 0 is assumed
InsOpt(2):
scalar containing the rate of reinsertion of offspring per subpopulation as a
fraction of subpopulation size in the range [0, 1].
If omitted or NaN, InsOpt(2) = 1.0 is assumed.
If INSR = 0 no insertion takes place.
If INSR is not 1.0 ObjVSel is needed for selecting the best offspring for
insertion (truncation selection between offspring).
If InsOpt is omitted or NaN, then the default values are assumed.
ObjVCh is an optional column vector containing the objective values of the
individuals in Chrom. ObjVCh is needed for fitness-based reinsertion.
ObjVSel is an optional column vector containing the objective values of the
individuals in SelCh. ObjVSel is required if the number of offspring is greater
2-34
than the number of offspring to be reinserted into the population. In this case,
offspring are selected for reinsertion according to their fitness.
If ObjVCh is output parameter, ObjVCh and ObjVSel are needed as input
parameters. The objective values are then copied, according to the insertion of the
offspring, saving the recomputation of the objective values for the whole
population.
Example
Consider a population of 8 parents, Chrom, and a population of 6 offspring,
SelCh:
Chrom = [1; 2; 3; 4; 5; 6; 7; 8]
SelCh = [11; 12; 13; 14; 15; 16]
Insert all offspring in the population:
Chrom = reins(Chrom, SelCh)
Thus, a new population Chrom is produced, e.g.:
Chrom =
12
11
15
16
5
13
14
8
Consider the following ObjVCh vector for the parent population Chrom and
ObjVSel for the offspring, SelCh:
ObjVCh = [21; 22; 23; 24; 25; 26; 27; 28];
ObjVSel= [31; 32; 33; 34; 35; 36]
Insert all offspring fitness-based, i.e. replace least fit parents:
Chrom = reins(Chrom, SelCh, 1, 1, ObjVCh)
Chrom =
1
2
16
15
14
13
12
11
2-35
Insert 50% of the offspring fitness-based and copy the objective values according
the insertion of offspring:
[Chrom, ObjVCh] = reins(Chrom, SelCh, 1, [1 0.5],...
ObjVCh, ObjVSel)
Chrom =
1
2
3
4
5
13
12
11
ObjVCh =
21
22
23
24
25
33
32
31
Consider Chrom and SelCh consist of 2 subpopulations. Insert all offspring in the
appropriate subpopulations:
Chrom = reins(Chrom, SelCh, 2)
Chrom =
12
2
13
11
14
6
15
16
See Also
select
2-36
rep
Purpose
Matrix replication.
Synopsis
MatOut = rep(MatIn, REPN)
Description
rep is a low-level replication function. Not normally used directly, rep is called
by a number of functions in the GA-Toolbox.
rep performs replication of a matrix, MatIn, specified by the numbers in REPN
and returns the replicated matrix, MatOut.
REPN contains the number of replications in every direction. REPN(1) specifies
the number of vertical replications, REPN(2) the number of horizontal
replications.
Example
Consider the following matrix MatIn:
MatIn = [
1 2 3 4;
5 6 7 8]
To perform matrix replication:
MatOut = rep(MatIn, [1 2])
MatOut =
1 2 3 4 1 2 3 4
5 6 7 8 5 6 7 8
MatOut = rep(MatIn, [2 1])
MatOut
1 2
5 6
1 2
5 6
=
3
7
3
7
4
8
4
8
=
3
7
3
7
4
8
4
8
1
5
1
5
2
6
2
6
3
7
3
7
4
8
4
8
1
5
1
5
2
6
2
6
3
7
3
7
4
8
4
8
2-37
rws
Purpose
Roulette wheel selection
Synopsis
NewChrIx = rws(FitnV, Nsel)
Description
rws probabilistically selects Nsel individuals for reproduction according to their
fitness, FitnV, in the current population.
NewChrIx = rws(FitnV, Nsel) selects Nsel individuals from a
population using roulette wheel selection. FitnV is a column vector containing a
performance measure for each individual in the population. This can be achieved
by using the function ranking or scaling to assign a fitness level to each
individual. The return value, NewChrIx, is the index of the individuals selected
for breeding, in the order that they were selected. The selected individuals can be
recovered by evaluating Chrom(NewChrIx,:).
rws is a low-level selection function normally called by select.
Example
Consider a population of 8 individuals with the assigned fitness values, FitnV:
FitnV = [1.50; 1.35; 1.21; 1.07; 0.92; 0.78; 0.64; 0.5]
Select the indices of 6 individuals:
NewChrIx = rws(FitnV, 6)
Thus, NewChrIx can become:
NewChrIx =
2
5
1
1
3
7
Algorithm
A form of roulette wheel selection is implemented by obtaining a cumulative sum
of the fitness vector, FitnV, and generating Nsel uniformly at random
distributed numbers between 0 and sum(FitnV). The index of the individuals
selected is determined by comparing the generated numbers with the cumulative
sum vector. The probability of an individual being selected is then given by:
2-38
F ( xi ) =
f ( xi )
N ind
f ( xi)
i=1
where f(xi) is the fitness of individual xi and F(xi) is the probability of that
individual being selected.
See Also
select, sus, reins, ranking, scaling
Reference
[1] J. E. Baker, Reducing bias and inefficiency in the selection algorithm, Proc
ICGA 2, pp. 14-21, Lawrence Erlbaum Associates, Publishers, 1987.
[2] David E. Goldberg, Genetic Algorithms in Search, Optimization and Machine
Learning, Addison Wesley, 1989.
2-39
scaling
Purpose
Linear fitness scaling
Synopsis
FitnV = scaling(ObjV, Smul)
Description
scaling converts the objective values, ObjV, of a population into a fitness
measure with a known upper bound, determined by the value of Smul, such that,
F ( x i ) = af ( x i ) + b ,
where f(xi) is the objective value of individual xi, a is a scaling coefficient, b is an
offset and F(xi) is the resulting fitness value of individual xi. If fave is the average
objective value in the current generation, then the maximum fitness of the scaled
population is upper bounded at fave Smul. If Smul is omitted then the default
value of Smult = 2 is assumed. The average fitness of the scaled population is
also set to fave.
In the case of some of the objective values being negative, scaling attempts to
provide an offset, b, such that the scaled fitness values are greater than zero.
Algorithm
scaling uses the linear scaling method described by Goldberg [1].
Note: linear scaling is not suitable for use with objective functions that return
negative fitness values and is included here only for completeness.
See Also
ranking, reins, rws, select, sus
Reference
[1] D. E. Goldberg, Genetic Algorithms in Search, Optimization and Machine
Learning, Addison Wesley Publishing Company, January 1989.
2-40
select
Purpose
Selection of individuals from population (high-level function).
Synopsis
SelCh = select(SEL_F, Chrom, FitnV)
SelCh = select(SEL_F, Chrom, FitnV, GGAP)
SelCh = select(SEL_F, Chrom, FitnV, GGAP, SUBPOP)
Description
select performs selection of individuals from a population, Chrom, and returns
the selected individuals in a new population, SelCh. Each row of Chrom and
SelCh corresponds to one individual.
SEL_F is a string and contains the name of the low-level selection function, for
example rws or sus.
FitnV is a column vector containing the fitness values of the individuals in
Chrom. The fitness value indicates the expected probability of selection of each
individual.
GGAP is an optional parameter specifying the generation gap, the fraction of the
population to be reproduced. If GGAP is omitted or NaN, GGAP = 1.0 (100%) is
assumed. GGAP may also be greater than 1, allowing more offspring to be
produced then the number of parents. If Chrom consists of more than one
subpopulation, GGAP specifies the number of individuals to be selected per
subpopulation relative to the size of the subpopulation.
SUBPOP is an optional parameter and determines the number of subpopulations in
Chrom. If SUBPOP is omitted or NaN, SUBPOP = 1 is assumed. All
subpopulations in Chrom must have the same size.
Example
Consider a population of 8 individuals, Chrom, with the assigned fitness values,
FitnV:
2-41
Chrom =
1 11
2 12
3 13
4 14
5 15
6 16
7 17
8 18
[
21;
22;
23;
24;
25;
26;
27;
28]
27
21
26
21
25
22
23
24
23
22
21
22
22
21
26
27
27
26
27
25
2-42
Algorithm
select checks the consistency of the input parameter and calls the low-level
selection function. If select is called with more than one subpopulation then the
low-level selection function is called separately for each subpopulation.
See Also
rws, sus, ranking, scaling, recombin, mutate
2-43
sus
Purpose
Stochastic universal sampling
Synopsis
NewChrIx = sus(FitnV, Nsel)
Description
sus probabilistically selects Nsel individuals for reproduction according to their
fitness, FitnV, in the current population.
NewChrIx = rws(FitnV, Nsel) selects Nsel individuals from a
population using stochastic universal sampling [1]. FitnV is a column vector
containing a performance measure for each individual in the population. This can
be achieved by using the function ranking or scaling to assign a fitness level
to each individual. The return value, NewChrIx, is the index of the individuals
selected for breeding, in the order that they were selected. The selected individuals
can be recovered by evaluating Chrom(NewChrIx,:).
sus is a low-level selection function normally called by select.
Example
Consider a population of 8 individuals with the assigned fitness values, FitnV:
FitnV = [1.50; 1.35; 1.21; 1.07; 0.92; 0.78; 0.64; 0.5]
Select the indices of 6 individuals:
NewChrIx = sus(FitnV, 6)
Thus, NewChrIx can become:
NewChrIx =
5
6
3
1
1
2
Algorithm
A form of stochastic universal sampling is implemented by obtaining a cumulative
sum of the fitness vector, FitnV, and generating Nsel equally spaced numbers
between 0 and sum(FitnV). Thus, only one random number is generated, all the
others used being equally spaced from that point. The index of the individuals
2-44
f ( xi)
N ind
f ( xi )
i=1
where f(xi) is the fitness of individual xi and F(xi) is the probability of that
individual being selected.
See Also
select, rws, reins, ranking, scaling
Reference
[1] J. E. Baker, Reducing bias and inefficiency in the selection algorithm, Proc.
ICGA 2, pp. 14-21, Lawrence Erlbaum Associates, Publishers, 1987.
2-45
xovdp
Purpose
Double-point crossover
Synopsis
NewChrom = xovdp(OldChrom, XOVR)
Description
xovdp performs double-point crossover between pairs of individuals contained in
the current population, OldChrom, according to the crossover probability, XOVR,
and returns a new population after mating, NewChrom. Each row of OldChrom
and NewChrom corresponds to one individual. For the chromosomes any
representation can be used.
XOVR is an optional parameter specifying the crossover rate. If XOVR is omitted,
empty or NaN, XOVR = 0.7 is assumed.
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated. The
population should therefore be organised into contiguous pairs that require mating.
This can be achieved by using the function ranking to assign a fitness level to
each chromosome and a selection function (select, sus or rws) to select
individuals with a probability related to their fitness in the current population.
xovdp is a low-level crossover function normally called by recombin.
Algorithm
Consider the following two binary strings of the same length:
A1 = [1 1 0 1 0 1]
A2 = [1 0 1 0 1 0]
Double point crossover involves selecting uniformly at random two integer
positions, k1 and k2, between 1 and length(A1), and swapping the variables in
positions k1+1 to k2 between A1 and A2. Thus if the crossover positions k1 = 3
and k2 = 5, then A1 and A2 would become:
A1 = [1 1 0 0 1 1]
A2 = [1 0 1 1 0 0]
xovdp calls xovmp with the appropriate parameters.
See Also
xovdprs, xovsp, xovsh, xovmp, recombin, select
2-46
xovdprs
Purpose
Double-point reduced surrogate crossover
Synopsis
NewChrom = xovdprs(OldChrom, XOVR)
Description
xovdprs performs double-point reduced surrogate crossover between pairs of
individuals contained in the current population, OldChrom, according to the
crossover probability, XOVR, and returns a new population after mating,
NewChrom. Each row of OldChrom and NewChrom corresponds to one
individual. For the chromosomes any representation can be used.
XOVR is an optional parameter specifying the crossover rate. If XOVR is omitted,
empty or NaN, XOVR = 0.7 is assumed.
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated. The
population should therefore be organised into contiguous pairs that require mating.
This can be achieved by using the function ranking to assign a fitness level to
each chromosome and a selection function (select, sus or rws) to select
individuals with a probability related to their fitness in the current population.
xovdprs is a low-level crossover function normally called by recombin.
Algorithm
For double point crossover see xovdp.
The reduced surrogate operator constrains crossover to always produce new
individuals wherever possible. This is implemented by restricting the location of
crossover points such that crossover points only occur where gene values differ
[1].
xovdprs calls xovmp with the appropriate parameters.
See Also
xovdp, xovsprs, xovshrs, xovmp, recombin, select
Reference
[1] L. Booker, Improving search in genetic algorithms, In Genetic Algorithms
and Simulated Annealing, L. Davis (Ed.), pp. 61-73, Morgan Kaufmann
Publishers, 1987.
2-47
xovmp
Purpose
Multi-point crossover
Synopsis
NewChrom = xovmp(OldChrom, XOVR, Npt, Rs)
Description
xovmp performs multi-point crossover between pairs of individuals contained in
the current population, OldChrom, and returns a new population after mating,
NewChrom. Each row of OldChrom and NewChrom corresponds to one
individual. For the chromosomes any representation can be used.
XOVR is an optional parameter specifying the crossover rate. If XOVR is omitted,
empty or NaN, XOVR = 0.7 is assumed.
Npt is an optional parameter specifying the number of crosspoints:
0 - shuffle crossover.
1 - single point crossover.
2 - double point crossover.
If Npt is omitted, empty or NaN, Npt = 0 is assumed.
Rs is an optional parameter specifying the use of reduced surrogate:
0 - no reduced surrogate.
1 - use reduced surrogate.
If Rs is omitted, empty or NaN, Rs = 0 is assumed.
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated. The
population should therefore be organised into contiguous pairs that require mating.
This can be achieved by using the function ranking to assign a fitness level to
each chromosome and a selection function (select, sus or rws) to select
individuals with a probability related to their fitness in the current population.
xovmp is a low-level crossover function called by all other crossover functions. If
called by recombine xovmp performs shuffle crossover without reduced
surrogate identical to xovsh.
Algorithm
The algorithms used in single-point, double-point and shuffle crossover are
described in the xovsp, xovdp and xovsh Reference entries respectively.
The algorithms used in single-point, double-point and shuffle crossover with
reduced surrogates are described in the xovsprs, xovdprs and xovshrs
Reference entries respectively.
See Also
xovsp, xovdp, xovsh, xovsprs, xovdprs, xovshrs, recombin
2-48
xovsh
Purpose
Shuffle crossover
Synopsis
NewChrom = xovsh(OldChrom, XOVR)
Description
xovsh performs shuffle crossover between pairs of individuals contained in the
current population, OldChrom, according to the crossover probability, XOVR, and
returns a new population after mating, NewChrom. Each row of OldChrom and
NewChrom corresponds to one individual. For the chromosomes any
representation can be used.
XOVR is an optional parameter specifying the crossover rate. If XOVR is omitted,
empty or NaN, XOVR = 0.7 is assumed.
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated. The
population should therefore be organised into contiguous pairs that require mating.
This can be achieved by using the function ranking to assign a fitness level to
each chromosome and a selection function (select, sus or rws) to select
individuals with a probability related to their fitness in the current population.
xovsh is a low-level crossover function normally called by recombin.
Algorithm
Shuffle crossover is single-point crossover (see xovsp), but before the bits are
exchanged, they are randomly shuffled in both parents. After recombination, the
bits in the offspring are unshuffled. This removes positional bias as the bits are
randomly reassigned each time crossover is performed [1].
xovsh calls xovmp with the appropriate parameters.
See Also
xovshrs, xovsp, xovdp, xovmp, recombin, select
Reference
[1] R. A. Caruana, L. A. Eshelman, J. D. Schaffer, Representation and hidden bias
II: Eliminating defining length bias in genetic search via shuffle crossover, In
Eleventh International Joint Conference on Artificial Intelligence, N. S. Sridharan
(Ed.), Vol. 1, pp. 750-755, Morgan Kaufmann Publishers, 1989.
2-49
xovshrs
Purpose
Shuffle crossover with reduced surrogate
Synopsis
NewChrom = xovshrs(OldChrom, XOVR)
Description
xovshrs performs shuffle crossover with reduced surrogates between pairs of
individuals contained in the current population, OldChrom, according to the
crossover probability, XOVR, and returns a new population after mating,
NewChrom. Each row of OldChrom and NewChrom corresponds to one
individual. For the chromosomes any representation can be used.
XOVR is an optional parameter specifying the crossover rate. If XOVR is omitted,
empty or NaN, XOVR = 0.7 is assumed.
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated. The
population should therefore be organised into contiguous pairs that require mating.
This can be achieved by using the function ranking to assign a fitness level to
each chromosome and a selection function (select, sus or rws) to select
individuals with a probability related to their fitness in the current population.
xovshrs is a low-level crossover function normally called by recombin.
Algorithm
For shuffle crossover algorithm see xovsh.
The reduced surrogate operator constrains crossover to always produce new
individuals wherever possible. This is implemented by restricting the location of
crossover points such that crossover points only occur where gene values differ
[1].
xovshrs calls xovmp with the appropriate parameters.
See Also
xovsh, xovsprs, xovdprs, xovmp, recombin, select
Reference
[1] L. Booker, Improving search in genetic algorithms, In Genetic Algorithms
and Simulated Annealing, L. Davis (Ed.), pp. 61-73, Morgan Kaufmann
Publishers, 1987.
2-50
xovsp
Purpose
Single-point crossover
Synopsis
NewChrom = xovsp(OldChrom, XOVR)
Description
xovsp performs single-point crossover between pairs of individuals contained in
the current population, OldChrom, according to the crossover probability, XOVR,
and returns a new population after mating, NewChrom. OldChrom contains the
chromosomes of the current population, each row corresponds to one individual.
For the chromosomes any representation can be used.
XOVR is an optional parameter specifying the crossover rate. If XOVR is omitted,
empty or NaN, XOVR = 0.7 is assumed.
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated. The
population should therefore be organised into contiguous pairs that require mating.
This can be achieved by using the function ranking to assign a fitness level to
each chromosome and a selection function (select, sus or rws) to select
individuals with a probability related to their fitness in the current population.
xovsp is a low-level crossover function normally called by recombin.
Algorithm
Consider the following two binary strings of the same length:
A1 = [1 1 0 1 0 1]
A2 = [1 0 1 0 1 0]
Single-point crossover involves selecting uniformly at random an integer position,
k, between 1 and (length(A1)-1), and swapping the variables in positions
k+1 to length(A1) between A1 and A2. Thus if the crossover position k = 3,
then A1 and A2 would become:
A1 = [1 1 0 0 1 0]
A2 = [1 0 1 1 0 1]
xovsp calls xovmp with the appropriate parameters.
See Also
xovsprs, xovdp, xovsh, xovmp, recombin, select
2-51
xovsprs
Purpose
Single-point reduced surrogate crossover
Synopsis
NewChrom = xovsprs(OldChrom, XOVR)
Description
xovsprs performs single-point reduced surrogate crossover between pairs of
individuals contained in the current population, OldChrom, according to the
crossover probability, XOVR, and returns a new population after mating,
NewChrom. OldChrom contains the chromosomes of the current population,
each row corresponds to one individual. For the chromosomes any representation
can be used.
XOVR is an optional parameter specifying the crossover rate. If XOVR is omitted,
empty or NaN, XOVR = 0.7 is assumed.
The pairs are mated in order, odd row with the next even row. If the number of
rows in the matrix OldChrom is odd then the last row is not mated. The
population should therefore be organised into contiguous pairs that require mating.
This can be achieved by using the function ranking to assign a fitness level to
each chromosome and a selection function (select, sus or rws) to select
individuals with a probability related to their fitness in the current population.
xovsprs is a low-level crossover function normally called by recombin.
Algorithm
For single-point crossover see xovsp.
The reduced surrogate operator constrains crossover to always produce new
individuals wherever possible. This is implemented by restricting the location of
crossover points such that crossover points only occur where gene values differ
[1].
xovsprs calls xovmp with the appropriate parameters.
See Also
xovsp, xovdp, xovdprs, xovsh, xovshrs, xovmp, recombin, select
Reference
[1] L. Booker, Improving search in genetic algorithms, In Genetic Algorithms
and Simulated Annealing, L. Davis (Ed.), pp. 61-73, Morgan Kaufmann
Publishers, 1987.
2-52
Table of Contents
1. Introduction...............................................................................................................3
2. Parametric Optimization ............................................................................................4
2.1. De Jongs function 1.......................................................................................4
2.2. Axis parallel hyper-ellipsoid ...........................................................................4
2.3. Rotated hyper-ellipsoid ..................................................................................4
2.4. Rosenbrocks valley (De Jongs function 2).....................................................4
2.5. Rastrigins function 6 .....................................................................................5
2.6. Schwefels function 7 .....................................................................................5
2.7. Griewangks function 8 ..................................................................................5
2.8. Sum of different Powers (function 9) .............................................................6
3. Dynamic optimization ................................................................................................7
3.1. Double integrator...........................................................................................7
3.2. Linear-quadratic system .................................................................................8
3.3. Harvest system ............................................................................................10
3.4. Push-cart system..........................................................................................11
4. References ...............................................................................................................12
1. Introduction
Page 2
1. Introduction
This document describes a number of test functions implemented for use with the
Genetic Algorithm Toolbox for MATLAB. These functions are drawn from the literature
on genetic algorithms, evolutionary strategies and global optimization. The first Section
describes a set of common parametric test problems implemented as MATLAB m-files.
The second Section presents a number of dynamic optimization problems, implemented
in SIMULINK, as s-files and m-files as appropriate.
No.
function name
description
objfun1
De Jongs function 1
objfun1a
objfun1b
rotated hyper-ellipsoid
objfun2
objfun6
Rastriginss function
objfun7
Schwefels function
objfun8
Griewangks function
objfun9
objdopi
double integrator
10
objharv
harvest problem
11
objlinq
12
objlinq2
13
objpush
push-cart problem
All of the test function implementations are scalable, i.e. the dimension of the test
functions are adjustable via a single parameter value inside the function.
Test Functions
2. Parametric Optimization
Page 3
2. Parametric Optimization
f 1 (x ) = xi2
5,12 xi 5,12
i =1
af
global minimum: xi = 0
f x =0
f1a a x f = i xi2
5, 12 xi 5, 12
i =1
af
global minimum: xi = 0
f x =0
f1b
a x f = FGH x IJK
n
i =1
j =1
global minimum: xi = 0
af
f x =0
Test Functions
2. Parametric Optimization
Page 4
f2 a x f = 100 c xi +1 xi2 h + b1 xi g
2
i =1
global minimum: xi = 1
2, 048 xi 2, 048
af
f x =0
f6 a x f = 10 n + c xi2 10 cosb2 xi gh
i =1
global minimum: xi = 0
5,12 xi 5, 12
af
f x =0
f7 a x f = xi sin e xi
500 xi 500
i =1
af
f x = n 418, 9829
Test Functions
2. Parametric Optimization
Page 5
f8 a x f =
i =1
n
xi2
F x I
cosG i J + 1
H iK
4000 i =1
global minimum: xi = 0
600 xi 600
af
f x =0
f9 a x f = x i
ai +1f
1 xi 1
i =1
global minimum: xi = 0
af
f x =0
Test Functions
3. Dynamic optimization
Page 6
3. Dynamic optimization
Dynamic control problems are complex and difficult to solve. The use of dynamicoptimization specific methods, such as Hamiltonian, is complicated and problematic. The
application of specific methods requires a large amount of mathematical support even for
systems of moderate size, and only the most trivial systems can be solved analytically.
In the following example problems, each individual in the evolutionary algorithm
corresponds to a (discrete) control vector. Each variable in an individual is associated
with the control input at a time step of the dynamic optimization problem. In this section,
x is the state vector and u the control vector of a system.
x&1 = u
x&2 = x1
y = x2
The value of x2 has to be changed during a time period with as little control effort as
possible and the final conditions must be met, such that the following criteria are
satisfied.
0 t 1
time:
initial conditions:
final conditions:
af
x a1f = 0
x1 0 = 0
1
af
x a1f = 0
x 2 0 = 1
2
af
f u =
-
z af
1
u t 2 dt
t=0
u = 6 - 12 t,
Minimum = 12 .
Figure 1 shows the optimal control vector and states for the continuous system:
Test Functions
3. Dynamic optimization
Page 7
6
u
x1
2
0
x2
-2
-4
-6
0
0.2
Fig. 1:
0.4
0.6
0.8
1/s
inport
Fig. 2:
state 1
integrator 1
1/s
state 2
integrator 2
outport
The SIMULINK method uses the model in figure 2 (simdopi1.m). The s-function solves
the linear equations (simdopi2.m) given above and the third method (Control System
Toolbox) uses the transfer function:
af
Gs =
1
s2 .
a f
af
af
x k +1 = a x k + b u k
k = 1, 2,..., N .
f a x , uf = q x a N + 1f + d s x a k f + r ua k f
2
k =1
Test Functions
3. Dynamic optimization
Page 8
af
x0
45
100
16180.3399
45
100
10
109160.7978
45
100
1000
10009990.0200
45
100
10
37015.6212
45
100
1000
287569.3725
45
100
16180.3399
45
100
1000
16180.3399
45
100
0.01
10000.5000
45
100
0.01
431004.0987
10
45
100
100
10000.9999
set
exact solution
The ten test cases described by Michalewicz [Mic92] are all implemented in the m-file
objlinq.m. The values of the parameter sets are shown in table 2. The solution
f(x,u)
13
17
21
25
29
33
37
41
45
u(k)
Fig. 3:
1
inport
Fig. 4:
+
+
Sum
1/s
state 1
integrator 1
1
outport
Test Functions
3. Dynamic optimization
Page 9
The SIMULINK method uses the model in figure 4 (simlinq1.m). The s-function solves
the linear equations (simlinq2.m):
x&1 = x1 + u
y = x1 .
and the third method (Control System Toolbox) uses the transfer function:
af
Gs =
1
s 1.
a f
af af
such that x a 0 f = x a N f .
x k +1 = a x k u k
k = 1, 2,..., N ,
f au f = - ua k f
k =1
Minimum = -
a fc
h
a a 1f
x 0 aN 1
a N 1
Figure 5 shows the control vector for the harvest system with N=20.
60
50
f(u)
40
30
20
10
0
1
11
13
15
17
19
u(k)
Fig. 5:
Test Functions
3. Dynamic optimization
Page 10
a f af
k = 1, 2,..., N ,
1
x a k + 1f = 2 x a k f x a k f +
ua k f
N
.
x1 k + 1 = x2 k
2
1 N 2
u ak f
2 N k =1
.
Figure 6 shows the control vector for the push-cart system with N=20.
1
f(x,u)
0.8
0.6
0.4
0.2
0
1
11
13
15
17
19
u(k)
Fig. 6:
Test Functions
4. References
Page 11
4. References
[Mic92]
[MSB91] Mhlenbein, H., Schomisch, M. and Born, J.: "The parallel genetic algorithm
as function optimizer"; Parallel Computing, 17, pp.619-632, 1991
[OGH93] Ostermeier, A., Gawelczyk, A. and Hansen, N.: "A Derandomized Approach
to Self Adaptation of Evolution Strategies"; Technical Report TR-93-003,
TU Berlin, 1993
[Rec73]
[Rec94]
[Sch81]
[SE92]
[SHF94]
[TZ89]
Test Functions