100% found this document useful (1 vote)
4 views

Computational Intelligencebased Optimization Algorithms From Theory To Practice Babak Zolghadrasli download

The document discusses the book 'Computational Intelligence-based Optimization Algorithms: From Theory to Practice' by Babak Zolghadr-Asli, which focuses on meta-heuristic optimization algorithms. It provides theoretical insights and practical Python code for various algorithms, making it suitable for beginners and intermediate programmers. The book aims to bridge the gap between different optimization approaches and their real-world applications.

Uploaded by

kamkambonud2
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
100% found this document useful (1 vote)
4 views

Computational Intelligencebased Optimization Algorithms From Theory To Practice Babak Zolghadrasli download

The document discusses the book 'Computational Intelligence-based Optimization Algorithms: From Theory to Practice' by Babak Zolghadr-Asli, which focuses on meta-heuristic optimization algorithms. It provides theoretical insights and practical Python code for various algorithms, making it suitable for beginners and intermediate programmers. The book aims to bridge the gap between different optimization approaches and their real-world applications.

Uploaded by

kamkambonud2
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/ 58

Computational Intelligencebased Optimization

Algorithms From Theory To Practice Babak


Zolghadrasli download

https://ebookbell.com/product/computational-intelligencebased-
optimization-algorithms-from-theory-to-practice-babak-
zolghadrasli-55493832

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Computational Intelligencebased Optimization Algorithms From Theory To


Practice 1st Edition Zolghadrasli

https://ebookbell.com/product/computational-intelligencebased-
optimization-algorithms-from-theory-to-practice-1st-edition-
zolghadrasli-55486200

Computational Intelligence Based Optimization Of Manufacturing Process


For Sustainable Materials 1st Edition Deepak Sinwar

https://ebookbell.com/product/computational-intelligence-based-
optimization-of-manufacturing-process-for-sustainable-materials-1st-
edition-deepak-sinwar-51589808

Combustion Optimization Based On Computational Intelligence 1st


Edition Hao Zhou

https://ebookbell.com/product/combustion-optimization-based-on-
computational-intelligence-1st-edition-hao-zhou-6990384

Computational Intelligence Based Solutions For Vision Systems Ansari


Bajaj

https://ebookbell.com/product/computational-intelligence-based-
solutions-for-vision-systems-ansari-bajaj-46094270
Computational Intelligencebased Time Series Analysis Dinesh C S Bisht

https://ebookbell.com/product/computational-intelligencebased-time-
series-analysis-dinesh-c-s-bisht-46517804

Computational Intelligence Based On Lattice Theory 1st Edition


Vassilis G Kaburlasos

https://ebookbell.com/product/computational-intelligence-based-on-
lattice-theory-1st-edition-vassilis-g-kaburlasos-2181304

Interpretability Of Computational Intelligencebased Regression Models


1st Edition Tams Kenesei

https://ebookbell.com/product/interpretability-of-computational-
intelligencebased-regression-models-1st-edition-tams-kenesei-5235772

Interpretability Of Computational Intelligencebased Regression Models


Tams Kenesei

https://ebookbell.com/product/interpretability-of-computational-
intelligencebased-regression-models-tams-kenesei-5853914

Computational Intelligence For Knowledgebased Systems Design 13th


International Conference On Information Processing And Management Of
Uncertainty Ipmu 2010 Dortmund Germany June 28 July 2 2010 Proceedings
1st Edition Bernadette Bouchonmeunier
https://ebookbell.com/product/computational-intelligence-for-
knowledgebased-systems-design-13th-international-conference-on-
information-processing-and-management-of-uncertainty-
ipmu-2010-dortmund-germany-june-28-july-2-2010-proceedings-1st-
edition-bernadette-bouchonmeunier-2532170
Computational Intelligence-based
Optimization Algorithms

Computational intelligence-based optimization methods, also known as meta-


heuristic optimization algorithms, are a popular topic in mathematical programming.
These methods have bridged the gap between various approaches and created a
new school of thought to solve real-world optimization problems. In this book, we
have selected some of the most effective and renowned algorithms in the literature.
These algorithms are not only practical but also provide thought-provoking theor-
etical ideas to help readers understand how they solve optimization problems. Each
chapter includes a brief review of the algorithm’s background and the fields it has
been used in.
Additionally, Python code is provided for all algorithms at the end of each
chapter, making this book a valuable resource for beginner and intermediate
programmers looking to understand these algorithms.

Babak Zolghadr-Asli is currently a joint researcher under the QUEX program,


working at the Sustainable Minerals Institute at The University of Queensland in
Australia and The Centre for Water Systems at The University of Exeter in the UK.
His primary research interest is to incorporate computational and artificial intelli-
gence to understand the sustainable management of water resources.
Computational
Intelligence-​based
Optimization Algorithms
From Theory to Practice

Babak Zolghadr-​Asli
Designed cover image: Shutterstock
First edition published 2024
by CRC Press
2385 NW Executive Center Drive, Suite 320, Boca Raton FL 33431
and by CRC Press
4 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN
CRC Press is an imprint of Taylor & Francis Group, LLC
© 2024 Babak Zolghadr-​Asli
Reasonable efforts have been made to publish reliable data and information, but the author and
publisher cannot assume responsibility for the validity of all materials or the consequences of their use.
The authors and publishers have attempted to trace the copyright holders of all material reproduced in
this publication and apologize to copyright holders if permission to publish in this form has not been
obtained. If any copyright material has not been acknowledged please write and let us know so we may
rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced,
transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or
hereafter invented, including photocopying, microfilming, and recording, or in any information storage
or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, access www.copyri​ght.com
or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-​
750-​8400. For works that are not available on CCC please contact [email protected]
Trademark notice: Product or corporate names may be trademarks or registered trademarks and are used
only for identification and explanation without intent to infringe.
Library of Congress Cataloging-in-Publication Data
Names: Zolghadr-Asli, Babak, author.
Title: Computational intelligence-based optimization algorithms :
from theory to practice / Babak Zolghadr-Asli.
Description: First edition. | Boca Raton, FL : CRC Press, 2024. |
Includes bibliographical references and index.
Identifiers: LCCN 2023019666 (print) | LCCN 2023019667 (ebook) |
ISBN 9781032544168 (hardback) | ISBN 9781032544151 (paperback) |
ISBN 9781003424765 (ebook)
Subjects: LCSH: Computer algorithms. | Computational intelligence.
Classification: LCC QA76.9.A43 Z65 2024 (print) |
LCC QA76.9.A43 (ebook) | DDC 005.13–dc23/eng/20230623
LC record available at https://lccn.loc.gov/2023019666
LC ebook record available at https://lccn.loc.gov/2023019667
ISBN: 978-​1-​032-​54416-​8 (hbk)
ISBN: 978-​1-​032-​54415-​1 (pbk)
ISBN: 978-​1-​003-​42476-​5 (ebk)
DOI: 10.1201/​9781003424765
Typeset in Times
by Newgen Publishing UK
Contents

List of Figures xi
Foreword xv
Preface xvii

1 An Introduction to Meta-​Heuristic Optimization 1


1.1 Introduction 1
1.2 Components of an Optimization Problem 3
1.2.1 Objective Function 5
1.2.2 Decision Variables 5
1.2.3 State Variables 6
1.2.4 Constraints 6
1.2.5 Search Space 7
1.2.6 Simulator 8
1.2.7 Local and Global Optima 9
1.2.8 Near-​Optimal Solutions 12
1.3 The General Theme of Meta-​Heuristic Algorithms 13
1.4 Different Types of Meta-​Heuristic Algorithms 16
1.4.1 Source of Inspiration 17
1.4.2 Number of Search Agents 17
1.4.3 Implementation of Memory 18
1.4.4 Compatibility with the Search Space’s Landscape 19
1.4.5 Random Components 19
1.4.6 Preserving Algorithms 20
1.5 Handling Constraints 21
1.6 Performance of a Meta-​Heuristic Algorithm 23
1.7 No-​Free-​Lunch Theorem 28
1.8 Concluding Remarks 29

2 Pattern Search Algorithm 32


2.1 Introduction 32
2.2 Algorithmic Structure of Pattern Search Algorithm 34
vi Contents

2.2.1 Initiation Stage 35


2.2.2 Searching Stage 35
2.2.3 Termination Stage 42
2.3 Parameter Selection and Fine-​Tuning the Pattern Search
Algorithm 42
2.4 Python Codes 43
2.5 Concluding Remarks 46

3 Genetic Algorithm 49
3.1 Introduction 49
3.2 Algorithmic Structure of the Genetic Algorithm 53
3.2.1 Initiation Stage 53
3.2.2 Reproduction Stage 55
3.2.3 Termination Stage 60
3.3 Parameter Selection and Fine-​Tuning of the Genetic Algorithm 61
3.4 Python Codes 62
3.5 Concluding Remarks 65

4 Simulated Annealing Algorithm 68


4.1 Introduction 68
4.2 Algorithmic Structure of Simulated Annealing Algorithm 70
4.2.1 Initiation Stage 70
4.2.2 Searching Stage 72
4.2.3 Termination Stage 75
4.3 Parameter Selection and Fine-​Tuning the Simulated Annealing
Algorithm 75
4.4 Python Codes 76
4.5 Concluding Remarks 78

5 Tabu Search Algorithm 81


5.1 Introduction 81
5.2 Algorithmic Structure of the Tabu Search Algorithm 83
5.2.1 Initiation Stage 85
5.2.2 Searching Stage 85
5.2.3 Termination Stage 88
5.3 Parameter Selection and Fine-​Tuning the Tabu Search Algorithm 89
5.4 Python Codes 90
5.5 Concluding Remarks 91

6 Ant Colony Optimization Algorithm 94


6.1 Introduction 94
6.2 Algorithmic Structure of the Ant Colony Optimization Algorithm 99
6.2.1 Initiation Stage 100
6.2.2 Foraging Stage 102
Contents vii

6.2.3 Termination Stage 106


6.3 Parameter Selection and Fine-​Tuning the Ant Colony
Optimization Algorithm 106
6.4 Python Codes 107
6.5 Concluding Remarks 110

7 Particle Swarm Optimization Algorithm 113


7.1 Introduction 113
7.2 Algorithmic Structure of the Particle Swarm Optimization
Algorithm 116
7.2.1 Initiation Stage 118
7.2.2 Searching Stage 119
7.2.3 Termination Stage 123
7.3 Parameter Selection and Fine-​Tuning the Particle Swarm
Optimization Algorithm 124
7.4 Python Codes 125
7.5 Concluding Remarks 127

8 Differential Evolution Algorithm 130


8.1 Introduction 130
8.2 Algorithmic Structure of the Differential Evolution Algorithm 133
8.2.1 Initiation Stage 134
8.2.2 Reproduction Stage 135
8.2.3 Termination Stage 138
8.3 Parameter Selection and Fine-​Tuning Differential Evolution
Algorithm 138
8.4 Python Codes 140
8.5 Concluding Remarks 141

9 Harmony Search Algorithm 144


9.1 Introduction 144
9.2 Algorithmic Structure of the Harmony Search Algorithm 146
9.2.1 Initiation Stage 147
9.2.2 Composing Stage 149
9.2.3 Termination Stage 153
9.3 Parameter Selection and Fine-​Tuning the Harmony Search
Algorithm 153
9.4 Python Codes 155
9.5 Concluding Remarks 156

10 Shuffled Frog-​Leaping Algorithm 158


10.1 Introduction 158
10.2 Algorithmic Structure of the Shuffled Frog-​Leaping Algorithm 161
10.2.1 Initiation Stage 163
viii Contents

10.2.2 Foraging Stage 164


