0% found this document useful (0 votes)
16 views9 pages

Understanding Genetic Algorithms in AI

Genetic algorithms (GAs) are optimization techniques inspired by natural selection, involving a population of solutions that evolve through selection, crossover, and mutation. They have applications across various fields, including engineering, artificial intelligence, and finance, and are known for their ability to solve complex problems where traditional methods struggle. Despite their advantages, GAs also face limitations such as computational cost and the potential for premature convergence to suboptimal solutions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views9 pages

Understanding Genetic Algorithms in AI

Genetic algorithms (GAs) are optimization techniques inspired by natural selection, involving a population of solutions that evolve through selection, crossover, and mutation. They have applications across various fields, including engineering, artificial intelligence, and finance, and are known for their ability to solve complex problems where traditional methods struggle. Despite their advantages, GAs also face limitations such as computational cost and the potential for premature convergence to suboptimal solutions.
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

PREPUBLIQUE ALGERIENNE DEMOCRATIQUE ET POPULAIRE

Ministère de l’enseignement Supérieur et de


La Recherche Scientifique
Université Relizane
Faculté Des Sciences et technologie
Département de ELT et AUT

Module: Techniques de l’intelligence artificielle

Genetic Algorithm

Préparer par:
➢ ELMAZARI Denia
➢ BOUGUEDRA Maya
➢ DELHOUM Zin eddine

2025/2026
Introduction :

Genetic algorithms (GAs) are optimization methods inspired by the principles of


natural selection and genetics.
The principle is simple: a population of possible solutions (called chromosomes) is
created, evaluated according to a fitness function, and then transformed through
selection, crossover, and mutation operations.
This evolutionary process is repeated until a satisfactory solution is obtained.
GAs were introduced by John Holland in 1975 and popularized by David Goldberg in
1989.
Their efficiency and simplicity have led to numerous applications: function
optimization, finance, automatic control, and even game theory.

Compared to other optimization techniques, genetic algorithms differ in four key


ways:
1. They encode parameters rather than working directly on them.
2. They process a population of solutions, not a single point.
3. They use only the value of the function under study, without the need for
derivatives.
4. They are based on probabilistic, not deterministic, rules.

In this article, we will present the operating principle of genetic algorithms, their main
steps, and their areas of application.

History of Genetic Algorithms


The idea of genetic algorithms emerged in the 1960s with the work of American
researcher John Holland at the University of Michigan.
His goal was to understand and model the process of natural evolution using
computational methods.

In 1975, he published an important work entitled "Adaptation in Natural and Artificial


Systems," in which he presented the basic principles of genetic algorithms for the first
time.
This book is considered the founding reference in this field.

A few years later, several researchers continued and improved his work.
Among them, David E. Goldberg played a key role in the dissemination and
popularization of genetic algorithms through his book "Genetic Algorithms in Search,
Optimization and Machine Learning," published in 1989.

Since then, genetic algorithms have experienced rapid development. They have been
successfully applied in many fields such as engineering, robotics, finance, computer
science, and more recently, artificial intelligence.
Their popularity stems from their ability to solve complex problems where traditional
methods fail.

How Genetic Algorithms Work


Genetic algorithms (GA) are based on the principle of natural evolution described by
Charles Darwin: "survival of the fittest."
They seek to mimic this process to find the best solution to a given problem.

They work based on three main ideas:

1. Selection: choosing the best solutions based on a performance measure (called


fitness).

2. Crossover : combining two solutions to create new ones.

3. Mutation: slightly modifying a solution to introduce diversity.

The process begins with an initial population of randomly generated solutions.


Each solution is represented as a chromosome, often coded in binary (e.g., 1010101).
Then, the performance of each individual is evaluated using a fitness function.

The best individuals are selected to participate in the creation of a new generation
through crossover and mutation operations. This process is repeated for several
generations until the population converges towards an optimal or satisfactory solution.

Thus, genetic algorithms make it possible to efficiently explore a large


search space while gradually improving the quality of the solutions.

Figure1: Basic structure of a genetic algorithm

Representation and Encoding:


In genetic algorithms, each possible solution to a problem is represented as a
chromosome, which is typically encoded as a string of symbols. These symbols, often
called genes, can take different forms depending on the problem to be solved. The
most common type of representation is binary encoding, where each gene is
represented by a 0 or 1. For example, a chromosome such as “101011” can represent a
potential solution.

However, other types of encodings can also be used:


Real-valued encoding, where genes are real numbers (useful in optimization
problems).
Permutation encoding, often used in scheduling or routing problems (e.g., the
Traveling Salesman Problem).
Tree encoding, used in genetic programming, where chromosomes are represented as
hierarchical tree structures.

The choice of representation greatly affects the performance of the algorithm because
it determines how crossover and mutation operations will be applied. A good
encoding should be simple, meaningful, and make it easy to generate valid offspring
after genetic operations.

Fig2: Example of Crossover and Mutation in a Genetic Algorithme

Genetic Operators:

Genetic operators are the key mechanisms that drive the evolution process in Genetic
Algorithms. They are inspired by biological processes such as natural selection,
reproduction, and mutation. The three main genetic operators are selection, crossover,
and mutation. Each of these plays a specific role in improving the quality of the
population over successive generations.

[Link]:
The selection operator chooses the fittest individuals from the current population to
become parents for the next generation. The probability of being selected is usually
proportional to the individual’s fitness value. Common selection methods include:

Roulette Wheel Selection – individuals are chosen based on their relative fitness,
similar to spinning a weighted wheel.

Tournament Selection – a group of individuals is chosen randomly, and the best one
in the group is selected.

Rank Selection – individuals are ranked based on their fitness, and the selection
probability depends on the rank rather than the absolute fitness value.

[Link] (Recombination):

Crossover is the process of combining genetic material from two parent chromosomes
to create offspring. It allows the algorithm to explore new areas of the solution space
by exchanging useful information between individuals.
Common types of crossover include:

Single-point crossover – a random point is chosen, and the genes are swapped after
that point.

Two-point crossover – two points are chosen, and the segment between them is
exchanged.

Uniform crossover – each gene has a fixed probability of being swapped.

[Link]:

Mutation introduces random changes into chromosomes to maintain diversity in the


population and prevent premature convergence. It usually involves flipping a bit (in
binary encoding) or slightly modifying a value (in real-valued encoding). Although
mutation occurs with a small probability, it is essential for exploring new solutions
that might not be reached through crossover alone.

Steps of the Genetic Algorithm:

A Genetic Algorithm (GA) works through a sequence of evolutionary steps that


simulate natural selection. The main steps are as follows:

1. Initialization:
A population of random solutions (chromosomes) is created to start the search process.
2. Fitness Evaluation:
Each individual is evaluated using a fitness function to measure how good its solution
is.
3. Selection:
The best individuals are selected according to their fitness to serve as parents.
4. Crossover:
Pairs of parents exchange parts of their chromosomes to create new offspring.
5. Mutation:
Small random changes are introduced to maintain diversity in the population.
6. Replacement:
The new offspring replace some or all of the old population to form a new generation.
7. Termination:
The process repeats until a stopping criterion is reached, such as a maximum number
of generations or a satisfactory fitness level.
At the end, the best individual found represents the optimal or near-optimal solution
to the problem.

Advantages and Limitations of Genetic Algorithms:

[Link]:
Genetic Algorithms (GAs) offer several advantages that make them powerful tools for
solving complex optimization problems:

✓ Global Search Capability:


Unlike traditional methods that may get trapped in local optima, GAs explore a wide
search space and are more likely to find global or near-global solutions.

✓ Flexibility:
GAs can be applied to various types of problems — linear, nonlinear, continuous, or
discrete — without requiring gradient information.

✓ Adaptability:
They can adapt to dynamic environments where the problem conditions change over
time.

✓ Parallelism:
Since GAs work with a population of solutions, they can evaluate multiple candidates
simultaneously, which allows for parallel processing and faster performance.

✓ Robustness:
GAs are less sensitive to noise or changes in the problem domain compared to
deterministic algorithms.

