0% found this document useful (0 votes)
14 views16 pages

Assignment 4

Uploaded by

Abhishek Yadav
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)
14 views16 pages

Assignment 4

Uploaded by

Abhishek Yadav
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/ 16

RAVINDRA

RAJ YADAV
KUMAR VERMA
33
31

QUES 1:- Explain basic concept of Genetic


Algorithm.
ANS 1:- The basic concept of a Genetic
Algorithm (GA) is inspired by the process of
natural selection and evolution in biology. It is
a search and optimization technique used to
solve complex problems by evolving solutions
over generations.
Key Concepts of Genetic Algorithm:
1. Population:
A set of possible solutions (called
individuals or chromosomes) to the
problem.
2. Chromosome:
A representation of a solution, often
encoded as a string (like a binary string,
list of numbers, etc.).
3. Fitness Function:
A function that evaluates how good each
solution is at solving the problem.
4. Selection:
Choosing the best-fit individuals from the
current population to create offspring for
the next generation.
5. Crossover (Recombination):
Combining parts of two parent
chromosomes to create a new child
chromosome, hoping to inherit the best
traits.
6. Mutation:
Randomly changing parts of a
chromosome to maintain diversity and
avoid local optima.
7. Termination:
The algorithm stops when a stopping
condition is met, such as a maximum
number of generations or an acceptable
fitness level.

Basic Steps of a Genetic Algorithm:


1. Initialize a random population of
individuals.
2. Evaluate the fitness of each individual.
3. Select the best individuals to
reproduce.
4. Apply crossover and mutation to
produce new individuals.
5. Replace the old population with the
new one.
6. Repeat steps 2–5 until the stopping
condition is met.
QUES 2:- What is inheritance operator and
cross over operator.
ANS 2:- Inheritance Operator:
• Definition: A general term that refers to
how genetic material (information) is
passed from parents to offspring.
• Purpose: Ensures that good traits (parts of
solutions) from parents are carried over to
the next generation.
• Includes: Both crossover and mutation
can be considered forms of inheritance.
• Example: If a parent has a high-
performing gene (like "1101" in a binary
chromosome), inheritance makes sure
some or all of it is retained in the
offspring.

Crossover Operator:
• Definition: A specific type of inheritance
operator where two parents exchange
parts of their chromosomes to produce
offspring.
• Purpose: To combine the features of two
parents hoping the child will have even
better traits.
• Types:
1. Single-point crossover: Swap
genes after a single random point.
2. Two-point crossover: Swap genes
between two points.
3. Uniform crossover: Each gene is
chosen randomly from one of the
parents.
Example – Single-point crossover:
Parent 1: 110|010
Parent 2: 101|111
Offspring: 110111 (left part from Parent 1,
right part from Parent 2)

In short:
• Inheritance is the broader concept of
passing genetic traits.
• Crossover is a specific method of
inheritance involving recombination of
parent chromosomes.
QUES 3:- Discuss generalization Cycle of
GA.
ANS 3:- Generalization Cycle of GA –
Step-by-Step:
1. Initialization:
o Randomly generate an initial
population of individuals (candidate
solutions).
o Each individual is typically encoded as
a chromosome (e.g., binary string,
array).
2. Evaluation (Fitness Calculation):
o Evaluate each individual using a fitness
function that measures how good the
solution is at solving the problem.
3. Selection:
o Select individuals for reproduction
based on their fitness.
o Methods include: Roulette Wheel,
Tournament Selection, Rank Selection,
etc.
o The goal is to prefer fitter individuals
for reproduction.
4. Crossover (Recombination):
o Pair selected individuals and exchange
parts of their chromosomes to create
offspring.
o This introduces new combinations of
genes from the parents.
5. Mutation:
o Randomly alter some parts (genes) of
the offspring to introduce genetic
diversity.
o Helps prevent premature convergence
(getting stuck in local optima).
6. Replacement:
o Replace some or all of the current
population with the new offspring.
o Strategies include generational
replacement, elitism, or steady-state
replacement.
7. Termination Check:
o Check if a termination condition is
met, such as:
▪ A solution with acceptable fitness
is found.
▪ Maximum number of generations
reached.
▪ No significant improvement over
several generations.
8. Generalization (Learning):
o The best solution found so far is
treated as the generalized or
optimized solution for the problem.
o The GA can be repeated or reused
with this learned knowledge for
similar problems.
This entire process repeats generation
after generation until the algorithm
converges or stops.

Summary Table:
Step Description
Create random
Initialization
population
Assess fitness of each
Evaluation
individual
Pick best candidates for
Selection
reproduction
Combine genes to form
Crossover
offspring
Introduce random
Mutation
variation
Step Description
Form the new
Replacement
generation
Termination Stop if criteria met
Best solution
Generalization represents learned
model
QUES 4:- Difference between GA and
other traditional method.
ANS 4:- comparison between Genetic
Algorithms (GA) and Traditional Methods:
Genetic
Traditional
Aspect Algorithm
Methods
(GA)
Based on
Based on
natural
Approach direct
selection
computatio
and
Genetic
Traditional
Aspect Algorithm
Methods
(GA)
evolution n and logic
Works well Often
in large, struggles in
Search complex, very large
Space and or non-
unknown linear
spaces spaces
Determinist
Stochastic
Optimizati ic (fixed
(randomize
on rules, step-
d search)
by-step)
Often starts
Starts with
Initializati from a
a random
on fixed initial
population
guess
Genetic
Traditional
Aspect Algorithm
Methods
(GA)
Follows a
Evolves
Progressio set
through
n sequence
generations
of steps
Good at
escaping
local Often gets
Handling
optima stuck in
Local
(due to local
Optima
mutation optima
and
crossover)
Can work Usually
with problem-
Flexibility
different specific
types of algorithms
Genetic
Traditional
Aspect Algorithm
Methods
(GA)
problems needed
(discrete,
continuous,
combinator
ial)
Naturally
parallel
Mostly
Parallelis (evaluates
sequential
m many
processing
solutions at
once)
Little Often
Knowledg problem- requires
e specific deep
Required knowledge mathemati
needed cal
Genetic
Traditional
Aspect Algorithm
Methods
(GA)
understand
ing
Traveling
Salesman
Linear
Problem,
programmi
Neural
ng,
Network
Examples Gradient
training,
Descent,
Game
Newton's
strategy
method
optimizatio
n

In short:
• GA is more flexible and robust, especially
for complex or poorly understood
problems.
• Traditional methods are faster and more
efficient when the problem is simple,
smooth, and well-defined.

You might also like