10.2.3 Termination Stage 169
10.3 Parameter Selection and Fine-​Tuning the Shuffled
Frog-​Leaping Algorithm 169
10.4 Python Codes 171
10.5 Concluding Remarks 173

11 Invasive Weed Optimization Algorithm 176


11.1 Introduction 176
11.2 Algorithmic Structure of the Invasive Weed Optimization
Algorithm 179
11.2.1 Initiation Stage 181
11.2.2 Invasion Stage 182
11.2.3 Termination Stage 185
11.3 Parameter Selection and Fine-​Tuning the Invasive Weed
Optimization Algorithm 186
11.4 Python Codes 187
11.5 Concluding Remarks 189

12 Biogeography-​Based Optimization Algorithm 192


12.1 Introduction 192
12.2 Algorithmic Structure of the Biogeography-​Based
Optimization Algorithm 196
12.2.1 Initiation Stage 197
12.2.2 Migration Stage 199
12.2.3 Termination Stage 203
12.3 Parameter Selection and Fine-​Tuning the Biogeography-​Based
Optimization Algorithm 204
12.4 Python Codes 205
12.5 Concluding Remarks 207

13 Cuckoo Search Algorithm 210


13.1 Introduction 210
13.2 Algorithmic Structure of the Cuckoo Search Algorithm 212
13.2.1 Initiation Stage 214
13.2.2 Brood Parasitism Stage 215
13.2.3 Termination Stage 217
13.3 Parameter Selection and Fine-​Tuning the Cuckoo Search
Algorithm 217
13.4 Python Codes 218
13.5 Concluding Remarks 220

14 Firefly Algorithm 223


14.1 Introduction 223
14.2 Algorithmic Structure of the Firefly Algorithm 226
Contents ix

14.2.1 Initiation Stage 227


14.2.2 Mating Stage 228
14.2.3 Termination Stage 230
14.3 Parameter Selection and Fine-​Tuning the Firefly Algorithm 231
14.4 Python Codes 232
14.5 Concluding Remarks 233

15 Gravitational Search Algorithm 236


15.1 Introduction 236
15.2 Algorithmic Structure of the Gravitational Search Algorithm 239
15.2.1 Initiation Stage 241
15.2.2 Repositioning Stage 242
15.2.3 Termination Stage 245
15.3 Parameter Selection and Fine-​Tuning the Gravitational Search
Algorithm 245
15.4 Python Codes 247
15.5 Concluding Remarks 248

16 Plant Propagation Algorithm 251


16.1 Introduction 251
16.2 Algorithmic Structure of the Plant Propagation Algorithm 254
16.2.1 Initiation Stage 255
16.2.2 Propagation Stage 256
16.2.3 Termination Stage 259
16.3 Parameter Selection and Fine-​Tuning the Plant Propagation
Algorithm 259
16.4 Python Codes 261
16.5 Concluding Remarks 262

17 Teaching-​Learning-​Based Optimization Algorithm 264


17.1 Introduction 264
17.2 Algorithmic Structure of the Teaching-​Learning-​Based
Optimization Algorithm 266
17.2.1 Initiation Stage 267
17.2.2 Teaching/​Learning Stage 269
17.2.3 Termination Stage 271
17.3 Parameter Selection and Fine-​Tuning the Teaching-​
Learning-​Based Optimization Algorithm 272
17.4 Python Codes 273
17.5 Concluding Remarks 274

18 Bat Algorithm 278


18.1 Introduction 278
18.2 Algorithmic Structure of the Bat Algorithm 280
x Contents

18.2.1 Initiation Stage 281


18.2.2 Repositioning Stage 283
18.2.3 Termination Stage 286
18.3 Parameter Selection and Fine-​Tuning the Bat Algorithm 287
18.4 Python Codes 288
18.5 Concluding Remarks 290

19 Flower Pollination Algorithm 293


19.1 Introduction 293
19.2 Algorithmic Structure of the Flower Pollination Algorithm 295
19.2.1 Initiation Stage 296
19.2.2 Pollination Stage 297
19.2.3 Termination Stage 300
19.3 Parameter Selection and Fine-​Tuning the Flower Pollination
Algorithm 301
19.4 Python Codes 302
19.5 Concluding Remarks 303

20 Water Cycle Algorithm 307


20.1 Introduction 307
20.2 Algorithmic Structure of the Water Cycle Algorithm 309
20.2.1 Initiation Stage 311
20.2.2 Hydrological Simulation Stage 312
20.2.3 Termination Stage 316
20.3 Parameter Selection and Fine-​Tuning the Water
Cycle Algorithm 317
20.4 Python Codes 319
20.5 Concluding Remarks 320

21 Symbiotic Organisms Search Algorithm 323


21.1 Introduction 323
21.2 Algorithmic Structure of the Symbiotic Organisms
Search Algorithm 325
21.2.1 Initiation Stage 327
21.2.2 Symbiosis Stage 328
21.2.3 Termination Stage 331
21.3 Parameter Selection and Fine-​Tuning the Symbiotic
Organisms Search Algorithm 331
21.4 Python Codes 333
21.5 Concluding Remarks 334

Index 337
Figures

1.1 Search space of a standard constrained two-​dimensional


optimization problem 8
1.2 The relative and absolute extrema of a generic one-​dimensional
optimization problem 10
1.3 The generic scheme of (a) single-​modal and (b) multimodal
one-​dimensional maximization problem 11
1.4 The generic scheme of near-​optimal solutions in a one-​dimensional
maximization problem 12
1.5 Convergence of an optimization problem toward the minimum
solution of (a) an algorithm with a preservation strategy and
(b) an algorithm with no preservation strategy 25
1.6 Convergence rate of an algorithm that is considered
(a) robust and (b) non-​robust 28
2.1 The computational flowchart of the pattern search algorithm 36
2.2 The mesh grid networks of tentative points are generated by
(a) GPS and (b) MADS methods in a two-​dimensional
search space 40
2.3 The schematic structure of the pattern moves in a
two-​dimensional search space 41
2.4 Pseudocode for the pattern search algorithm 43
3.1 The computational flowchart of the genetic algorithm 54
3.2 Diffracted methods to conduct crossover: (a) one-​point
crossover, (b) two-​point crossover, and (c) uniform crossover 58
3.3 Pseudocode for the genetic algorithm 62
4.1 The computational flowchart of the simulating annealing algorithm 71
4.2 A random walk in a two-​dimensional search space 72
4.3 Pseudocode for simulating annealing algorithm 76
5.1 The computational flowchart of the tabu search algorithm 84
5.2 The mesh grid network of tentative points generated by the GPS
method in a two-​dimensional search space 87
5.3 Pseudocode for the tabu search algorithm 89
xii Figures

6.1 The general scheme of a double-​bridge experiment with a single


node at (a) the beginning of the experiment, (b) mid-​experiment,
(c) the end of the experiment 97
6.2 The computational flowchart of the ant colony optimization
algorithm 100
6.3 Pseudocode for the ant colony optimization algorithm 107
7.1 The computational flowchart of the particle swarm optimization
algorithm 117
7.2 Pseudocode for the particle swarm optimization algorithm 125
8.1 The computational flowchart of the differential evolution
algorithm 134
8.2 Pseudocode for the differential evolution algorithm 139
9.1 The computational flowchart of the harmony search algorithm 148
9.2 The general theme of composing a new harmony using the
memory stagey 150
9.3 Pseudocode for the harmony search algorithm 154
10.1 The computational flowchart of the shuffled frog-​leaping
algorithm 162
10.2 The partition machine of the shuffled frog-​leaping algorithm 165
10.3 Pseudocode for the shuffled frog-​leaping algorithm 170
11.1 The computational flowchart of the invasive weed optimization
algorithm 180
11.2 The relationship between the number of produced seeds
for each weed plant and their objective functions in a
(a) maximization, and (b) minimization problem 183
11.3 Pseudocode for the invasive weed optimization algorithm 187
12.1 Species relocating rate based on the habitats’ population 195
12.2 The computational flowchart of the biogeography-​based
optimization algorithm 198
12.3 The relationship between movement ratings and habitats
suitability index 200
12.4 Pseudocode for the biogeography-​based optimization algorithm 204
13.1 The computational flowchart of the cuckoo search algorithm 213
13.2 Pseudocode for the cuckoo search algorithm 218
14.1 The computational flowchart of the firefly algorithm 227
14.2 Pseudocode for the firefly algorithm 232
15.1 Resultant gravitational force for a given particle in space 237
15.2 The computational flowchart of the gravitational search algorithm 240
15.3 Pseudocode for the gravitational search algorithm 246
16.1 The computational flowchart of the plant propagation algorithm 255
16.2 Pseudocode for the plant propagation algorithm 260
17.1 The computational flowchart of the teaching-​learning-​based
optimization algorithm 268
17.2 Pseudocode for the teaching-​learning-​based optimization algorithm 273
18.1 The computational flowchart of the bat algorithm 282
Figures xiii

18.2 Pseudocode for the bat algorithm 288


19.1 The computational flowchart of the flower pollination algorithm 296
19.2 Pseudocode for the flower pollination algorithm 302
20.1 The computational flowchart of the water cycle algorithm 310
20.2 The schematic theme of labeling raindrops procedure in the
water cycle algorithm 313
20.3 Pseudocode for the water cycle algorithm 318
21.1 The computational flowchart of the symbiotic organisms search
algorithm 326
21.2 Pseudocode for the symbiotic organisms search algorithm 332
Foreword

This is a unique reference book providing in one place: information on the main
meta-​heuristic optimization algorithms and an example of their algorithmic
implementation in Python. These algorithms belong to the class of computa-
tional intelligence-​based optimization methods that have addressed one of the key
challenges plaguing mathematical optimization for years –​that of dealing with dif-
ficult and realistic problems facing any industry with resource restrictions. What do
I mean by difficult and realistic? Instead of simplifying the problem that needs to be
solved due to the limitations of the method, as was the case with many mathemat-
ical optimization algorithms, these meta-​heuristics can now tackle large, complex,
and previously often intractable problems.
The book includes 20 meta-​heuristic algorithms, from the now-​classical gen-
etic algorithm to more “exotic” flower pollination or bat algorithms. Each of the
algorithms is presented as far as possible using the same structure so the reader can
easily see the similarities or differences among them. The Python code provides
an easy-​to-​access library of these algorithms that can be of use to both novices
and more proficient users and developers interested in implementing and testing
some of the algorithms they may not be fully familiar with. From my own experi-
ence, it is much easier to get into a subject when somebody has already prepared
the grounds. That is the case with this book, if I had it on my desk 30 years ago,
I would’ve been able to try many more different ways of solving problems in engin-
eering. With this book, I may still do it now!
Dragan Savic
Professor of Hydroinformatics
University of Exeter, United Kingdom
and
Distinguished Professor of Hydroinformatics
The National University of Malaysia, Malaysia
Preface

Computational intelligence-​based optimization methods, often referred to as meta-​


