Genetic Algorithm Optimization of
Benchmark Functions
Course Assignment Report
Topic: Genetic Algorithms in Optimization and Electromagnetics
1. Introduction
Genetic Algorithms (GAs) are stochastic optimization techniques inspired by the process of
natural selection and genetics. They are widely used for solving complex optimization
problems where traditional methods struggle due to nonlinearity, high dimensionality, or
multiple local minima. Genetic Algorithms simulate the process of evolution by generating a
population of candidate solutions and iteratively improving them using selection, crossover,
and mutation operations.
In engineering and electromagnetics, optimization plays a critical role in designing efficient
systems. Examples include antenna array synthesis, signal processing, machine learning,
and control systems. In this assignment, Genetic Algorithms are used to minimize two
well-known benchmark functions: the Sphere function and the Rastrigin function. These
functions are commonly used to evaluate optimization algorithms because they represent
both simple and highly multimodal search landscapes.
The assignment also introduces an antenna array factor cost function whose objective is to
minimize the maximum sidelobe level by optimizing amplitude weights. Two GA
approaches are implemented and compared: a Binary Genetic Algorithm and a Continuous
Genetic Algorithm.
2. Cost Functions
2.1 Sphere Function
The Sphere function is one of the simplest benchmark functions used in optimization. It is
defined as:
f1(x) = sum(x_i^2) for i = 1 ... nvar
The global minimum value of this function is 0, which occurs when all decision variables are
equal to zero. Because of its smooth and convex shape, the Sphere function is often used to
test the convergence ability of optimization algorithms.
2.2 Rastrigin Function
The Rastrigin function is a highly multimodal function containing many local minima. It is
commonly used to test the exploration ability of optimization algorithms.
f2(x) = 60 + sum(x_i^2 − 10 cos(2πx_i)) for i = 1 ... nvar
The global minimum value of the Rastrigin function is also 0 at x_i = 0. However, the
presence of numerous local minima makes it significantly more difficult for optimization
algorithms to locate the global optimum.
2.3 Antenna Array Factor
In electromagnetics, antenna arrays are used to control radiation patterns. The array factor
of an antenna array can be written as:
af(u) = sum(a_n * exp(j*k*d_n*u)) for n = 1 ... N
Where a_n represents amplitude weights, k is the wave number, d_n represents the element
spacing, and u is a directional variable. The objective of the optimization is to minimize the
maximum sidelobe level while maintaining a strong main lobe. For symmetric arrays, the
number of variables is reduced to nvar = N/2.
3. Methodology
3.1 Binary Genetic Algorithm
In the Binary Genetic Algorithm, candidate solutions are represented as binary strings. Each
binary chromosome encodes the value of a decision variable within a specified range.
The main steps of the Binary GA are:
1. Generate an initial population of binary chromosomes.
2. Decode binary strings into real-valued variables.
3. Evaluate the cost function for each individual.
4. Apply tournament selection to choose parents.
5. Perform uniform crossover to generate offspring.
6. Apply bit-flip mutation to introduce randomness.
7. Repeat the process until stopping criteria are met.
3.2 Continuous Genetic Algorithm
In the Continuous Genetic Algorithm, chromosomes are represented directly as real
numbers. This approach eliminates the need for binary encoding and decoding.
The main steps of the Continuous GA are:
1. Generate an initial population of real-valued vectors.
2. Evaluate the cost function for each individual.
3. Apply roulette wheel selection to choose parents.
4. Perform single-point crossover to create offspring.
5. Apply Gaussian mutation to introduce variation.
6. Replace the old population with the new generation.
7. Continue iterations until the stopping condition is satisfied.
4. Experiments
Several experiments were conducted to analyze the performance of the genetic algorithms.
The main parameters varied during the experiments include population size, mutation rate,
and stopping criteria.
4.1 Population Size
Different population sizes were tested including 20, 50, and 100 individuals. A larger
population typically provides better exploration of the search space but requires more
computational time.
4.2 Mutation Rate
Mutation rates of 0.01, 0.05, and 0.1 were tested. Mutation helps maintain diversity in the
population and prevents premature convergence.
4.3 Stopping Criteria
The algorithm was terminated based on the following conditions:
- Maximum number of generations
- Maximum number of function evaluations
- Achieving a minimum cost threshold
5. Results
The experimental results show that both Genetic Algorithm implementations are capable of
optimizing the benchmark functions. However, the Continuous Genetic Algorithm
demonstrated faster convergence and better final results in most cases.
Example Results Table:
Method Population Mutation Rate Best Cost
Binary GA 50 0.01 0.12
Binary GA 100 0.05 0.03
Continuous GA 50 0.05 0.0008
Continuous GA 100 0.05 0.00001
6. Conclusion
This assignment demonstrated the application of Genetic Algorithms for optimization of
benchmark functions and antenna array parameters. The results indicate that Genetic
Algorithms are powerful tools for solving nonlinear optimization problems.
The Binary Genetic Algorithm successfully optimized the functions but required additional
decoding steps and showed slower convergence. In contrast, the Continuous Genetic
Algorithm achieved faster convergence and better performance due to direct representation
of variables.
Future work could explore advanced evolutionary techniques such as Differential Evolution,
Particle Swarm Optimization, and hybrid optimization methods for improved performance.
References
Haupt, R. L., & Werner, D. H. (2007). Genetic Algorithms in Electromagnetics. John Wiley &
Sons.