Int254 Unit 5
Int254 Unit 5
Presented By:
Dr. Premananda Sahu
1
Department of Machine Learning
Topics to be covered…
• Genetic algorithms: Introduction to Genetic
Algorithms
• Biological Inspiration
• Genetic Operators
• Fitness Function
• family of evolutionary algorithms and are used to find optimal solutions for complex problems.
• Concepts-:
• Fitness Function: A function that evaluates how good an individual is in solving the problem.
• The better the fitness score, the higher the chance of survival.
3
Genetic Algorithms
• Selection: The process of choosing individuals from the population for reproduction based
on their fitness.
• New solutions (offspring) are created by combining the genetic material (genes) of the
parent solutions.
5
Genetic Operators
• Selection Operator
• Crossover Operator
• represents mating between individuals.
• Two individuals are selected using selection operator and crossover sites are chosen
randomly.
• the genes at these crossover sites are exchanged thus creating a completely new individual
(offspring).
• Ex-:
6
Genetic Operators
• Single-Point Crossover-: chosen on both parent chromosomes.
• The genetic material before the point is taken from one parent, and after the
point, it's taken from the other parent.
Example:
• Parent 1: 101|0101
• Parent 2: 011|1100
8
Genetic Operators
• Uniform Crossover-:
9
Fitness Function
• Evaluates how well a candidate solution or offspring solves
the problem.
10
Working of Genetic Algorithm
11
Working of Genetic Algorithm
1. Start: The algorithm begins its execution.
2. Create Random Initial Population:
• A group of potential solutions (population) is randomly generated. Each solution in this
population is typically represented as a chromosome.
3. Calculate the Fitness Value for the Population Members:
• Each solution in the population is evaluated to determine how well it solves the given
problem. This is done by calculating its fitness value using a predefined fitness function.
4. Compute the Expectation Values for the Members:
• Based on their fitness values, expectation values are calculated for each member. These
expectation values represent the likelihood of each solution being selected for reproduction
in the next generation.
12
Working of Genetic Algorithm
5. Select Low Fitness Value Members for the Next Population:
• Members with lower fitness values are selected to contribute to the next generation. This is
part of the selection process, which is critical for evolution.
6. Produce Children from Parents:
• New solutions (children or offspring) are created by combining and modifying the genetic
material of selected parent solutions. This is achieved using two techniques:
• Mutation: Random changes are introduced into a single parent's genetic material to
create diversity.
• Crossover: Genetic material from two parents is combined to produce new solutions
with traits from both.
13
Working of Genetic Algorithm
7. Prepare Next Generation of Members:
• The newly created children, along with the parents that were selected, form the
next generation of solutions.
8. Calculate the Optimum Function Value:
• The best solution in the current generation is evaluated, and its fitness is
checked to determine if it meets the optimization criteria.
9. Check if the Number of Iterations is Satisfied:
• This is a termination condition:
• If the desired number of iterations or the optimal solution is achieved, the algorithm
stops.
• Otherwise, it loops back to Step 3, repeating the process with the new generation. 14
Applications of Genetic Algorithm
15