0% found this document useful (0 votes)
50 views2 pages

Explained: Choosing Representation, Mutation, and Crossover in Genetic Algorithms

This document provides an introduction to genetic algorithms and their main components: representation of solutions, and modification of solutions through mutation and crossover operators. It uses the 8-Queens Puzzle as an example problem to explore different representation schemes for genetic algorithms, including matrix and vector representations. It also discusses how the choice of representation impacts the development of mutation and crossover operators.

Uploaded by

Joseph
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views2 pages

Explained: Choosing Representation, Mutation, and Crossover in Genetic Algorithms

This document provides an introduction to genetic algorithms and their main components: representation of solutions, and modification of solutions through mutation and crossover operators. It uses the 8-Queens Puzzle as an example problem to explore different representation schemes for genetic algorithms, including matrix and vector representations. It also discusses how the choice of representation impacts the development of mutation and crossover operators.

Uploaded by

Joseph
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

AI Alexander Dockhorn

eXplained Leibniz University Hannover, GERMANY


Simon Lucas
Queen Mary University of London, UK

Choosing Representation, Mutation,


and Crossover in Genetic Algorithms

Abstract allows us to build a car according to the 1) a chessboard offers 64 fields arranged
made choices. This also allows us to test in an 8  8 grid.

T
his paper aims to provide an
introduction to genetic algori- the described configuration. 2) the solution consists of exactly 8 queens.
thms and their three main com- This paper reviews some of the most 3) each row can include only one queen;
ponents, i.e., the representation of solutions prominent choices for mutation and cros- otherwise, they would threaten each
and their modification through mutation sover of matrix and vector-based geno- other.
and crossover operators. It has been specifi- mes. Those will be studied in the context 4) each column can include only one
of the 8-Queens Puzzle to be introduced queen; otherwise, they would threaten
cally designed as introduction for new-
in Section II, several types of representa- each other.
comers to this exciting research area.
tions will be discussed in Section III. Fur- 5) each diagonal can include only one
This short paper represents a summary thermore, we analyze how the choice of queen; otherwise, they would threaten
of the full paper found online in IEEE representation guides the development of each other.
Xplore. The latter provides interactive respective mutation and crossover opera-
components for a hands-on exploration tors in Sections IV and V. Such requirements can be used to
of the covered material. further constrain the optimization task.
In the following, a set of optimization
II. 8-Queen Puzzle tasks constructed by considering combi-
I. Introduction The mapping between genotype and phe- nations of the above constraints is consid-
Genetic algorithms (GA) can be used to notype plays an important part in the algo- ered. For each of those, we will be able to
solve plenty of tasks using the power of rithm design process. This article presents identify different decision variables (phe-
evolutionary optimization. One of the GA design concepts based on a discussion notype) and search for suitable encodings
key tasks in the algorithm design process on the 8-Queens Puzzle. This seemingly (genotype). Just considering the first one,
is the choice of representation for a candi- simple Chess problem requires positioning a chessboard can be encoded as an 8  8
date solution. Given an optimization task, eight queens on an 8  8 chessboard so binary matrix in which a 0 encodes an
multiple decision variables can be identi- that no two queens threaten each other. empty field and a 1 the position of a
fied in finding an optimal solution. For Thus, no two queens share the same row, queen. This representation allows enc-
example, when optimizing a car for speed column, or diagonal. Fig. 1 shows an oding all valid solutions, but also many
we can modify its components, i.e., exemplary solution to the puzzle. In total,
motor, tires, the size of its tank, etc. A candidates which are invalid due to req-
there are 92 unique solutions to the puz- uirements 2-5. More specifically, it all-
candidate solution can be described by its zle, coming down to 12 when removing
phenotype or its genotype. The former is ows placing more or less than 8 queens
rotations and reflections. on a board. Since it is already known that
represented by the chosen car’s compo-
nents (a specific motor, a set of tires, and a a solution consists of exactly 8 queens,
tank’s volume), while the latter represents III. Representation the binary matrix can simply be con-
an indirect representation of the car’s To allow for an efficient search and strained to include exactly 8 queens.
configuration in a digital format (e.g., optimization of solutions, a solution’s So far, the first two requirements
indices for each of the choices made). encoding needs to be defined. Thinking have been incorporated in the encod-
During optimization, a candidate’s geno- about the basic properties of our task and ing. This can be further improved by
type will be modified. Based on a map- its likely solution can serve as a guideline adding the constraints on rows, col-
ping between genotype and phenotype, for our design process. Therefore, the fol- umns, and diagonals to it. Let’s consider
a phenotype description of a candidate lowing list summarizes the underlying a representation using the third require-
solution can be created, which in this case requirements: ment. Since each row can contain only
a single queen, a vector of size 8 can be
Digital Object Identifier 10.1109/MCI.2022.3199626 Corresponding author: Alexander Dockhorn (e-mail:
used to encode the column each queen
Date of current version: 3 November 2022 dockhorn@tnt.uni-hannover.de). is placed at. The same can be done using

