Week 4.1 - Genetic Algorithm
GENTIC ALGORITHM
AIM
To optimise the stalagamite function and find the global maxima of the function
OBJECTIVES OF THE PROGRAM
Explaining the concept of the genitic algorithm and also explain the syntax for ga in matlab plot graphs for all 3studies and F maximum vs. no. of itreations.
Genitic algorithm(ga)
- A gentic algorithm is a search experiential that is stimulated by charles darwin's theory of natural evolution.
- the gentic algorithm is a technique for solving both contrained and uncontrained optimization problems that are based on natural selection,the process that drives biologigal evolution.
- the genitic algorithm constantly modifies the population size of individual solutions.
- initialization of population
- fitness function
- selection
reproduction
syntax for GA:
[x,fval,exitflag,output,population,scores]=ga(func,nvars,A,b,Aeq,Beq,ib,ub,nonlcon,lntcon,options)
x = optimum solution
exitflag =reason ga stopped
output = information about optimization process
population = final population
scores = final scores
fun = fitness function
nvars = number of variables
A,b = linear inequality constraints
Aeq,Beq =linear equality constraints
lb =lower bound
up = upper bound
nonlcon=use for nonlinear constraints
lntcon = to get solution in integer
options = to set population size minimum with non-defalt options
BODY OF THE CONTENT:
below the stalagmite function to plot the graph in the main functions.
- Firstly, creating the mesh from the two vectors which will be acting as a seach space to find the maxima of the function
- creating the mesh of these two vectors using the 'mesh' command and defining the no. of iterations as num_cases to iterate the values of the optimum values of the function.
- now calculating the values of fitness function at each point of the mesh grid formed.
- now creating its surface through 'surfc' command which will also provide the contour of the generated surface.
while using surfc applying the -ve sing to the function will generate the surface upside down which will be quite good to get the maxima of the function, as it will provide positive value for the maxima using the -ve sing
code explanation:
num_cases (no.of iteration for which the funtion will evaluate the fitness)

RESULTS:



