Four Cases Outputs
unzipped matlab coding folder: m files includes as follows:
open myMainFunctionOptimization.m file and runs two main tasks one by one separetely.
The following m file : myMainFunctionOptimization.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% The main program is to perform two separated tasks %%%%%%%%%%%%%%%%%%
%%%%% Author: DKWC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task one : to run the Unit Test of GA Alogrithm to minimize g(x1,x2)%%
%%% for a single case of mutationProb = 0.02 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all;
variableNumbers = 2;
genesPerVariable = 25;
populationN = 100;
generationNumbers = 100;
variableRange = 10.0;
tournamentSelectionParameter = 0.75;
crossoverProb = 0.8;
tournamentSize = 2;
elitismStep = 1;
mutationProbVector = [0.00, 0.02, 0.05, 0.10];
mutationProb = mutationProbVector(2); % set mutationProb = 0.02
myUnitTest(variableNumbers,genesPerVariable, populationN,generationNumbers, variableRange,
...tournamentSelectionParameter,crossoverProb, mutationProb,tournamentSize, elitismStep);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task two: to compute the median fitness values, run by 100 random %%%%%
%%% simulation for 4 cases of mutation Probability %%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all;
variableNumbers = 2;
genesPerVariable = 25;
genesTotalNumbers = genesPerVariable*variableNumbers;
populationN = 100;
generationNumbers = 100;
variableRange = 10.0;
tournamentSelectionParameter = 0.75;
crossoverProb = 0.8;
tournamentSize = 2;
elitismStep = 1;
trialRuns = 100 ;
mutationProbVector = [0.00, 0.02, 0.05, 0.10];
myMedianFitnessValueFunction(trialRuns, mutationProbVector,variableNumbers,genesPerVariable,
... populationN,generationNumbers,variableRange,tournamentSelectionParameter,crossoverProb,
... tournamentSize,elitismStep );The median fitness value run by my GA Program for the fours case of