52 IEEE COMPUTATIONAL INTELLIGENCE MAGAZINE | NOVEMBER 2022


Authorized licensed use limited to: Malta College of ArtsScience&Tech. Downloaded on April 25,2023 at 06:21:17 UTC from IEEE Xplore. Restrictions apply.
FIGURE 1 An exemplary solution of the 8-Queens Puzzle. FIGURE 2 Comparing representations of the 8-Queens Puzzle.

the forth requirement by representing a randomly flips (replaces) one or multiple which consist of at least one element of
solution in terms of a vector in which bits (values) of the individual. In terms of their parents. The same can be done for
each cell encodes the row of the respec- the matrix representation, this would multiple cut-off points. Instead of choos-
tive queen. Hence, the former solution either introduce a new queen at the ing cut-off points, a probability for swap-
will be called the row vector representa- flipped position or remove a queen from ping some of the parents’ elements can be
tion and the latter the column vector the board, respectively. Applying this to defined. This makes it especially simple
representation. Incorporating both of the constrained matrix has the potential to to extend the crossover to multiple
the former requirements yields a per- violate the representation’s requirements. parents. Once again, individuals pro-
mutation vector in which the column More specifically, it needs to be assured duced by the two previously discussed
vector representation is constrained to that the number of queens on the board crossover types have the potential to vio-
include every row number only once. remains constant. To achieve this, swap- late constraints of the representation. All
As shown above, the type of repr- ping or displacement mutations can be the above-stated crossover methods can
esentation defines the search space of used, in which two or more elements of be applied to the constrained matrix and
our optimization problem. Fig. 2 and the encoding are swapped. Simple forms vector-based representations. However,
Table 1 summarize the introduced include swapping two positions of the they are not suitable for permutations.
encodings and their resulting search board or inverting the whole sequence. Specialized methods, such as the cycle
space sizes. By including a larger num- crossover, can keep permutations intact.
ber of requirements in the representa- V. Crossover
tion, the search space can be reduced Crossover is an evolutionary operator VI. Conclusion
to a feasible size, and therefore, speed that uses two or more candidate solu- This paper introduced several represen-
up the optimization process. tions to create a new one. The original tations and their respective mutation and
candidate solutions are called parents, crossover operators for solving the 8-
IV. Mutation and the resulting individuals are named Queens Puzzle. It has been shown how
Mutation is an evolutionary operator that children. Similar to the mutation oper- the choice of representation impacts the
modifies a single individual of the popula- ator, a crossover needs to fit the under- size of the search space and the choice of
tion. It is often used for a local search trying lying representation of an individual. genetic operators. A larger selection of
to further improve an already promising In terms of vector and matrix-based mutation and crossover operators and
candidate solution. This is achieved by representations, the 1-point crossover is their effects on the board can be found in
adding small changes to a candidate solu- one of the simplest to implement. It first the online version of the paper. Further-
tion, such that the resulting individual is chooses a cut-off point along with one of more, literature on evolutionary algo-
slightly different from its parent. the axes of our underlying representation. rithms [1] as well as more detailed
For binary encodings, the bit (or Thereafter, it swaps the two ends of the selections of mutation [2] and crossover
value) mutation can be used, which parents to produce two children, each of operators [3] can help to better under-
stand the GA design process.

TABLE I Size of the search space per representation type. References


[1] R. Kruse, C. Borgelt, C. Braune, S. Mostaghim,
REPRESENTATION SIZE OF AN INDIVIDUAL SIZE OF THE SEARCH SPACE and M. Steinbrecher, Computational Intelligence. Lon-
don, U.K.: Springer, 2016.
Binary Matrix 8  8 ¼ 64 264  1:8  1019 [2] T. B€ack, D. B. Fogel, D. Whitley, and P. J. Angel-
64
 ine, “Mutation operators,” Evol. Comput., vol. 1,
Constrained Matrix 8  8 ¼ 64 4 ¼ 4426165368
pp. 237–255, 2000.
Row Vector 8 88 ¼ 16777216 [3] A. Umbarkar and P. Sheth, “Crossover operators in
genetic algorithms: A review,” ICTACT J. Soft Comput.,
Column Vector 8 88 ¼ 16777216 vol. 06, no. 01, pp. 1083–1092, Oct. 2015.
Permutation 8 8! ¼ 40320

NOVEMBER 2022 | IEEE COMPUTATIONAL INTELLIGENCE MAGAZINE 53


Authorized licensed use limited to: Malta College of ArtsScience&Tech. Downloaded on April 25,2023 at 06:21:17 UTC from IEEE Xplore. Restrictions apply.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy