Home > Mateda2.0 > ordering > fitness_ordering.m

# fitness_ordering

## PURPOSE

[Index]=fitness_ordering(Pop,FunVal)

## SYNOPSIS

function[Index]=fitness_ordering(Pop,FunVal)

## DESCRIPTION

     [Index]=fitness_ordering(Pop,FunVal)
     fitness_ordering:            Individuals are ordered according to the
                                  ranking of its fitness values (best is the maximum)
                                  For multiobjetive functions, individuals are ordered according
                                  average ranking for all the objectives. (i.e. for each objective an ordering
                                  is done, and they are averaged later.
     INPUTS
     Pop:                 Population
     FunVal:              A matrix of function evaluations, one vector of m objectives for each individual
     OUTPUTS
     Index: Ordered index of the individuals in the population

     Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- ParetoRank_ordering [Index]=ParetoRank_ordering(Pop,FunVal)
- ParetoFront_selection [SelPop,SelFunVal]=truncation_selection(Pop,FunVal,selection_params)

## SOURCE CODE

    0001 function[Index]=fitness_ordering(Pop,FunVal)
    0002 % [Index]=fitness_ordering(Pop,FunVal)
    0003 % fitness_ordering:            Individuals are ordered according to the
    0004 %                              ranking of its fitness values (best is the maximum)
    0005 %                              For multiobjetive functions, individuals are ordered according
    0006 %                              average ranking for all the objectives. (i.e. for each objective an ordering
    0007 %                              is done, and they are averaged later.
    0008 % INPUTS
    0009 % Pop:                 Population
    0010 % FunVal:              A matrix of function evaluations, one vector of m objectives for each individual
    0011 % OUTPUTS
    0012 % Index: Ordered index of the individuals in the population
    0013 %
    0014 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0015
    0016    number_objectives = size(FunVal,2);
    0017    PopSize = size(Pop,1);
    0018
    0019    if number_objectives==1
    0020      [Val,Ind]= sort(FunVal(:,1));
    0021      Index = Ind(PopSize:-1:1);
    0022    else
    0023      Rank = zeros(1,PopSize);
    0024      for i=1:number_objectives
    0025       [Val,Ind]= sort(FunVal(:,i));
    0026       Rank(Ind) = Rank(Ind) + [1:PopSize];
    0027      end
    0028      [Val,FinalInd] = sort(Rank);
    0029      Index = FinalInd(PopSize:-1:1);
    0030    end
    0031
    0032
    0033    return
    0034
    0035
    0036
    0037