Challenge

Week 5 - Genetic Algorithm

Report on Genetic Algorithm

Aim:

  • To optimise the stalagmite function and find the global maxima of the function.

Software Used: MATLAB.

Code:

Stalagmite Code:

Explanation:

  • Defines x and y values ranging from 0 to 0.6 with 150 points each.
  • Uses meshgrid(x, y) to create a 2D coordinate matrix for function evaluation.
  • Iterates through each (x, y) pair, evaluating the stalagmite function at those points.
  • Uses surfc(xx, yy, -f) to visualize the stalagmite function in 3D.
  • Runs ga() 50 times without constraints to find a global maximum.
  • Genetic Algorithm (GA) is an optimization technique inspired by natural selection and evolution. It is used to find the best solution to a problem by mimicking the process of survival of the fittest.
  • Marks optimized values on the function’s surface plot using red markers.
  • GA Adds search constraints (0 ≤ x, y ≤ 0.6) for a more realistic search space.
  • Plots optimized points from the constrained GA search.
  • Executes GA 50 times with modified population size and bounded constraints.
  • Plots function maximum values vs. iterations to observe GA performance.
  • Uses tic and toc to measure the computation time for each optimization case.

Result:

Conclusion:

  • The stalagmite function and the global maxima of the function is optimised .

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.