heuristic optimization algorithms, are among the most topical subjects in the field
of mathematical programming. This branch of optimization methods is basically an
alternative approach to accommodate the shortcomings of conventional analytical-​
based approaches and unguided sampling-​based methods. In a sense, these methods
were able to bridge the gap between these two vastly different approaches and
create a new school of thought to handle real-​world optimization problems.
By the early 1990s, many researchers had started conceptualizing CI-​based
frameworks to tackle optimization problems. Hundreds of meta-​heuristic optimiza-
tion algorithms are out there, which could be overwhelming for beginners who
have just started in this field. As such, in this book, we would not only provide a
rock-​solid theoretical foundation about these algorithms, but we tend to tackle this
subject from a practical side of things as well. Any algorithm introduced in this
book also comes with readily available Python code so the reader can implement
the algorithm to solve different optimization problems. We strongly believe that
this could help the readers to have a better grasp over the computational structure
of these algorithms.
We have handpicked some of the literature’s most exciting and well-​known
algorithms. Not only are these algorithms very efficient from a practical point of
view, but they all also consist of through-​provoking theoretical ideas that can help
the reader better understand how these algorithms actually tend to solve an opti-
mization problem. In this book, we will learn about pattern search, genetic algo-
rithm, simulated annealing, tabu search, ant colony optimization, particle swarm
optimization, differential evolution algorithm, harmony search algorithm, shuffle
frog-​leaping algorithm, invasive weed optimization, biogeography-​based optimiza-
tion, cuckoo search algorithm, firefly algorithm, gravity search algorithm, plant
propagation algorithm, teaching-​learning-​based algorithm, bat algorithm, flower
pollination algorithm, water cycle algorithm, and symbiotic organisms algorithm.
Though the chapters are arranged chronically, there are some pedagogical reasoning
behind this arrangement so that the readers can easily engage with the presented
materials in each chapter. Note that the basic idea here is to ensure that each algo-
rithm is presented in a stand-​alone chapter. This means that after reading the first
newgenprepdf

xviii Preface

chapter, which we highly encourage you to do, you can go to a given chapter and
learn all there is to understand and implement an algorithm fully. Each chapter also
contains a brief literature review of the algorithm’s background and showcases
where it has been implemented successfully. As stated earlier, there is a Python
code for all algorithms at the end of each chapter. It is important to note that, while
these are not the most efficient way to code these algorithms, they may very well
be the best way to understand them for beginner to intermediate programmers. As
such, if, as a reader, you have a semi-​solid understanding of the Python syntax
and its numeric library NumPy, you could easily understand and implement these
methods on your own.
1 An Introduction to Meta-​Heuristic
Optimization

Summary
Before we can embark upon this journey of ours to learn about computational
intelligence-based optimization methods, we must first establish a common lan-
guage to see what an optimization problem actually is. In this chapter, we tend
to take a deep dive into the world of optimization to understand the fundamental
components that are used in the structure of a typical optimization problem. We
would be introduced to the technical terminology used in this field, and more
importantly, we aim to grasp the basic principles of optimization methods. As a
final note, we would learn about the general idea behind meta-heuristic optimiza-
tion algorithms and what this term essentially means. By the end of this chapter, we
will also come to understand why it is essential to have more than one of these opti-
mization algorithms in our repertoire if we tend to use this branch of optimization
method as the primary option to handle real-world complex optimization problems.

1.1 Introduction
What is optimization? That is perhaps the first and arguably the most critical
question we need to get out of the way first. In the context of mathematics, opti-
mization, or what is referred to from time to time as mathematical programming,
is the process of identifying the best option from a set of available alternatives.
The subtle yet crucial fact that should be noted here is that one’s interpretation of
what is “best” may differ from the others (Bozorg-​Haddad et al., 2021; Zolghadr-​
Asli et al., 2021). That is why explicitly determining an optimization problem’s
objective is essential. So, in a nutshell, in optimization, we are ultimately trying to
search for the optimum solution to find an answer that minimizes or maximizes a
given criterion under specified conditions.
Optimization problems became an integrated part of most, if not all, quantita-
tive disciplines, ranging from engineering to operations research and economics.
In fact, developing novel mathematical programming frameworks has managed to
remain a topical subject in mathematics for centuries. Come to think of it, there is
a valid reason that optimization has incorporated itself into our professional and
personal modern-​day life to the extent it has. This is more understandable in the

DOI: 10.1201/9781003424765-1
2 An Introduction to Meta-Heuristic Optimization

context of engineering and management problems, where there are often limited
available resources, and the job at hand is to make the best out of what is at our
disposal. Failing to do so would simply mean that in the said procedure, whatever
that may be, there is going to be some waste of resources. This could, in turn,
imply that we are cutting our margin of profits, wasting limited natural resources,
time, or workforce over something that could have been prevented if the process
were optimized. So, in a way, it could be said that optimization is simply just good
common sense.
There are several formidable approaches to go about mathematical pro-
gramming. The traditional approach to solving optimization problems that are
categorized under the umbrella term of analytical approaches is basically a series
of calculus-​based optimization methods. Often these frameworks are referred to
as derivate-​based optimization methods, given that they rely heavily on the idea
of differential algebra and gradient-​oriented information to solve the problem. As
such, the core idea of these methods is to utilize the information extracted from the
gradient of a differentiable function, often from the first-​ or second-​order deriva-
tive, as a guide to find and locate the optimal solution. The main issue here is that
this could not be a practical method to approach real-​world optimization problems,
as these problems are often associated with high dimensionality, multimodality,
epistasis, non-​differentiability, and discontinuous search space imposed by
constraints (Yang, 2010; Du & Swamy, 2016; Bozorg-​Haddad et al., 2017). As
such, often, these methods are dismissed when it comes to handling intricate real-​
world problems as they are not by any means the ultimate practical approach to
tackle such problems.
The alternative approach here would be to use a series of methods that are
categorized under the umbrella term of sampling-​based approaches. These, to some
extent, use the simple principle of trial-​and-​error search to locate what could be
the optimum solution. These methods are either based on unguided or untargeted
search or the searching process that is guided or targeted by some criterion.
Some of the most notable subcategories of unguided search optimization
methods are sampling grid, random sampling, and enumeration-​based methods.
The sampling grid is the most primitive approach here, where all possible solutions
would be tested and recorded to identify the best solution (Bozorg-​Haddad et al.,
2017). In computer science, such methods are said to be based on brute force com-
putation, given that to find the solution, basically, any possible solution is being
tested here. As you can imagine, this could be quite computationally taxing. While
this seems more manageable when the number of potential solutions is finite, in
most, if not all, practical cases, this can be borderline impossible to implement
such an approach to find the optimum solution. If, for instance, the search space
consists of continuous variables, the only way to implement this method is to
deconstruct the space into a discrete decision space. This procedure, known as
discretization, transforms a continuous space into a discrete one by transposing an
arbitrarily defined mesh grid network over the said space. Obviously, the finer this
grid system, the better the chance of getting closer to the actual optimum solution.
Not only it becomes more computationally taxing to carry this task, but from a
An Introduction to Meta-Heuristic Optimization 3

theoretical point of view, it is also considered impossible to locate the exact optimal
solution for a continuous space with such an approach. However, it is possible to
get a close approximation of the said value through this method.
Another unguided approach is random sampling. The idea here is to simply
take a series of random samples from the search space and evaluate their perform-
ance against the optimization criterion (Bozorg-​Haddad et al., 2017). The most
suitable solution found in this process would then be returned as the optimal solu-
tion. Though this process is, for the most part, easy to execute, and the amount
of computational power needed to carry this task can be managed by limiting the
number of samples taken from the search space, as one can imagine, the odds of
locating the actual optimum solution is exceptionally slim. This is, of course, more
pronounced in complex real-​world problems where there are often numerous con-
tinuous variables.
The other notable approach in the unguided search category is enumeration-​
based methods (Du & Swamy, 2016). These methods are basically a bundle of
computation tasks that would be executed iteratively until a specific termination
criterion is met, at which point the final results would be returned by the method as
the solution to the optimization problem at hand. Like any other unguided method,
here, there is no perception of the search space and the optimization function itself.
As such, the enumeration through the search space would be solely guided by the
sequence of computational tasks embedded within the method. In other words,
such a method could not learn from their encounter with the search space to alter
their searching strategies, which is in and of itself the most notable drawback of all
the unguided searching methods.
Alternatively, there are also targeted searching methods. One of the most notable
features of this branch of optimization is that they can, in a sense, implement what
they have learned about the search space as a guiding mechanism to help navigate
their searching process. As such, they attempt to draw each sample batch from what
they learned in their last attempt. As a result, step by step, they are improving the
possibility that the next set of samples is more likely to be better than the last until,
eventually, they could gradually move toward what could be the optimum solution. It
is important to note that one of the distinctive features of this approach, like any other
sampling method, is that they aim to settle for a close-​enough approximation of the
global optima, better known as near-​optimal solutions. The idea here is to possibly
sacrifice the accuracy of the emerging solution to an acceptable degree to find a close-​
enough solution with considerably less calculation effort. One of the most well-​known
sub-​class of the guided sampling methods is meta-​heuristic optimization algorithms.
However, before diving into what these methods actually are and what they are cap-
able of doing, it is crucial that we improve our understanding of the structure of an
optimization problem and its components from a mathematical point of view.

1.2 Components of an Optimization Problem


As we have discovered earlier, the optimization problem’s main idea is to iden-
tify the best or optimum solution out of all possible options. Thus, the core idea of
4 An Introduction to Meta-Heuristic Optimization

an optimization problem is to create a search engine that enumerates all possible


solutions to locate what could be the optimum solution. As we have seen in the pre-
vious section, there are different approaches to solving an optimization problem,
which, for the most part, comes down to how the said approaches tend to search
through the possible solutions to, ultimately, locate what could be the optimal
solutions. Analytical approaches, for instance, resort to calculus-​based methods
that use the obtained gradient-​oriented information to solve the problem at hand.
Alternatively, there are also sampling-​based approaches, which, at their core, use the
simple principle of trial-​and-​error search to locate the potential optimal solutions.
Regardless of what approach is selected to tackle the problem at hand, there is
a fundamental requirement here to represent the optimization problem in a math-
ematical format. There are certain standard components that commonly help shape
this mathematical representation of an optimization problem. To understand how
these optimization methods proceed with their task, it is essential to learn how an
optimization problem can be expressed through these components. With that in
mind, the first step is to see what a standard optimization model is like.
From a mathematical standpoint, an optimization problem can be formulated as
the following generic standard form:

Optimize f ( X ) (1.1)
X ∈R N

Subject to

gk ( X ) ≤ bk ∀k (1.2)

Lj ≤ xj ≤ U j ∀j (1.3)

in which f() represents the objective function, X is a point in the search space of an
optimization problem with N decision variables, N denotes the number of decision
variables, gk() is the kth constraint of the optimization problem, bk denotes the con-
stant value of the kth constraint, xj represents the value associated to the jth deci-
sion variable, and Uj and Lj represent the upper and lower feasible boundaries of
the jth decision variable, respectively. Note that in an optimization problem with N
decision variables, an N-​dimension coordination system could be used to represent
the search space. In this case, any point within the search space, say X, can be
represented mathematically as a 1×N array as follows:

(
X = x1 , x2 , x3 ,…, x j ,…, x N ) (1.4)

With this basic representation of an optimization model in mind, we can con-


tinue dissecting the structure of the said problem to isolate and study each compo-
nent that is in play here.
An Introduction to Meta-Heuristic Optimization 5

1.2.1 Objective Function

As one’s interpretation of what is best may differ from others, it is crucial in an


optimization problem to explicitly define a mathematical procedure to evaluate
how desirable an option actually is. The idea here is to establish a robust mathem-
atical framework that quantifies the desirability of a potential solution. By doing
so, it becomes possible to evaluate and compare the tentative options against one
another so that, ultimately, the best solutions can be identified among all the pos-
sible options. In mathematical programming terminology, the objective function
constitutes the goal of an optimization problem (Bozorg-​Haddad et al., 2017).
Within the context of an optimization problem, one could attempt to minimize or
perhaps maximize the objective function value. In the former case, the idea is to
identify a solution that yields the lowest objective function value possible, while
in the latter case, the ultimate goal is to find a solution that is associated with
the objective function’s highest value. For instance, the objective function may be
defined in a way to minimize the amount of risk imposed on a system (e.g., Issa,
2013; Zolghadr-​Asli et al., 2018; Capo & Blandino, 2021) or perhaps maximize
the profit of an operation (e.g., Husted & de Jesus Salazar, 2006; George et al.,
2013; Kamrad et al., 2021). It should be noted that, from a theoretical standpoint,
any given maximization can be expressed as a minimization problem and vice
versa with a simple mathematical trick that is to multiply the said function by −1
(Bozorg-​Haddad et al., 2017).

