## Optimization with Genetic Algorithm – A MATLAB Tutorial for beginners

In this tutorial, I will show you how to optimize a single objective function using Genetic Algorithm. We use MATLAB and show the whole process in a very easy and understandable step-by-step process.

For a tutorial on Constrained Optimization with Genetic Algorithm see this video: https://www.youtube.com/watch?v=esGZtl3gIlY&feature=youtu.be

Bita Hallajian says:

I want to write a Genetic Algorithm in Matlab to find the maximum value of f(x)=15x-x^2 where parameter x varies between 0 and 15. and x takes only integer values. and besides, i want to find that x which f(x) has the maximum value.
set up problem variables are:
search space=2^4=16
initial population: N=6
pc=0.7
pm=0.01
number of generation=20
The number of generation is the termination criterion for GA.
I use one gene for crossover and mutation.
i wrote these lines now :
fitnessfunc=15*x-x^2;
initialpop=6;
pc=0.7;
pm=0.01;
generation=20;
x=[];
y=repmat(x,1,4);
for i=1:6

I will be very grateful for your helpful suggestions and advice.
thanks

omnia soliman says:

Thank you very much

clash titan says:

i want to use genetic algorithm to do character recognition .can you tell me how to do that

Vignesh Srinivasan says:

hi sir I want to implement genetic algorithm for cloud resource optimization. Can you help me!
I want to optimize the CPU make span…

Satish Natarajan says:

Every time I run this code, I get different values of x(1) and x(2).

L L4st says:

Hi, is there any on swarm algorithm or is this the same? Ps, not very familiar with this but needed for assignment

Yeoh Shen Horng says:

hi, is there a way to put make sure all the components in independent variables vector are integer?

Amit Shiuly says:

Can I get optimised equations from several equations
?

alaoui nail says:

i want to code matlab for genetic algoritme for image denoising email alaouinail@gmail.com

Farzaneh Bagheri says:

Nice explanation, But the fval should be around 0.04 not 2.43. Do you know why?

Alvin Palanca says:

can this equation be optimized in Genetic algorithm in mathlab — 1.39-0.003056a-0.0064b+0.1061c

Sai Krishnakanth says:

does the same code works in 2011

AHMED ABDELFATAH Mostafa says:

Thank you for this effort. Simple and great.
If you don’t mind I need to ask you some questions, would you please send me your email.

David Alagoa says:

Hi I’m currently struggling with an optimization problem in matlab. I am trying to optimize photovoltaic parameters using genetic algorithms but I keep getting errors or crazy outputs. HELP!

Abdul Conteh says:

can you demonstrate example on thermal unit commitment

maha aliha says:

Dear ,
your video is informative thanks for us you are giving your precise time. i have a question could you guide me how to use GA code in matlab simulink PI based three phase VSI ?