[Link]:
Despite their strengths, Genetic Algorithms also have some drawbacks:

✓ Computational Cost:
Evaluating large populations over many generations can be time-consuming and
computationally expensive.

✓ Parameter Sensitivity:
The performance of GAs depends heavily on parameters such as population size,
crossover rate, and mutation rate, which can be difficult to tune.

✓ No Guarantee of Optimal Solution:


GAs usually find good solutions, but not always the absolute best one.

✓ Premature Convergence:
The population may converge too quickly to a suboptimal solution if diversity is lost
early.

✓ Complex Implementation:
Designing an effective fitness function and encoding scheme requires experience and
problem-specific knowledge.

Applications of Genetic Algorithms:

Genetic Algorithms (GAs) have been successfully applied in many fields due to their
flexibility and ability to find good solutions in complex search spaces. Some of the
most common applications include:

[Link] Optimization:

GAs are widely used to optimize engineering designs, such as minimizing material
cost, maximizing efficiency, or improving structural performance.
 Example: optimizing the design of an aircraft wing or an electrical circuit.

[Link] Intelligence and Machine Learning:

In AI, GAs are used to optimize neural network weights, feature selection, and
hyperparameter tuning, helping to improve model accuracy and reduce training time.

[Link]:

GAs can evolve control strategies for autonomous robots, allowing them to adapt to
changing environments and learn optimal movement or decision-making paths.

[Link] and Planning:

They are very effective in solving complex scheduling problems such as job-shop
scheduling, university timetabling, or resource allocation, where traditional
algorithms fail to handle many constraints.

[Link] Theory and Simulations:

GAs are applied in evolutionary game theory to model decision-making and


adaptation among competing agents.

[Link] and Finance:

In finance, GAs are used for portfolio optimization, forecasting, and trading strategy
development, helping investors make better decisions based on multiple objectives.
Fig3 : Neural network fig4 :Robot path planning

Case Study: Optimization of a Traveling Salesman Problem (TSP) :

To illustrate how Genetic Algorithms work in practice, let us consider the Traveling
Salesman Problem (TSP).
In this problem, a salesman must visit a set of cities exactly once and return to the
starting point, while minimizing the total travel distance.

Steps of the GA application:

1. Encoding: Each chromosome represents a possible route (an ordered list of cities).

2. Initialization: A random population of routes is generated.

3. Fitness Function: The fitness of each route is evaluated based on the total distance
traveled — shorter routes have higher fitness values.

4. Selection: The best routes are selected to create offspring.

5. Crossover: Portions of two parent routes are combined to form new routes.

6. Mutation: A small change (like swapping two cities) is introduced to maintain


diversity.

7. Termination: The algorithm stops when the shortest possible route (or a good
approximation) is found.

Results:
The GA can quickly find a near-optimal route among thousands of possible
combinations, proving its effectiveness in solving complex optimization problems
where exact methods are too slow or impossible to apply.
Fig5 :Schematic representation of the Genetic Algorithme
(selection to crossover and mutation)
Diagram explanation :

This diagram shows how a new generation of solutions is created from the current one.
➢ First, the best individuals are selected based on their fitness.
➢ Then, pairs of parents undergo crossover to produce new offspring.
➢ These new individuals form the next generation, which will be evaluated again
in the next iteration.
➢ The process continues until an optimal or satisfactory solution is found.

Conclusion:

Genetic Algorithms (GAs) are powerful and flexible optimization tools inspired by
the process of natural selection. They operate through simple yet effective
mechanisms — selection, crossover, and mutation — to evolve better solutions over
successive generations.
Their major strength lies in their ability to handle complex, non-linear, and
multidimensional problems where traditional optimization techniques fail or become
inefficient.
Although GAs do not guarantee finding the absolute global optimum, they often
produce near-optimal solutions in a reasonable amount of time, which makes them
widely used in fields such as engineering, computer science, economics, and artificial
intelligence.
In conclusion, Genetic Algorithms demonstrate how principles from biology can be
successfully applied to computational problem-solving, making them a cornerstone of
modern heuristic optimization techniques.

You might also like