%BBBCF iterates one iteration a population according to the rules of
%Big-Bang Big Crunch method. It overwrites new population over the previous
%one. As the number of iterations grow, it searches new candidates in a
%limited search space.
%
%Usage: [population]=bbbcf(population,costs,maxval,minval,iteration)
%Here
% population: is a "Number of individuals X number of parameters" matrice,
% costs: is a vector of size "Number of individuals" holding the cost
% function values, iteration is the iteration counter. It is provided to the subroutine by
% the main program. It is used in order to restrict the search space as
% time goes by.
% maxval and minval: vector of length "number of parameters" holding the corresponding
% upper and lower limits of parameters
% All the components are real valued numbers.
%REV 1.6 Osman Kaan EROL - Hakki Murat GENC 28.04.2008
%WHAT IS NEW?
%i. maxval and minval parameters are vectorized to allow different bounds for
%parameters
%ii.Two centerpoint selection methods are implemented for the big crunch
%phase
function pop = bbbcf(pop,costs,maxval,minval,itx)
%every variable is allowed to have different bounds
%initial values
smoothf = 10; % Denotes after how many iterations, search space will be restricted to half.
if nargin == 0
error('No parameter or missing parameter!')
end
%m = Size of population
%n = Number of parameters
[m, n] = size(pop);
% The individual having minimum cost value is chosen. Big-Crunh phase.
[mincost, minpop] = min(costs);
% %centerpoint decision, method 1:
% num = [0.0 0.0];
% denom = [0.0 0.0];
% for i = 1 : m
% num = num + (1 / costs(i)) * pop(i, :);
% denom = denom + (1 / costs(i));
% end
% centerpoint = num ./ denom;
%%centerpoint decision, method 2:
centerpoint = pop(minpop,:);
pop = zeros(m, n);
% New population is generated by using normal distrubution principle.
for pop_no=1:m-1,
for parametre_no=1:n,
pop(pop_no,parametre_no)=centerpoint(parametre_no)+(maxval(parametre_no)-minval(parametre_no))*0.5*randn(1)/(1+itx/smoothf); % Big Bang phase
if pop(pop_no,parametre_no)<minval(parametre_no)
pop(pop_no,parametre_no)=minval(parametre_no);
end
if pop(pop_no,parametre_no)>maxval(parametre_no)
pop(pop_no,parametre_no)=maxval(parametre_no);
end
end
end
% Last population member is forced to be always the best (elitism)
pop(m,:)= centerpoint;