1.2.2 Decision Variables

In an optimization problem, there are so-​called variables that, by changing


their values, you are effectively creating new solutions. Naturally, each solution
is associated with an objective function value. As such, the optimization can be
seen as identifying the most suitable values for these variables. Whether this is a
designing, operation, layout, or management problem, the critical feature associated
with these variables is that they can be controlled through this process. In fact, that
is why in mathematical programming terminology, these variables are referred to
as decision variables, given that the whole point behind optimization is to decide
which variable would be deemed the most suitable choice.
From a mathematical standpoint, as we have seen earlier, these variables could
be bundled together to form an array. This bundle represents a solution to the said
optimization problem, and the idea here is to find the right array that yields the best
objective function value.
A decision variable could take the form of an integer number. For instance, the
objective of an optimization problem could be to find the most economical way to
place a number of filters to refine an industrial site’s wastewater. In this case, the
number of filters, which is an integer number, is the decision variable. Note that the
problem may not even have a numeric variable. For instance, in the previous case,
we might also want to determine the type of filters as well. In such case, for each
filter, we have another decision variable that is by nature a nominal or categorical
6 An Introduction to Meta-Heuristic Optimization

variable; that is to say, we want to figure out which type of filter should be installed
to get the best result. The variable may also be binary in nature. This means that
only two possible values can be passed for that variable. For instance, if we want
to figure out whether an industrial site should be constructed in a place where we
tend to maximize the margin of profits. Here the variable could be either going
ahead with the project or shutting the project down. Mathematical programming
terminology refers to all three cases as discrete variables. Alternatively, a deci-
sion variable may also be a float number, which is a number drawn from the real
number set. An example of this would be when you want to determine the max-
imum amount of partially refined industrial site wastewater that can be released
back into the stream without violating the environmental regulatory thresholds set
to protect the natural ecosystem. In mathematical programming terminology, such
a case is an example of a continuous variable. Of course, in real-​world optimiza-
tion problems, we may have a combination of discrete and continuous variables.
These are said to be mixed-​type optimization problems.

1.2.3 State Variables

In most practical, real-​world optimization problems, such as those revolving


around engineering or management-​oriented problems, in addition to decision
variables, we also deal with another type of variable called state variables. These
are a set of dependent variables whose values would be changed as the decision
variables’ values are being changed. In a sense, these variables reflect how the
decision variables’ values affect the system and, in turn, its performance. As such,
these would help get additional information about the system’s state. It is important
to note that these variables are not being controlled directly through the optimiza-
tion process, but rather any change in these values is a product of how decision
variables are selected. In the example we have seen earlier, where we wanted to
determine the maximum amount of released wastewater to the stream, the stream’s
heavy metal concentration measures, for instance, are the state variables. Notice
that the decision variable in this problem is the amount of outflow from the site,
which can be controlled through the optimization problem. But as a consequence
of such releases, the heavy metal concentration measures of the streamflow would
be changed, making them state variables of this problem.

1.2.4 Constraints
Usually, optimization problems are set up in a way that decision variables cannot
assume any given value. In other words, an optimization problem can be limited by
a set of restrictions or constraints that bounds them between often two acceptable
thresholds. Often, this is because resources are limited, and as such, it is impos-
sible to pour unlimited supplies into a process or an operation. For instance, if you
intend to optimize the company’s workflow, there are budget and human resources
limitations that need to be accounted for. In addition to this, there are some legal
or physical restrictions that pose some limitations to the problem. For instance, in
An Introduction to Meta-Heuristic Optimization 7

optimizing the schedule of a power plant, some safety measures restrict how you
can operate the plant, even if there are resources available to pour into the system.
Another example of this would be optimizing the design of an infrastructure, where
tons of regulatory and physical restrictions must be considered in the optimization
process.
From a mathematical standpoint, two types of constraints can be found in an
optimization problem. The first type of restriction is what in mathematical pro-
gramming dialect is referred to as boundary conditions. Here the restrictions are
directly imposed on the decision or state variables themselves. As such, a decision
or state variable should always be within a specified boundary. This could either
mean that the said variable should always assume a value between a lower and
upper boundary or that the boundary is only applied in one direction. A general
representation of such boundary conditions can be seen in Equation (1.3).
The other form of restriction is non-​boundary conditions, which pretty much
sums up any other form of restriction that can be imposed on an optimization
problem. From a mathematical standpoint, this means that a function of two or
more decision or state variables is bound to hold a specific condition. This could
mean that the said function should be equal to, greater, or less than a specified
constant. A general representation of such boundary conditions can be seen in
Equation (1.2). Note that while an optimization problem may have no condition, it
may also be restricted by multiple conditions of different sorts.
In mathematical programming lingo, a solution that can hold all the possible
constraints of the optimization problem is referred to as a feasible solution. On
the other hand, if a solution violates even one condition, it is labeled an infeasible
solution. It is important to note that the ultimate goal of optimization is to find a
feasible solution that yields the best objective function value. This simply means
that an infeasible solution can never be the answer to an optimization problem,
even if it yields the best result.

1.2.5 Search Space

The idea behind optimization is to identify the so-​called optimum solution out
of all available solutions. As we have seen earlier, in an optimization problem
with N decision variables, any solution can be mathematically expressed as an N-​
dimensional array. By the same token, the combination of all the possible solutions
to an optimization problem can be interpreted mathematically as an N-​dimensional
Cartesian coordinate system, where each decision variable denotes an axis to the
said system. This would create a hypothetical N-​dimensional space, which in math-
ematical programming dialect is referred to as the search space. The idea is that
any solution is a point within this coordination system, and the main point of opti-
mization is to search through this space to locate the optimum solution.
As the previous section shows, not all solutions can be valid answers to an
optimization problem. In fact, any answer that violates at least one constraint is
considered an infeasible solution and, as such, cannot be passed as a viable result to
the optimization process. With that in mind, the search space could be divided into
8 An Introduction to Meta-Heuristic Optimization

Figure 1.1 Search space of a standard constrained two-​dimensional optimization problem.

two mutually exclusive sections that are feasible space and infeasible space. The
former constitutes the portion of the search space where all constraints can be held,
while one or more constraints are violated in the latter area. Naturally, the solution
to the optimization problem must be selected from the former space. Note that the
constraints can be assumed as a hyperplane that divides the search space into two
mutually exclusive sections. Based on the condition of the said constraint, either
one of these parts constitutes the feasible space, or the hyperplane itself denotes
this space. If more than one condition is involved, the intersection of all the feasible
portions will denote the feasible search space. In other words, the feasible space
should be able to satisfy all the conditions of the optimization problem at hand.
Note that, in mathematical programming lingo, the portion of the search space in
which all the boundary conditions are met is called the decision space. Figure 1.1
illustrates the search space of a hypothetical constrained two-​dimensional optimiza-
tion problem.

1.2.6 Simulator

As we have seen earlier, state variables play a crucial role in the optimization
process. Their role is often more pronounced in intricate real-​world optimization
An Introduction to Meta-Heuristic Optimization 9

problems where there is a form of dependency between the variables; or in


cases where there is detectable autocorrelation in decision variables, that is to
say, the value of the said variable in a given time step is statistically dependent
to the values of the same variable in previous time steps; or lastly in cases where
there are restrictions on some of the state variables. In such situations, which is
often the case for complex real-​world problems, capturing the underlying process
that governs the system through mathematical equations is an absolute neces-
sity. The said mathematical model, which in mathematical programming lingo
is referred to as the simulation model or the simulator, for short, is an integrated
part of the optimization model and the optimization process, as it enables the
process to unravel the intricate relationship between the variables and compute
their corresponding values at any given time. This mathematical representation
would help compute the state and decision variables under any condition. If need
be, the problem’s condition can also be checked through these computed values.
Therefore, these models are to emulate the nature of the system for the opti-
mization problem, and as such, they are an inseparable part of the optimization
models. In other words, you cannot have an optimization model without some
form of a simulation model.
A notable thing about the simulation portion of the optimization models is that
while this is the low-​key part of the computational process for most benchmark
problems, as you dive deeper into the real-​world optimization problems, these
simulators are naturally getting more intricate. This could, and often in complex
real-​world problems will, get to the point that the simulation portion of the opti-
mization problem becomes the most computationally taxing part of the whole pro-
cess. As such, one of the main goals of the optimizer would be to limit the number
of times the simulator is called upon during the optimization process.

1.2.7 Local and Global Optima


The optimization problem’s main task is locating the optimal solution in the search
space. This could be either identifying the point greater than the other solutions,
which is the case in the maximization problems or locating the point that yields
the lowest value of the objective function, which is the task of the minimization
problems. All the maxima and minima of an objective function are collectively
known as optima or extrema. In mathematical analysis, we have two types of
extrema or optima.
The first case is where the extremum is either the absolute largest or smallest
value in the entire domain of the search space. In mathematical analysis lingo,
these are referred to as the absolute or global extrema. Note that a function may
have more than one global optimum. From a mathematical standpoint, a point X*
can be considered an absolute optimum of a minimization problem if the following
condition can be held:

f (X* ) ≤ f (X ) ∀X (1.5)
10 An Introduction to Meta-Heuristic Optimization

In a maximization problem, a global optimum can be defined as follows:

f (X* ) ≥ f (X ) ∀X (1.6)

In addition to global or absolute extrema, mathematical analysis recognizes


another form of optimum that is called local or relative extrema. A point is
considered a local or relative extrema if it has either the largest or smallest value in
a specified neighboring range. In other words, these values are either the maximum
or minimum points in a specific section of the search domain. Again it is important
to note that a function may have more than one local optimum. From a mathem-
atical standpoint, a point X′ can be considered a local optimum of a minimization
problem if the following condition can be held:

f ( X ′) ≤ f ( X ) X −ε ≤ X ≤ X +ε (1.7)

Figure 1.2 The relative and absolute extrema of a generic one-​dimensional optimization


problem.
An Introduction to Meta-Heuristic Optimization 11

in which ε denotes a very small positive value.


In a maximization problem, a local optimum can be defined as follows:

f ( X ′) ≥ f ( X ) X −ε ≤ X ≤ X +ε (1.8)

Figure 1.2 depicts the relative and absolute extrema of an optimization problem
with a single decision variable.
All the local and global maxima and minima of an optimization problem are
collectively known as the extrema of the said problem. As we have seen, it is pos-
sible for an optimization problem to have more than one extremum. In mathem-
atical programming lingo, an optimization problem with such characteristics is
referred to as a single-​modal or unimodal optimization problem. On the other hand,
if a problem has more than one extremum, it is called a multimodal optimization
problem. Figure 1.3 depicts the schematic form of the single-​modal and multi-
modal maximization problem with one decision variable.
While in some practical problems, you may also need to identify all the extrema
of the multimodal optimizing problem at hand, often, as one can imagine, the main
objective of the optimization process is to identify all the possible global or absolute
optima of a given problem. This, however, as we would explore through this book,
is a bit challenging for sampling-​based optimization methods. In this branch of opti-
mization, it is often hard to distinguish local and global optima from one another.
More importantly, there is no guarantee that you have encountered them all through
the searching process or whether the point is, in fact, an extrema or we just did not
happen to run into a point with better properties in our stochastic sampling process. So
in optimization methods that are established on the idea of sampling, it is crucial to be
aware of these so-​called pitfalls as we strive to locate the absolute optimum solutions.

