clear all; close all; clc; format long; % sample programe for genitic algorithm for constraint optimization for % cantilever bending nvars=5; % Number of variables % the following are the variables in order [b d E P L] % above variables are breadth,depth, young's modulus, force and length respectively LB = [0.1 0.1 1E10 1e4 0.2]; % Lower bound UB = [0.5 0.8 2E11 10E4 3] ; % Upper bound ObjectiveFunction = @cantlever_fitness1; options=gaoptimset('Vectorized','on','MutationFcn',@mutationgaussian,.... 'PopulationSize',100,'Generations',100); [x,fval]= ga(ObjectiveFunction,nvars,[],[],[],[],LB,UB,[],options);