Challenge

Week 5 - Genetic Algorithm

Genetic Algorithm

By Aby Abraham Chandy

Aim: -

Find the Global Maxima of the Stalagmite Function and plot 3 studies for Fmax vs No. of iteration

Explain GA function

GA Function: -

GA function uses the Genetic Algorithm to optimize the minimum value to identify the most stable state, or the most likely outcome.

To identify the max value of the Stalagmite Function we use the negative plots of the Stalagmite function as the GA function optimizes to the minimum Values.

x = ga(fun,nvars,A,b,Aeq,beq,lb,ub,nonlcon,intcon,options) –

GA function to optimize the function ‘fun’,

‘fun’ – function to find local minima

‘nvar’ - number of variables in the function.

‘lb’ – Lower bound

‘ub’ – upper bound

‘options’ - provide various solver options – ‘Population size’

Code Studies :-

3 Studies were conducted .

  1. general GA function without the options
  2. GA function with upper and Lower bounds
  3. GA function with bounds and defined Population size.

Each run of the program took different time.

More the parameter added to the GA command the more time it took, and the solution was more accurate.

Runs

1

2

3

4

5

6

7

S1_Timer =

7.0242

7.02

7.5778

6.6393

7.3621

6.9105

7.0888

max_val1 =

0.7611

0.7125

0.7722

0.7933

0.7322

0.7218

0.7012

S2_Timer =

8.7122

8.1778

9.0387

7.7139

7.6861

7.995

7.839

max_val2 =

0.9831

0.9607

0.9775

0.946

0.9607

0.9663

0.9663

S3_Timer =

19.1971

18.3926

19.4116

18.6825

18.1238

18.0342

18.2976

max_val3 =

1

1

1

0.9944

0.9944

0.9944

1

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.