Figure 1.3 The generic scheme of (a) single-​modal and (b) multimodal one-​dimensional
maximization problem.
12 An Introduction to Meta-Heuristic Optimization

Figure 1.4 The generic scheme of near-​optimal solutions in a one-​dimensional maximiza-


tion problem.

1.2.8 Near-​Optimal Solutions

A near-​optimal solution refers to an approximate feasible solution that is within


the vicinity of the global solution, but it is not the absolute solution itself. From a
mathematical point of view, a near-​optimal solution, here denoted by P, of a mini-
mization problem can be defined as follows:

f (P) ≤ f ( X* ) + ε (1.9)

In the maximization problem, an ε-​optimal solution can be expressed as follows:

f (P) ≥ f ( X* ) + ε (1.10)

The idea of a near-​optimal solution is formed purely for practical purposes.


Most analytical optimization methods can identify the absolute optimal solutions,
but as seen earlier, there are some inherent problems with these approaches when
An Introduction to Meta-Heuristic Optimization 13

it comes to handling complex real-​world problems. As such, sampling methods


were introduced as an alternative approach to address these shortcomings. But
the innate structure of these models poses some serious challenges for them
as they tend to locate the absolute optimal solutions. In other words, while
often they can get a close-​enough approximation of the optimal solution to the
problem at hand, as the problems get more intricate, they fail to identify the
absolute optimal solutions. However, in most practical, real-​world optimization
cases, this can be passed as an acceptable compromise. In other words, often,
the time and computational labor needed to find the absolute optimal solutions
to such intricate problems are so overwhelming that it justifies settling down for
a passable approximation of the optimal solution. Figure 1.4 depicts the central
concept of the near-​optimal solution in a maximization problem with one deci-
sion variable.

1.3 The General Theme of Meta-​Heuristic Algorithms


As we have seen, using the gradient to detect the optimum point could pose serious
computational challenges when dealing with real-​world problems. Sampling-​based
optimization methods were an answer to these noted shortcomings. However, most
of these methods were too random in nature to be considered a formidable option
to handle complex optimization problems. For the most part, this is due to the fact
that for most of these methods, there was no guiding system to navigate the search
process. And this is where the computational intelligence (CI)-​based optimization
methods enter the picture.
CI-​based optimization methods, which are often referred to as meta-​heuristic
optimization algorithms, are a subset of guided sampling methods. This branch
of optimization methods is basically an alternative approach to accommodate the
shortcomings of conventional analytical-​based approaches and unguided sampling-​
based methods. In a sense, these methods were able to bridge the gap between these
two vastly different approaches and create a new school of thought to handle real-​
world optimization problems.
Here, the optimization method is an algorithm composed of a series of iterative
computational tasks that enumerate through the search space over a sequence of
trial-​and-​error and often converge to a close-​enough approximation of the optimum
solution. In computer science lingo, the term algorithm refers to a finite sequence
of explicitly defined, computer-​implementable instructions to either solve a class
of specific problems or perhaps to perform a predefined computational task
(Yanofsky, 2011).
The term meta-​heuristic is rooted in the Greek language, where “meta” translates
to “upper level” or “higher level,” and the phrase “heuristic” means “the art of
discovering new strategies.” In computer science terminology, the term heuristic
refers to experience-​derived approaches that are used to either solve a problem
or gather additional information about a subject. Often, however, these methods
can be seen as ad hoc problem-​solving approaches given that they are primarily
14 An Introduction to Meta-Heuristic Optimization

problem-​dependent and hatched solely with a particular problem in mind. And as


such, despite the fact that such approaches could often lead to reasonably close-​
enough solutions with adequate computational time, they cannot be seen as a uni-
versal, multi-​purpose framework.
It is hard to pinpoint the exact origin of meta-​heuristic algorithms accurately.
A simple review of the literature on this subject would reveal that some algorithms
and optimization methods were proposed over the years that defiantly resembled
some of the characteristics of CI-​based methods to some extent. But perhaps
the most notable attempt to deviate from the principles of traditional optimiza-
tion methods was the introduction of the pattern search algorithm. Theorized by
Hooke and Jeeves (1961), the pattern search algorithm, also known as random
search, represents, arguably, one of the pivotal points in the history of optimization
techniques, as the principles used in this algorithm closely resembled those from
the next generation of optimization methods that become known as meta-​heuristic
optimization algorithms.
By the early 1990s, many researchers had started conceptualizing CI-​based
frameworks to tackle optimization problems. These methods were based on
the theoretical foundation of random sampling. The distinctive feature of these
methods was that they were conducting a guided search that could be adjusted
by the user to be tailored for a specific optimization problem. This is why Glover
(1986) coined the phrase “meta-​heuristic” to distinguish this branch of optimiza-
tion methods. The idea is that these methods were to be conceptually ranked above
heuristic methods in the sense that they can alter and control the structure of a
heuristic framework, elevating them from the ad hoc method to a more univer-
sally applicable framework. It is important to note that these are still sampling
methods in nature, and as such, they would inevitably inherit some of the gen-
eric drawbacks often associated with such methods. But ultimately, the innate
characteristics of these methods enable them to go over a large number of feasible
tentative solutions with fairly reasonable computation effort to locate what could
be the near-​optimal solution.
Often, meta-​heuristic optimization algorithms are designed to be fine-​tuned to
better handle the search space and the problem at hand, hence the name meta-​
heuristic algorithm. The idea is that through a series of trial-​and-​error, the algo-
rithm could guide us toward the vicinity of the optimum solution. If need be, it is
possible to alter the algorithm to reflect and adapt to the unique characteristics of
the search space. Again the backbone of these algorithms is to resort to approxima-
tion, hence being categorized under the umbrella of CI.
The other notable feature of these algorithms is rooted in their guiding mech-
anism. The search engine of these algorithms enables them to navigate the search
space. But what distinguishes them from other known sampling-​based optimiza-
tion methods is that the searching process is guided by the information obtained
by the algorithm during its searching phase. As such, these algorithms are, in a
sense, learning from their encounter with the search space and utilizing the gained
information to adjust their performance. But what is important here is that, unlike
An Introduction to Meta-Heuristic Optimization 15

calculus-​based optimization methods, here the guiding information is not derived


from gradient-​based information. Instead, these methods use a direct search to gain
information about the search space and ultimately navigate their search process. In
this context, a direct search indicates that the algorithm would utilize the function
values directly in its searching process rather than resorting to information from the
derivation of a function.
In order to bring together these ideas in a practical way, these algorithms need
to be designed so that they can execute a series of commands repeatedly until they
can confidently return what could be passed as the near-​optimal solutions. In fact,
the iterative process seen in all meta-​heuristic algorithms allows these algorithms
to thoroughly search the space by adjusting their performance in each attempt.
As a result of this unique computational formation, the structure of meta-​
heuristic algorithms can often be classified into three main stages, namely, ini-
tiation, searching, and termination stage. In the initiation stage, the algorithm
would be set up to conduct the search. Here the algorithm would take all the input
information, and the user would need to tune the algorithm via its parameters.
The parameters of an algorithm are the mathematical instruments through which
you can change the properties of an algorithm. After the initiation stage, the algo-
rithm executes the search process. This is, for the most part, where the algorithm
differs from one another. Meta-​heuristic algorithms often look at the outside world
as a source of inspiration to formulate a search strategy that helps them build
an efficient search engine. This engine would help the algorithm to enumerate
through the search space to locate what could be the near-​optimal solution. As
we have seen earlier, this is an iterative process, meaning that the engine would
keep repeating the same strategy until it can finally stop the process. At this point,
the algorithm enters the last phase, the termination stage. From a computational
standpoint, this means that a termination criterion has been met, which signifies
that the search process can come to an end. Note that without such a termin-
ation stage, the algorithm could be executed in an infinite loop. In effect, the ter-
mination stage determines whether the algorithm has reached what could be the
optimum solution. While some algorithms are equipped with uniquely designed
termination criteria, most meta-​heuristic algorithms lack such features. As such,
in order to implement these algorithms in practice, one would need to ensemble
a termination criterion into their computational structure. Some of the most com-
monly cited options in this regard are limiting the number of iterations, run time,
or perhaps monitoring the improvement made to the best solution in consecu-
tive iterations. Among these options, limiting the number of iterations is argu-
ably the most known mechanism to create a termination stage for meta-​heuristic
algorithms. The idea is that the predefined procedures of the algorithm would be
executed only a specified number of times before coming to a halt and returning
the best solution found in the process.
As a side note on the searching process, it is essential to know that often in this
stage, the search engines of meta-​heuristic optimization algorithms would ultim-
ately need to go over two distinctive phases that are exploration and exploitation
16 An Introduction to Meta-Heuristic Optimization

phase. In the exploration phase, also known as the diversification phase, the algo-
rithm usually tends to explore the search space with more random-​based moves that
are more lengthy and sporadic by nature. After this phase, the algorithm would tend
to focus more on specific regions of the search space where it deemed them more
likely to house the optimum solution. This is the task of the exploitation phase,
which is also referred to as the intensification phase. Having a search strategy that
emphasizes adequacy on both these pillars is crucial for an efficient and thorough
search. Often, the algorithms would tend to transition smoothly from the explor-
ation phase to the exploitation. However, as we would see later in this book, there
are those algorithms that are designed in a way that they can execute both phases
simultaneously.
Today, meta-​heuristic algorithms have established themselves as one of the
most fundamental and pragmatic ways to tackle complex real-​world optimiza-
tion problems. These methods could theoretically handle high-​dimensional, dis-
continuous, constrained, or non-​differentiable objective functions. This does
not mean that these methods are without their drawbacks. Firstly, the algorithm
would pursue the near optima rather than the global optimum solutions. This,
of course, does not pose a serious challenge to most practical cases. Secondly,
given the stochastic nature of this process, and the trial-​and-​error component
that is the inseparable part of meta-​heuristic optimization methods, there are
no guarantees that these algorithms could converge to the optimum solution.
Also, there is always the possibility that the algorithm could be trapped in local
optima, as there is no sure way here to distinguish the relative and absolute
extrema. Of course, one can always try to play with the algorithm’s param-
eter and, through a series of trial-​and-​error experiences, find a more suitable
setting for the problem. The bottom line, however, is that while fine-​tuning the
parameters of a meta-​heuristic optimization algorithm can undoubtedly have an
impact on the final solution, and there are certain measures to see if an algo-
rithm is performing the way it should, there can never be any guarantee that the
emerged solution is indeed the global optimum. All in all, these shortcomings
should not undermine the importance of these methods and their capacity to
handle complex real-​world problems.

1.4 Different Types of Meta-​Heuristic Algorithms


Meta-​heuristic algorithms have become one of the most topical subjects in the
field of mathematical programming. Nowadays, there are hundreds of meta-​
heuristics available for those interested in employing these types of optimiza-
tion methods. While these meta-​heuristic algorithms are built upon the very
same foundations we explained earlier, naturally, they differ from one another
in numerous ways. From a pedagogical standpoint, it is never a bad thing to
see how different methods are similar to one another, understand the common
denominator in their computational structure, or dissect their general theoretical
foundation. As such, in this section, we tend to explore how these methods are
categorized in the literature.
An Introduction to Meta-Heuristic Optimization 17

1.4.1 Source of Inspiration

It became a common practice in the field of meta-​heuristic optimization to ponder


about the outside world as a source of inspiration to establish the computational
foundation of a search engine. If you come to think of it, nature has evolved
through millions of years to finally establish the perfect way to perform a specific
task. In a sense, through countless iterations of trial-​and-​error, natural selection,
and even the evolutionary process, nature has found the optimum solution for a
given task, which may range from the foraging behavior of a group of animals, the
reproductive procedure of a plant species, chemical, physical, or biological events,
or perhaps even the evolutionary process itself. As such, meta-​heuristic optimiza-
tion algorithms find a way to imitate an abstract and idealized interpretation of
these events with the hope that they could get the same effect as they search for the
optimum solution within the search space. It used to be the case where algorithms
with akin inspiration sources, such as those inspired by nature, were often based
on similar analogy, terminology, and even computational structure. Modern meta-​
heuristic optimization algorithms tend to implement more intricate algorithmic
architectures, making these classifications obsolete (Bozorg-​Haddad et al., 2017).
That said, understanding the inspiration source of an algorithm, or those that are
somewhat related to it, could help you appreciate the computational intricacies
of an algorithm and, in turn, become handy as one tends to implement the said
algorithm.

1.4.2 Number of Search Agents

Meta-​heuristic optimization algorithms are based on taking samples from the


search space. In effect, they tend to enumerate through the search space via an
iterative process. The algorithm would use the information obtained from previous
encounters to adjust its performance and the searching process in each iteration.
The act of searching would be conducted through what is known in CI lingo as a
search agent. Although on the surface, the search agent has a mathematical struc-
ture of a solution that is an N-​dimensional array, it plays a more crucial role in the
computational structure of the algorithm. A search agent, from a computer science
standpoint, is, in fact, a mutable object. The idea is that the algorithm recognizes
a search agent as a unique object throughout the search process, even though this
object may assume different values. In other words, the values of the array that is
the mathematical representation of the search agent would be altered throughout
the searching process, but the algorithm would always recognize this as the same
computational object. This would, in turn, enable the algorithm to keep track of the
search agent’s movement during the run time of the searching stage. As such, the
information obtained from this repositioning of the agent within the search space
could provide the algorithm with additional information about the optimization
problem. The algorithm would then use this feedback to suggest new positions for
the search agent. And this process would be repeated until the algorithm reaches
its termination point.
18 An Introduction to Meta-Heuristic Optimization

Some meta-​heuristic algorithms would employ a single search agent to con-


duct the search. These are often referred to as single-​solution-​based algorithms.
The other known terminologies for them are trajectory methods and encompass
local search-​based meta-​heuristic algorithms. The reason is that the algorithm
effectively traces an object’s moving trajectory as it enumerates through the search
space. Given that the searching process solely relies on tracing a single object
throughout the iterations, these algorithms are often less computationally taxing.
Alternatively, an algorithm may use multiple search agents. These algorithms are
often referred to as population-​based algorithms. Most modern meta-​heuristic
algorithms are, in fact, population-​based. Having multiple search agents that simul-
taneously enumerate the search space would, in effect, increase the odds of locating
the optimum solution while reducing the chance of being trapped in local optima,
which happens to be one of the main pitfalls of meta-​heuristic optimization. What
is important here is that the unique computational structure of these algorithms
often enables them to be less computationally taxing than one might initially think.
The algorithm could carry this task with less computational effort through par-
allel computation, a common feature of most modern programming languages,
including Python.

1.4.3 Implementation of Memory

An exciting feature of CI-​based methods is the implementation of memory. While


this is by no means a mutually exclusive or universal feature, when it comes to
computation time, algorithms with this feature embedded in them would certainly
have the edge over the competing methods. A memory-​based feature could help the
algorithm trace previously encountered information and, in turn, use this data to its
advantage. Of course, having such capabilities would come at a price, primarily if
not used efficiently, given that this requires more memory storage and computation
power. That said, with the advancement of computational science and modern-​day
technologies, this is something that, at least to some extent, could be overshadowed
by the many benefits that having such a feature would bring to the table.
By the same token, meta-​heuristic optimization algorithms are divided into
major groups when it comes to utilizing a memory-​based feature within the com-
putational structure of these algorithms, namely, memory-​based and memory-​less
algorithms. In a memory-​based algorithm, it is possible to keep track of the search
agents’ movements in the previous iteration. Notice that while it is always possible
to trace all the moves that occurred during the searching process, it is certainly
not the most efficient way to do things from a computational standpoint. In most
real-​world optimization problems, resorting to these practices may not even be
possible, given the overwhelming memory use and computation power needed to
keep up with the search agents, as this could quickly get out of hand. As such, the
most particle way to implement a memory-​based feature is to limit the memory’s
capacity to a certain number of events. After reaching its capacity, the memory
would start dumping old data to make room for new information. Alternatively, in
a memory-​less algorithm, a Markov chain-​like procedure would help update the
An Introduction to Meta-Heuristic Optimization 19

position of the search agents. The idea here is that the algorithm’s current stage
only depends on its previous stage. As such, to reposition an agent, the algorithm
would only need to know where a given agent is at the moment. Again, given the
many advantages of having a properly designed memory-​like feature in the struc-
ture of an algorithm, most modern-​day meta-​heuristic optimization algorithms are
designed with this feature embedded in their algorithmic architecture (Bozorg-​
Haddad et al., 2017).

1.4.4 Compatibility with the Search Space’s Landscape

As we have seen in the previous sections, there are two general types of deci-
sion variables; those that are of a continuous type and, of course, discrete decision
variables. By the same token, there are two general types of search spaces, namely,
continuous and discrete search spaces. What is important to note here is that, from
a computational standpoint, searching through these search spaces would require
different strategies. While some algorithms are innately designed to handle discrete
search spaces, others can only tackle problems with continuous search spaces. That
said, there are certain tricks to switch these two so that an algorithm would be
compatible with both search spaces. The most notable idea here is discretization,
where a continuous space would be transformed into a discrete one by transposing
an arbitrarily defined mesh grid system over the said space. By doing so, you can
use a discrete meta-​heuristic algorithm to enumerate through a continuous search
space. That, as you can imagine, is not without its drawbacks. The main problem
is that you essentially lose some information in these transitions. As such, you
cannot be sure if the optimum solution is, in fact, in the newly formed grid system,
no matter how fine of a mesh grid you use for this transition. Often, however, the
researchers would tend to use the governing computational principles of an algo-
rithm to rebuild a revised or modified version of the algorithm that is compatible
with the other type of search space. Note that researchers may also use this strategy
to add new features or tweak the structure of an algorithm to create a more effi-
cient modified algorithm (Yaghoubzadeh-​Bavandpour et al., 2022). While the new
algorithm is still built on the same principles, it can usually outperform its original
standard version in one way or the other.

1.4.5 Random Components

As we have seen thus far, the structure of the meta-​heuristic algorithms is built on
the idea of guided random sampling. As the random sampling goes, we have three
main ideas to draw a sample from a set; one being to select the samples based on
pure randomness; we can select the samples using a systematic deterministic struc-
ture; and finally, there is the stochastic selection, which is something in between
the previous approaches, meaning that while there is a random component to the
selection procedure, it also follows some deterministic instruction as well. By the
same token, meta-​heuristic optimization algorithms can be categorized into two
classes that are stochastic and deterministic algorithms.
20 An Introduction to Meta-Heuristic Optimization

In stochastic algorithms, a more common practice in this field, the algorithm


has some random components within its computational structure. Often, you would
find the random component in the initiation stage of the algorithms, where they
randomly place the search agents within the feasible boundaries of the search
space. These algorithms also introduce some random motion to the movement of
the search agents. The idea is that doing so would reduce the odds of being trapped
in local optima, as this component expands the search agents’ exploration capaci-
ties. This also means that, due to the random nature of some of the computational
procedures used in these algorithms, you may get different results each time you
execute the algorithm. Though if appropriately set, these differences should not be
so pronounced. Alternatively, the algorithm may be categorized as deterministic.
This is not a common practice in this field by any means; in fact, there are only a
handful of these algorithms. That said, the idea is that the computational structures
of these algorithms, from the initiation stage down to the termination stage, are all
based on deterministic-​based instructions. As such, unlike stochastic algorithms,
running the algorithm at any time should lead to the same result. But the main
problem with these algorithms is that falling into the trap of local optima is always
a real possibility. And if that happens to be the case, there is no way for the algo-
rithm to get out of the said trap, no matter how many times you run the algorithm.
And the only way to address this is, perhaps, to reset the algorithm’s parameters,
yet there is no guarantee that this could also solve the issue. Notice that we do not
have a pure random meta-​heuristic algorithm because we need a mechanism in the
algorithm to converge the solutions into what could be the near-​optimal solution.
This is done through transiting between the exploration and exploitation phase. An
algorithm that is built solely of random components would not have the necessary
means to make this transition.

1.4.6 Preserving Algorithms


As we have seen, a meta-​heuristic algorithm tends to trace the reposition of
one or multiple search agents to gain information about the search space. In a
sense, the algorithm is constantly updating the position of these agents within
the search space, and by doing so, it is, in effect, drawing new samples from it.
By doing so, the search agent would need to assume the new values, which, from
the mathematical point of view, simply means that the array that represented
the said agent would change in this update. There are two different schools of
thought when it comes to perceiving these transitions by meta-​heuristic opti-
mization algorithms. One way of seeing things is to let any repositioning take
place, regardless of whether it is an improving move. Often, the algorithms that
follow this idea have a better exploration property. However, the sampling nature
of meta-​heuristic algorithms dictates that there are no guarantees that we are pre-
serving the absolute best solutions within the search. This is significantly more
pounced in memory-​less algorithms.
Alternatively, there are those algorithms that are built on the idea that the best
solutions must be somehow preserved during the search. From a practical point
An Introduction to Meta-Heuristic Optimization 21

of view, there are two known ways to create such an effect. One is that the algo-
rithm always preserves the best or even some of the best solutions as it iterates
to locate the optimum solution. These ideas are computer science lingo called
elitism, and an algorithm based on this idea is called an elitist algorithm. The other
known approach here is only to permit the improving moves to occur and reject the
non-​improving ones. This idea in computer science lingo is known as the greedy
strategy. Both these ideas can preserve the best solutions encountered through the
search. But this also means that they would lose some of their exploration capaci-
ties. More importantly, the algorithm is more likely to be trapped in local optima, as
they tend to only move toward better positions in the search space. These problems
are more pronounced for single-​solution-​based algorithms and greedy strategy,
given that in the first case, the search only relies on a single search agent, and in the
second case, non-​improving moves are not permitted through the search, meaning
that there are no escaping the local optima if search agents assume these values.
Notice that elitism and greedy strategy for a single-​solution-​based algorithm are,
in effect, telling the same story, as in the end, they would have the same overall
effect. Also, it is essential to bear in mind that either strategy can be later added to
an algorithm to, perhaps, enhance its performance.

1.5 Handling Constraints


As we have seen, a solution that can satisfy all the constraints of optimization
problems is referred to as a feasible solution. On the other hand, violating even
one constraint would deem the solution infeasible. The main objective of the
optimization methods is to locate the best possible feasible solution within
the search space. In other words, an infeasible solution can never be seen as
the answer to an optimization problem, even if it yields the best objective function
value. With that in mind, given the exploratory sampling-​based nature of the
meta-​heuristic algorithm, they must avoid returning an infeasible solution at any
cost. There are basically three main strategies cited in the literature to handle
this computational challenge: removal, refinement, and penalty function (Bozorg-​
Haddad et al., 2017).
Implementing the removal strategy to address the issue of passing infeasible
solutions as the optimal solutions is perhaps the most primitive way to handle the
given situation. According to this strategy, an infeasible solution must be eradicated
from the search process at any given time it is presented by the search engines. As
can be seen, this is a simple enough strategy to be executed or embedded in the
structure of an algorithm. But there are a few notable shortcomings attributed to
this method, which makes it not an ideal option when handling constraints in an
optimization process. First and foremost, the algorithm must go the extra mile to
create another solution, which might, again, be infeasible. The problem is more
pronounced in deterministic algorithms as the new solution would undoubtedly be
infeasible. So there is a possibility here that the algorithm may be stuck in a long, or
even infinite, computational loop. The other problem is that by straight-​up tossing
the infeasible solutions from the search, you might lose some valuable information
22 An Introduction to Meta-Heuristic Optimization

