1 Penalty method

Four Cases Outputs

Four Cases Outputs

2 Constrained optimization Method

  • The inequality constraints in in Figure 1 are as follows:

3 Genetic Alogrithm (GA) Method

  • unzipped matlab coding folder: m files includes as follows:

      1. myMainFunctionOptimization.m
      1. myUnitTest.m
      1. myMedianFitnessValueFunction.m
      1. InitializePopulation.m
      1. GFunction.m
      1. EvaluateIndividual.m
      1. DecodeChromosome.m
      1. TournamentSelect.m
      1. Cross.m
      1. Mutate.m
      1. InsertBestIndividual.m
  • 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

    • mutation Probability = {0.00, 0.02, 0.05, 0.10}
    • no of run = 100 for each generation = 100 , the resuslts of median fittness values is tabluated as follows: