Case Study 2022 Topics
Case Study 2022 Topics
Case Study 2022 Topics
GENETIC ALGORITHMS
COMPUTER SCIENCE
PAPER 3 HL
CASE STUDY 2022
https://arxiv.org/pdf/1909.06447.pdf
Time complexity
In computer science, the time complexity is the computational complexity that describes the amount of computer
time it takes to run an algorithm.
https://www.mygreatlearning.com/blog/why-is-time-complexity-essential/
Polynomial-Time Algorithms
A polynomial-time algorithm is an algorithm whose execution time is either given by a polynomial on the size of the input, or
can be bounded by such a polynomial. Problems that can be solved by a polynomial-time algorithm are
called tractable problems.
For example, most algorithms on arrays can use the array size, n, as the input size. To find the largest element in an array
requires a single pass through the array, so the algorithm for doing this is O(n), or linear time.
Sorting algorithms usually require either O(n log n) or O(n2) time. Bubble sort takes linear time in the best case, but O(n 2) time
in the average and worst cases. Heapsort takes O(n log n) time in all cases. Quicksort takes O(n log n) time on average, but
O(n2) time in the worst case.
• https://youtu.be/1i8muvzZkPw
• https://youtu.be/3GAfjE_ChRI
• https://www.tutorialspoint.com/genetic_algorithms/genetic_algorithms_fundamentals.htm
GENETIC ALGORITHM
• this means that we cannot normally expect efficient algorithms for these problems, they must
nevertheless be solved. Scheduling problems, for example, must routinely be solved by transportation
companies, sports schedulers, computer hardware, etc. Approaches to solving intractable problems
often involve approximation, heuristics, and/or the use of exponential algorithms such as integer
programming
• Reference : https://www.cpp.edu/~ftang/courses/CS331/notes/P%20and%20NP.pdf
CONVERGENCE IN ALGORITHM
• Genetic algorithms (GA) are search algorithms based on the principles of natural selection and
genetics
• GA tries to explore the fittest individual by producing generations iteratively
• GA evolves a population of initial individuals to a population of high quality individuals, where
each individual represents a solution of the problem to be solved
• During each generation, three basic genetic operators are sequentially applied to each individual
with certain probabilities, i.e. selection, crossover and mutation
• [Selection operator ] Selection operation is to select elitist individuals as parents in current
population, which can generate offspring. Fitness values are used as criteria to judge whether
individuals are elitist.
• [Crossover operator] With a crossover probability cross over the parents to form a new offspring
(children). If no crossover was performed, offspring is an exact copy of parents.
• [Mutation operator] With a mutation probability mutate new offspring at each locus (position in
chromosome).
• Implementation details vary considerably, but a standard genetic algorithm includes
the following steps:
• Page 4 and 5 from case study
GENETIC ALGORITHM GENERAL STEPS
• In GA, the search space(Search space is space of all feasible solutions (the set of solutions among
which the desired solution resides)
consists of strings, each of which representing a candidate solution to the problem and are termed as
chromosomes.
• The objective function value of each chromosome is called its fitness value.
• Population is a set of chromosomes along with their associated fitness.
• Generations are populations generated in an iteration of the GA
FITNESS FUNCTION
• A fitness function is used to assign a fitness value to each tour. Individual tours are sorted according
to their fitness.
• The highest fitness value is assigned to the shortest tour.
• Fitness function is the important parameter of a genetic algorithm that defines the fitness of each chromosome
where the values of genetic parameters are adapted as the genetic evolution progresses.
• At every generation, fitness value of each chromosome is calculated using fitness function. If fitness of two
chromosomes is equal, then the mutation rate is increased, in order to help the genetic evolution get out of issues
like local maxima or local minima whichever is applicable.
• TSP is a minimization problem; we consider fitness function calculates cost (or value) of the tour
represented by a chromosome.
As you probably know, we should always accomplish a proper balance between exploration and exploitation ability of
the searching/optimiser algorithm.
In GA, mutation operators are mostly used to provide exploration and cross-over operators are widely used to lead
population to converge on one the good solutions find so far (exploitation).
Consequently, while cross-over tries to converge to a specific point in landscape, mutation does its best to avoid
convergence and explore more areas.
Obviously, we prefer to explore much more in the beginning of the search process (to ensure the population coverage
and diversity).
On the other hand, we prefer more exploitations at the end of search process to ensure the convergence of the
population to the global optimum.
There is just an exception; when population converges to a local optimum, we should (if we can) increase the
population diversity to explore other areas.
According to the above facts, too high mutation rate increases the probability of searching more areas in search
space, however, prevents population to converge to any optimum solution.
On the other hand, too small mutation rate may result to premature convergence (falling to local optima instead of
global optimum).In other words, too high mutation rate reduces the search ability of GA to a simple random walk
while a too small GA (without any other facilities such as niching or crowd-avoiding to preserve diversity) almost
always fails to a local optimum.
As Larry Raisanen mentioned, the best value of mutation rate is very problem specific. You can try several values
in linear or bidirectional manner. Remember, as Colin Reeves wrote, this value also depends on the nature and
implementation of the algorithm.In my opinion,
however, there is no constant best mutation rate for most of the real world problems. As I mentioned before,
searching algorithm demands different exploration-exploitation ability in different stage of the search process.
Hence, a more dynamic mutation rate, as Paulo Gaspar proposed, is more preferred. I believe you can find more
complex methods which adaptively tune the mutation rate according to the problem and the state of the current
population comparing with the previous ones.
Local maxima are a major problem not just for genetic algorithms, but any optimization technique that sets out to find
the global optimum.
A genetic algorithm works nicely in the exploration stage, with each of the individuals discovering pieces of the solution
and combining them together.
However when a locally optimal point is achieved by a particular individual, it manages to hold the lead for a number of
iterations and all individuals start looking alike.
The leader survives through generations, and contributes in many crossovers, distributing its genes to every other
candidate. The distant explorers are outperformed and gradually eliminated.
Finally, progress comes to a halt when diversity ceases to exist.
optimization algorithms sometimes return a local minimum—a point where the function value is
smaller than at nearby points, but possibly greater than at a distant point in the search
space. The genetic algorithm can sometimes overcome this deficiency with the right settings.
THE TRAVELING SALESMAN PROBLEM (TSP)
• The traveling salesman problem (TSP) is perhaps the most well known combinatorial optimization
problem(is a topic that consists of finding an optimal object from a finite set of
objects.).
• TSP is to find a routing of a salesman who starts from a home location, visits a prescribed set of
cities and returns to the original location in such a way that the total distance travelled is minimum
and each city is visited exactly once.
Tournament Selection
In tournament selection, every individual in the population is paired at random with another.
This continues until there are a number of winners equal to the desired number of parents. Then this last group
of winners is paired as the parents for new individuals.
Elitism
It is a method where each individual is assigned a fitness value via the fitness function.
Using these scores, a percentage of the best, most fit individuals are used as parents.
To start, select individuals from the population as the parents.
Then, each member of the population after that is compared one by one to each of the parents.