[NewPop,NewFunVal] = RT_replacement(Pop,SelPop,SampledPop,FunVal,SelFunVal,SampledFunVal,replacement_params) RT_replacement Creates a new population (NewPop) applying restricted tournament replacement. For each newly generated individual, first a subset of (window) individuals from the current population is selected. The individual genotypically closest (square difference) to the candidate individual is found. The individual with highest evaluation remains in the population. This method is appropriate for single objective optimization. INPUTS Pop: Current population SelPop: Current selected population SampledPop: Population sampled from the probabilistic model CurrentFunVal: A matrix of function evaluations, one vector of m objectives for each individual OUTPUTS NewPop : New Population NewFunVal : Evaluations of the new population window = replacement_params{1}(1): Subset of solutions considered in the comparison. Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
0001 function [NewPop,NewFunVal] = RT_replacement(Pop,SelPop,SampledPop,FunVal,SelFunVal,SampledFunVal,replacement_params) 0002 % [NewPop,NewFunVal] = RT_replacement(Pop,SelPop,SampledPop,FunVal,SelFunVal,SampledFunVal,replacement_params) 0003 % RT_replacement Creates a new population (NewPop) applying restricted tournament replacement. For each 0004 % newly generated individual, first a subset of (window) individuals from 0005 % the current population is selected. The individual genotypically closest (square 0006 % difference) to the candidate individual is found. The individual with highest evaluation 0007 % remains in the population. 0008 % This method is appropriate for single objective optimization. 0009 % INPUTS 0010 % Pop: Current population 0011 % SelPop: Current selected population 0012 % SampledPop: Population sampled from the probabilistic model 0013 % CurrentFunVal: A matrix of function evaluations, one vector of m objectives for each individual 0014 % OUTPUTS 0015 % NewPop : New Population 0016 % NewFunVal : Evaluations of the new population 0017 % window = replacement_params{1}(1): Subset of solutions considered in the comparison. 0018 % 0019 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es) 0020 0021 0022 window = cell2num(replacement_params{1}(1)); 0023 PopSize = size(Pop,1); 0024 SelPopSize = size(SelPop,1); 0025 SampledPopSize = size(SampledPop,1); 0026 0027 NewPop = Pop; 0028 NewFunVal = FunVal; 0029 0030 tonorm = repmat((max(Pop) - min(Pop)),window,1); 0031 for i=1:PopSize, 0032 auxperm = randperm(PopSize); 0033 candidates = auxperm(1:window); 0034 auxsubpop = repmat(SampledPop(i,:),window,1); 0035 0036 0037 aux = ((auxsubpop - NewPop(candidates,:))./ tonorm); 0038 0039 [minval,minpos] = min(sum(aux'.^2)); 0040 closest_sol = candidates(minpos); 0041 0042 if SampledFunVal(i) >= NewFunVal(closest_sol) 0043 NewPop(closest_sol,:) = SampledPop(i,:); 0044 NewFunVal(closest_sol) = SampledFunVal(i); 0045 end 0046 end 0047 0048 return 0049 0050 0051