Home > Mateda2.0 > ScriptsMateda > AnalysisScripts > FitnessMeasuresComp.m

# FitnessMeasuresComp

## PURPOSE

%%%%%%%%%%%%%%% COMPUTATION OF FITNESS RELATED MEASURES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

## SYNOPSIS

This is a script file.

## DESCRIPTION

    %%%%%%%%%%%%%%%  COMPUTATION OF FITNESS RELATED MEASURES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     EXAMPLE 1: From the results of an EDA run with default parameters, different measures describing
                the behavior of the algorithm are computed and graphs are
                displayed

## CROSS-REFERENCE INFORMATION

This function calls:

- RunEDA [AllStat,Cache]=RunEDA(PopSize,n,F,Card,cache,edaparams)
- Amount_of_selection [S] = Amount_of_selection(AllFunVals,AllSelFunVals)
- Generations_entropy function H_gens = Generations_entropy(inds_gens,Card,laplace)
- Individuals_entropy
- Mean_Var_Objectives [mean_objs,var_objs] = Mean_Var_Objectives(AllFunVals)
- ObjectiveDistribution [] = ObjectiveDistribution(AllFunVals,objs,gens)
- Realized_heritability [b] = Realized_heritability(AllFunVals,AllSelFunVals)
- Response_to_selection [RS] = Response_to_selection(AllFunVals)

This function is called by:

## SOURCE CODE

    0001
    0002 %%%%%%%%%%%%%%%%  COMPUTATION OF FITNESS RELATED MEASURES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0003 % EXAMPLE 1: From the results of an EDA run with default parameters, different measures describing
    0004 %            the behavior of the algorithm are computed and graphs are
    0005 %            displayed
    0006
    0007   PopSize = 300; n = 45; cache  = [1,1,1,1,1]; Card = 2*ones(1,n); edaparams = {};
    0008   F = 'sum'; % Onemax function;
    0009   ngen = 10;
    0010   edaparams{1} = {'stop_cond_method','max_gen',{ngen}};
    0011   [AllStat,Cache]=RunEDA(PopSize,n,F,Card,cache,edaparams)
    0012    for i=1:ngen,
    0013      auxr{1,i} = Cache{4,i};
    0014      auxs{1,i} = Cache{5,i};
    0015    end,
    0016
    0017   [mean_obj,var_obj] = Mean_Var_Objectives(auxr); % Mean and variance of objectives
    0018   [RS] = Response_to_selection(auxr);             % Response to selection
    0019   [S] = Amount_of_selection(auxr,auxs);           % Amount of selection
    0020   [b] = Realized_heritability(auxr,auxs);         % Realized heritability
    0021   ObjectiveDistribution(auxr,1,[1:ngen]);         % Histogram of the objective distribution
    0022
    0023
    0024  Inds = Cache{1,1};
    0025  Inds_sel = Cache{2,1};
    0026  S_H_pop = Individuals_entropy(Inds,Card,1);      % Accumulated entropy of variables in the first population
    0027  S_H_sel = Individuals_entropy(Inds_sel,Card,1);  % Accumulated entropy of variables in the first selected population
    0028  for i=1:ngen
    0029    inds_gens{i}=Cache{1,i};
    0030  end
    0031  H_gens = Generations_entropy(inds_gens,Card,1);  % Accumulated entropy of variables at each generation
    0032
    0033  X = [1:ngen]
    0034  plot(X,H_gens);