about the search space’s landscape. This is mainly due to the fact that we are not
making any distinction between a solution that slightly violates the constraints or a
case where there are severe violations of the set restrictions. In the former case, the
infeasible solution could have been used as a guide to help the search agent locate
the optimum solution. All in all, while this is undoubtedly an easy way to handle
constraints, it certainly is not the most efficient way to do so.
Alternatively, based on the refinement strategy, you can save the infeasible solu-
tion by the process as you adjust the variables to be deemed feasible again. As such,
unlike the removal strategy, here, you are not directly eradicating any infeasible
solution from the search process. While this is a manageable strategy when the
violations are restricted to the boundary conditions, any other type of violation
is rather hard to be refined by this method. In the former case, you can simply
replace the value of the violating variable with one of the threshold values, which
is a reasonably simple task. However, if the constraints involve multiple decision
variables, there is no universal or straightforward approach to alter the solution in
a way that transforms it into a feasible solution. And more importantly, even if you
can make this transition, there is no way to tell if this is the best way to change an
infeasible solution into a feasible one when it comes to preserving additional infor-
mation about the search space, which is the whole point behind these strategies. As
such, while this is an acceptable remedy to keep the solutions within the decision
space, it is not necessarily the best option for constraints that involve multiple deci-
sion or state variables.
The last option to address constraints is implementing the idea of penalty
functions. The idea here is to penalize the objective function value proportional
to how much the said solution has violated the constraints of the problem at hand
through a mechanism called the penalty function. In effect, a penalty function
determines the severity of these penalties based on how much a solution has
violated a said constraint. Naturally, the more violation forms a solution, the more
severe these penalties would get. So in a maximization problem, as a penalty, a
positive value would be subtracted from the objective function value rendering
it less suitable. In contrast, a positive value would be added to the objective
function value in a minimization problem. It is important to note that the amount
of this penalty function must be directly proportional to how much a solution
violates an optimization problem’s constraints. The other notable thing is that
each constraint could have its own penalty function mechanism. The overall pen-
alty imposed on a solution is the accumulated values of all the said penalties. In
mathematical programming lingo, a penalized objective function is referred to
as the cost function or fitness function. This can be mathematically expressed as
follows:

F (X) = f (X) ± p(X) (1.11)

where F() represents the fitness function, and p() denotes the penalty function.
Note that we would subtract the penalty values from the objective function in the
An Introduction to Meta-Heuristic Optimization 23

maximization problem, while in minimization problems, we would add the penalty


values to the objective function.
The generic form to create the penalty function for a standardized constraint
(i.e., a constraint that is written as a less than or equal to expression), such as the
one depicted in Equation (1.2), can be formulated as follows:

ϑ k if gk ( X ) > bk
pk ( X ) =  ∀k (1.12)
 0 if gk ( X ) ≤ bk

ϑ k = α k ×  gk ( X ) − bk  + γ k
βk
∀k (1.13)

in which pk() denote the penalty function for the kth constraint; ϑk represents the
amount of penalty that is associated with the kth constraint; and αk, βk, and γk are
all constant values for adjusting the magnitude of the penalty function for the kth
constraint. Using these constants, you can control the amount of penalty that would
be applied to the objective function. In other words, increasing these values would
apply a more severe penalty to the objective function. However, using the proper
penalizing mechanism is a critical subject if you want to get a good result out of
these algorithms. Because the point is, applying acute penalties would be, in effect,
equivalent to omitting the infeasible solutions. Applying mild penalties could also
have no visible result on the search algorithms’ emerging solution. So it is crucial
to keep a balance between two extreme situations. However, finding the proper
values for these parameters would need some prior experience and perhaps sensi-
tivity analysis.
By the same token, you can create a penalty function for any other constraint
type. Of course, the general idea is to apply the penalty whenever the said solu-
tion violates the said constraint. All these penalties would be collectively applied
to the objective function to get the fitness function value of the solution. Through
this mechanism, in effect, you would map the objective function to the fitness
function values, which would be used from that point onward as the evaluation
mechanism. As such, the algorithm would use these values to determine how good
a solution is and, in turn, select the optimum solution based on these values. Again,
it is essential to note that, like meta-​heuristic algorithms, this is also, by nature, a
trial-​and-​error procedure, meaning that there could never be an absolute guarantee
that the final solution is never infeasible or there is no better feasible solution in
the search space.

1.6 Performance of a Meta-​Heuristic Algorithm


As we have seen thus far, the whole idea behind meta-​heuristic algorithms is to
use the principle of guided sampling to locate the optimal solutions. But due to the
nature of these algorithms, they often settle for identifying a near-​optimal solution.
What happens behind the scene is that the algorithm would continually enumerate
24 An Introduction to Meta-Heuristic Optimization

through the search space by tracing the movement of the search agents. And if
the algorithm is set up correctly, little by little, it gets closer and closer to a spe-
cific position in the search space until there is no room for any improvement. At
this point, it is said that the algorithm has converged to the optimum solution. If,
however, the algorithm’s searching process terminates before this point, it is said
that there is premature convergence; That is to say, the emerged solution from this
search is not actually the optimum solution, and the search should have continued
for a bit longer. So, as can be seen here, the final solution of a meta-​heuristic algo-
rithm, in and of itself, cannot be sufficient to interpret the quality of the result.
Instead, you need to trace the progression of the search process to see how reliable
the emerging solution actually is. Analyzing the convergence rate of an algorithm
is one of the primary tools for understanding the performance of an algorithm and
the reliability of the outcome solutions.
One of the simplest ways to tackle this matter is to plot the algorithm’s conver-
gence rate throughout the search. Here, like any data-​driven science, visualization
could offer reliable guidance to unravel the intricacies of a problem at hand. In
order to do that, either the objective or the fitness function values would be plotted
against either the run time, number of iterations, or, more commonly, a technical
measure called the number of function evaluations, or NFE for short. NFE is a tech-
nical term that refers to the number of times the objective function has been called
during the search. To understand this concept, we must first understand how the
algorithm actually converges throughout the search.
Figure 1.5 illustrates how the algorithm’s solutions converge as the search
progresses for a minimization problem. For simplicity, let us assume that we are
tracing the progression of the search against the iteration or the run time metrics.
This should be reasonably straightforward for the single-​solution-​based algorithms,
as we deal with a single search agent in this type of algorithmic structure. However,
in population-​based algorithms, we could select the best solution in the population
set as the sole representative of the said set. As such, the said values would be
plotted against time or the iteration count to trace the progression of the search pro-
cess. As can be seen here, often, the algorithm experiences a sudden and massive
drop within the first few iterations. But as the algorithm progresses, these changes
become more subtle and less pronounced until, eventually, there are no visible
changes in the values of the objective function. Again, it is essential to note that
if there are notable changes in the tail of the convergence graph; this means that
there is premature convergence, and you need to recalibrate the algorithm to get the
optimum result. This can often be addressed by extending the termination process
so the algorithm can do more iterations. It is also essential to note that there are two
generic types of convergence graphs. In meta-​heuristic algorithms that are based
on the idea of preservation strategies, say elitism or greedy strategy, the graphs are
monotonic, meaning that if the algorithm’s returned values are decreasing, there
are no sudden upticks in the graph, and if the values are increasing, there cannot be
a decreasing section in the plot. This is mainly because these sorts of algorithms
always preserve the best solutions in each iteration, so the algorithm is either con-
tinuously improving or at least staying the same. The graph of algorithms that do
An Introduction to Meta-Heuristic Optimization 25

Figure 1.5 Convergence of an optimization problem toward the minimum solution of (a) an


algorithm with a preservation strategy and (b) an algorithm with no preservation
strategy.

not resort to preservation strategies is non-​monotonic, meaning that there can be


sudden, often mild, jumps in the graph. In either case, as the algorithm transits from
the exploration phase to the exploitation phase, you would see a shift in the tone of
the graph as it becomes more static.
Now let us expand on the idea of convergence rate in the context of different
termination metrics. The first idea is to use the idea of run time, that is, to plot the
objective function against the time that took the algorithm to reach the said value. In
data science lingo, any graph that is plotted against the time variable is called a time
series. While this graph has helpful information about the algorithm’s performance
in terms of how fast an algorithm actually is, there are a few things that need to
be understood when you want to analyze these types of plots. First and foremost,
you need to understand that the computation speed of an algorithm is not solely
a reflection of the innate computational structure of an algorithm, but it is also a
product of the quality of the executed code, the programming language itself, and
of course the system that is doing the heavy lifting of the computational process.
For instance, compiled programming languages such as C+​+​ are inherently faster
than interpreted programming languages such as Python. As such, it is crucial to
mention which programming language was used to execute the meta-​heuristic opti-
mization algorithm. Naturally, the system that is used to carry the computation also
plays a crucial role in how fast the code is executed. Again, that is why it is essen-
tial to report the system configuration with the obtained result, including the tech-
nical properties of the system’s random-​access memory (RAM), central processing
26 An Introduction to Meta-Heuristic Optimization

unit (CPU), or graphics processing unit (GPU), depending on which processor was
used to do the computation, and even the operating system (OS) can play a role
here. It is important to note that comparing the convergence speed of two given
meta-​heuristic optimization algorithms or different parameter settings for a given
algorithm would only make sense if the systems that executed them were identical.
Lastly, there is the quality of the code in which the algorithm was written down
in the given system. Naturally, while this is indeed a crucial factor in how fast or
smoothly an algorithm handles a given optimization problem, it is quite challen-
ging actually to quantify this factor in an objective way. The programmers’ skills
and knowledge of a programming language could help them find a more efficient
way to implement an algorithm. For instance, it is entirely plausible for a more
experienced programmer to find an elegant way to improve the performance of a
coded algorithm by a beginner programmer in terms of the speed and efficiency of
the program. And while this is indeed an essential factor in the convergence speed,
it is impossible to report any objective information on this matter. All in all, while
it is not a bad idea to have some idea about the run time of an algorithm, as we have
seen here, it is not necessarily the best metric to use as an analytical tool to study
the convergence of an algorithm.
The other option here is the number of iterations that took the algorithm to
reach an objective function. Here, we could plot the objective function values
against the iteration numbers. While, in this approach, we are certainly excluding
the innate problems that we have named earlier, which are the system’s compu-
tational power, the technical properties of the programming language, and, more
importantly, the programmers’ skill set from our analysis, there is still one major
subtle problem with the way that we are breaking down the performance of the
algorithms.
As we have seen in the previous section, some algorithms use one agent to
enumerate through the search agent, while others may employ multiple agents to
carry out this task. So in a single iteration, the former group is arguably doing less
computation than the latter group. This is important to note, given that in most
real-​world optimization problems, the most computationally taxing part of the pro-
cess is calling the simulator that gets activated as you call the objective function
in your algorithm. Some algorithms may even call this function multiple times
within the same iteration for each search agent, which requires additional compu-
tational power. Of course, this would also mean that such algorithms may have a
better chance of converging to near-​optimal solutions. So, the metric that should
be monitored here is not the number of iterations per se but rather the number of
times the objective function is called during the search. This is, in fact, the defin-
ition of the NFE. By using this metric, you are factoring in the number of search
agents and, more importantly, the innate efficiency of the algorithm itself and not
the programmer’s skill set. For instance, an algorithm that often calls the objective
function would consequently have a greater NFE than a more efficiently designed
algorithm that rarely calls this function during the search. As such, plotting the
objective function against the NFE values is a more reasonable way to analyze or
even compare the convergence of meta-​heuristic algorithms.
An Introduction to Meta-Heuristic Optimization 27

