Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement the Genetic Algorithm in a MatLab function named GAfun that find the m

ID: 1831863 • Letter: I

Question

Implement the Genetic Algorithm in a MatLab function named GAfun that find the minimum distance path via Genetic Algorithm. These functions are already given,
BallMapGen function to calculate a user-specified number of random ball locations
BallMapPlot function to plot the Ball Map for specified ball locations
PathTracePause function to plot a path through a specified sequence of points (with pauses)
PathTrace function to plot a path through a specified sequence of points (without pauses)
PathDistance function to calculate the total distance of a path connecting a sequence of points
dist function to calculate the right-angle distance between two points

For function GAfun:
fitness function to calculate the fitness values of a given population
select function to select a parent chromosome from a given population based on fitness
fitscale function to scale the fitness values of a given population for use by select
crossover function to perform the crossover operation on two parent chromosome

Need the code for these functions:
randompop function to generate a random population
sytax: pop = randompop(num, len)
elite function to extract elite members from a given population based on fitness
sytax: e_pop = elite(pop, fit, num)
mutate function to perform the mutation operation on a parent chromosome
sytax: child = mutate(parent)

So, I need function GAfun(get minimum distance path use Genetic Algorithm), randompop, elite and mutate.

Please help!!!.....

Explanation / Answer

function df=gfun(fun,x) % central difference for i=1:length(x) h=max(0.001,0.01*x(i)); xp=x; xp(i)=xp(i)+h/2; xn=x; xn(i)=xn(i)-h/2; df(i)=(feval(fun,xp)-feval(fun,xn))/h; end end