Aside from the visualization of the convergence rate, we need other quantifiable
metrics to analyze the performance of an algorithm. These would not only be used
in the fine-​tuning procedure to get the best result out of an algorithm for a specific
optimization problem, but they are also helpful when comparing the performance
of two or even more algorithms. Again, to apply these measures, we must first run
the algorithm with the same setting for a specified number of times. This is mainly
due to the fact that often these algorithms are based on stochastic sampling. This
means that the algorithm would return a different solution that may slightly differ
for each run. So the idea is after fully running the algorithms numerous times,
you would use these metrics to evaluate their performance. As such, in addition to
reporting the solutions obtained in each run, you can report these metrics to give
a more wholesome idea about the performance of the algorithms. There are four
general areas to evaluate an algorithm’s performance that are efficacy, efficiency,
reliability, and, finally, robustness.
In this context, efficacy-​based metrics measure how an algorithm is performing
regardless of its convergence speed. Three known metrics here are mean best
fitness (MBF), the best solution in all runs (BSAR), and the worst solution in all
runs (WSAR) (Du & Swamy, 2016; Bozorg-​Haddad et al., 2017). MBF denotes the
average of the best objective or fitness function value of all runs. BSAR denotes
the best objective or fitness function value that was found among all the runs. By
the same token, WSAR denotes the worst objective or fitness function value that
was found among all the runs.
The idea behind reliability-​based metrics is to measure the ability of an algo-
rithm to provide acceptable results. The most notable measure here is the success
rate (SR) (Du & Swamy, 2016). To work on this measure, you must first identify the
best solution among all the runs. Any time the solution comes within an acceptable
range of this value, meaning that you also need to set a predefined threshold here as
well, the said runs are deemed successful. SR is the ratio of successfully executed
runs over the total number of runs. As seen here, the SR has a probabilistic nature;
in a way, it can be interpreted as the probability of executing a successful run.
Efficiency-​based measures tend to quantify the speed of an algorithm in identi-
fying the optimum solution. The most notable measure here for this is the average
number of evaluations of a solution (AES) (Du & Swamy, 2016). As the name
suggests, this metric measures the average number of evaluations it takes for
the algorithm to be deemed successful. If an algorithm did not have a so-​called
successful run, it is said that ASE is undefined.
Robustness-​based measures determine how persistent an algorithm is in
different runs. A so-​called robust algorithm would always return reasonably similar
solutions, while a non-​robust algorithm’s solutions vary significantly in each run.
Figure 1.6 depicts the difference between robust and non-​robust algorithms. As
can be seen here, the non-​robust algorithm final solution would rely heavily on the
initiation stage, which is naturally not a good feature to have in a meta-​heuristic
algorithm. The most notable measures for this metric are standard deviation
and the coefficient of variation of solutions in different runs (Bozorog-​Haddad
et al., 2017).
28 An Introduction to Meta-Heuristic Optimization

Figure 1.6 Convergence rate of an algorithm that is considered (a) robust and (b) non-​robust.

1.7 No-​Free-​Lunch Theorem


So, the final yet very crucial question we need to answer here is why we have so
many meta-​heuristic optimization algorithms these days, which are seemingly all
producing good results. And in fact, by the same token, do we actually need to
have multiple algorithms in our repertoire to tackle optimization problems? And
the answer to both questions is a resounding yes due to a known theory in data
science called the no-​free-​lunch theorem.
No-​free-​lunch theorem is a known impossibility theorem with fundamental
application across data-​driven models such as meta-​heuristic optimization. The gist
of this idea is that if we have no prior assumption about the problem at hand, no
data-​driven strategy, model, or method would have a pre-​advantage over the other,
given that there could never be a guarantee that one approach here could outper-
form the others (Culberson, 1998). So this theory is actually telling us that when it
comes to data-​driven models such as meta-​heuristic algorithms, a general-​purpose,
universal optimization strategy can never exist (Wolpert & Macready, 1997). So
the no-​free-​lunch theorem is the epitome of the idea “if anything is possible, then
nothing can be expected” (Ho & Pepyne, 2002).
But there is another implication that comes from this theorem. If there can be
no universally superior algorithm, if there is no prior assumption about the given
problem, there can also never be an ideal setting for a given algorithm that can
handle all the optimization problems. In other words, if we want to get the best
performance out of a meta-​heuristic optimization algorithm, we have to always
An Introduction to Meta-Heuristic Optimization 29

look for the best parameter setting for the said algorithm for that specific problem
at hand. This means that a universally best parameter setting for an algorithm could
never exist, and as such, fine-​tuning an algorithm is an inseparable part of meta-​
heuristic optimization algorithms. Of course, it is always possible to use our intu-
ition, experience, and default values suggested for an algorithm’s parameters as
a good starting point. That said, one should bear in mind that fine-​tuning these
parameters is, more than anything, a trial-​and-​error process. Thus, while it is
possible to get a good enough result by having an educated guess for setting the
parameters of these algorithms, to get the best possible performance, it is necessary
to go through this fine-​tuning process.

1.8 Concluding Remarks


In order to embark upon our journey to the fascinating realm of meta-​heuristic opti-
mization algorithms, we first had to learn about the general concepts of mathem-
atical programming or what we commonly know as optimization. We learned the
general approaches available to conduct optimization and the merits and drawbacks
of each idea. For instance, we saw that analytical methods are guided approaches
that use gradient-​based information to locate the optimum solutions. The main
problem with these methods is that they have difficulty handling real-​world opti-
mization problems. These problems are often associated with high dimensionality,
multimodality, epistasis, non-​differentiability, and discontinuous search space
imposed by constraints. Alternatively, we also have sampling-​based optimization
methods. These methods are based on the idea of searching among the possible
solutions until we come across a solution that can be passed as the optimum solu-
tion. We have two general groups of sampling-​based methods that are unguided and
guided methods. Unguided methods could not learn from their encounter with the
search space to alter their searching strategies, which is, in and of itself, the most
notable drawback of this branch of optimization. This is not the case for guided
or targeted methods. The most notable example of this is meta-​heuristic optimiza-
tion methods. These methods would search the optimization problems and are not
inherently bound by the drawbacks we commonly associate with analytical-​based
methods. However, one thing that should be noted about these methods is that there
can never be a guarantee that these methods can always locate the optimal solu-
tion, and more often than not, they return the near-​optimal solutions rather than the
absolute optimal solution.
We also reviewed the main components of optimization problems and the generic
representation of an optimization model. We have come to learn about the concepts
of objective functions, decision variables, state variables, constraints, search space,
simulator, local and global optima, and near-​optimal solutions. We briefly reviewed
the history of meta-​heuristic algorithms and different known classifications for
these algorithms. We have also learned a few tricks to handle constraints in the
context of meta-​heuristic algorithms. Then we reviewed the metrics used to analyze
these algorithms’ performance. And as a final note, we have discussed the idea of
the no-​free-​lunch theorem. In a nutshell, the two implications of this theorem in
30 An Introduction to Meta-Heuristic Optimization

the context of meta-​heuristic optimization algorithms are that if there are no prior
assumptions about the problem at hand, there can never be a universally superior
algorithm, nor can be a universally ideal parameter setting for a given algorithm.
This means we have to have multiple meta-​heuristic optimization algorithms in
our repertoire and do parameter fine-​tuning to get the best performance out of the
algorithm. That said, we can finally start learning about different algorithms in
this field.

References
Bozorg-​Haddad, O., Solgi, M., & Loáiciga, H.A. (2017). Meta-​heuristic and evolutionary
algorithms for engineering optimization. John Wiley & Sons. ISBN: 9781119386995
Bozorg-​Haddad, O., Zolghadr-​Asli, B., & Loaiciga, H.A. (2021). A handbook on multi-​
attribute decision-​making methods. John Wiley & Sons. ISBN: 9781119563495
Capo, L. & Blandino, M. (2021). Minimizing yield losses and sanitary risks through an
appropriate combination of fungicide seed and foliar treatments on wheat in different pro-
duction situations. Agronomy, 11(4), 725.
Culberson, J.C. (1998). On the futility of blind search: An algorithmic view of “no free
lunch”. Evolutionary Computation, 6(2), 109–​127.
Du, K.L. & Swamy, M.N.S. (2016). Search and optimization by metaheuristics: Techniques
and algorithms inspired by nature. Springer International Publishing Switzerland.
ISBN: 9783319411910
George, M., Kumar, V., & Grewal, D. (2013). Maximizing profits for a multi-​category
catalog retailer. Journal of Retailing, 89(4), 374–​396.
Glover, F. (1986). Future paths for integer programming and links to artificial intelligence.
Computers & Operations Research, 13(5), 533–​549.
Ho, Y.C. & Pepyne, D.L. (2002). Simple explanation of the no-​free-​lunch theorem and its
implications. Journal of Optimization Theory and Applications, 115(3), 549–​570.
Hooke, R. & Jeeves, T.A. (1961). “Direct Search” solution of numerical and statistical
problems. Journal of the ACM, 8(2), 212–​229.
Husted, B.W. & de Jesus Salazar, J. (2006). Taking Friedman seriously: Maximizing profits
and social performance. Journal of Management Studies, 43(1), 75–​91.
Issa, U.H. (2013). Implementation of lean construction techniques for minimizing the risks
effect on project construction time. Alexandria Engineering Journal, 52(4), 697–​704.
Kamrad, B., Ord, K., & Schmidt, G.M. (2021). Maximizing the probability of realizing
profit targets versus maximizing expected profits: A reconciliation to resolve an agency
problem. International Journal of Production Economics, 238, 108154.
Wolpert, D.H. & Macready, W.G. (1997). No free lunch theorems for optimization. IEEE
Transactions on Evolutionary Computation, 1(1), 67–​82.
Yaghoubzadeh-​Bavandpour, A., Bozorg-​Haddad, O., Zolghadr-​Asli, B., & Gandomi, A.H.
(2022). Improving approaches for meta-​heuristic algorithms: A brief overview. In Bozorg-​
Haddad, O., Zolghadr-​Asli, B. eds. Computational intelligence for water and environ-
mental sciences, Springer Singapore, 35–​61.
Yang, X.S. (2010). Nature-​inspired metaheuristic algorithms. Luniver Press.
ISBN: 9781905986286
Yanofsky, N.S. (2011). Towards a definition of an algorithm. Journal of Logic and
Computation, 21(2), 253–​286.
An Introduction to Meta-Heuristic Optimization 31

Zolghadr-​Asli, B., Bozorg-​Haddad, O., & Loáiciga, H.A. (2018). Stiffness and sensitivity
criteria and their application to water resources assessment. Journal of Hydro-​Environment
Research, 20, 93–​100.
Zolghadr-​Asli, B., Bozorg-​Haddad, O., & van Cauwenbergh, N. (2021). Multi-​attribute
decision-​making: A view of the world of decision-​making. In Bozorg-​Haddad,
O. ed. Essential tools for water resources analysis, planning, and management. Springer,
305–​322.
Random documents with unrelated
content Scribd suggests to you:
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.

Project Gutenberg™ eBooks are often created from several printed


editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like