Documentation of colbestind

Global Index (all files) (short | long) | Local contents | Local Index (files in subdir) (short | long)

Function Synopsis

BestIndNew = colbestind(ColBestOpt, BestIndOld, Chrom, ObjV, RankCh)

Help text

 Collect best individuals during an optimization run

 This functions collects the best individuals during an optimiztaion run.
 The user defines, how many individuals (variable values and corresponding
 objective values - even multi-objective) are collected.
 The function takes care, that no individual is collected twice (comparison
 of variable values).
 It may be specified, that only one individual per objective value is 
 collected (then, the objective values are compared, and not the variable

 Syntax:  BestIndNew = colbestind(ColBestOpt, BestIndOld, Chrom, ObjV, RankCh)

 Input parameter:
    ColBestOpt- (optional) Cell array containing parameters for collection
                   of best individuals
                ColBestOpt{1} = ColIndPartPop: (optional)
                   scalar containing the number of individuals to collect
                   (when smaller 1, the value specifies the number 
                    as part of the population, otherwise floor(ColIndPartPop) 
                    individuals are collected)
                   example: 0.1 means, that 10% of the individuals of the 
                            population are copied to BestIndNew, it is assured,
                            that  these individuals are different from BestIndOld
                            1 (or 1.001) means, that only 1 individual is collected
                   the number of copied individuals is only smaller, when not 
                      enough different individuals are found (different variable 
                   if omitted or NaN, 0.1 is assumed
                ColBestOpt{2} = ColIndCompWhat: (optional)
                   scalar indicating, what should be compared (when checking
                   for identical/not useful individuals)
                   0: Check only for identical variable values
                   1: Check for identical objective values and identical variable values
                   2: Check only for identical objective values
                  -1: No check for differences
                   if omitted or NaN, ColIndCompWhat = 0 is assumed
                ColBestOpt{3} = ColIndWriteFile: (optional)
                   scalar indicating, if the good individuals should be written to
                   file, the file name is given in ColIndFileName (ColBestOpt{3})
                   0: do not write to file
                   1: write good individuals to file
                   if omitted or NaN, ColIndFileName = 0 is assumed
                ColBestOpt{4} = ColIndFileName: (optional)
                   string defining the file name for the collected good individuals
                   if omitted or NaN, ColIndFileName = straddtime('BestIndCollected.txt')
                   is assumed
    BestIndOld- Cell array containing previous best individuals 
                   {1} contains variables, {2} contains objective values
    Chrom     - Matrix containing individuals of current generation
    ObjV      - Vector/Matrix containing objective values of current generation
    RankCh    - Vector containg fitness values (from ranking) of
                   individuals in Chrom

 Output parameter:
    BestIndNew- Cell array containing best individuals from BestIndOld
                   and from Chrom


 % create binary population, calculate obj vals and rank vals
 >> BinPop = initbp(200,5); BinPopObjV = linspace(1, 40, size(BinPop, 1))';
 >> BinPopRank = ranking(BinPopObjV);
 % Perform the collection of the best individuals (each unique individual only ones)
 >> BestIndNew=colbestind([0.4, 0], {}, BinPop, BinPopObjV, BinPopRank)
 % Show the collected individuals pretty printed
 >> prprintf(' %d', {'  ', '\n'}, BestIndNew{1})

 % Perform the collection of the best individuals (check for identical objective values)
 % As we have 200 different objective values, the defined percentage (0.4 * 200 = 80)
 % to collect is smaller (80 individuals are collected)
 >> BestIndNew=colbestind([0.4, 2], {}, BinPop, BinPopObjV, BinPopRank)

 % Perform the collection of the best individuals (check for identical objective values)
 % Now we have only 40 different objective values (rounded obj vals), thus 40 individuals are collected
 >> BestIndNew=colbestind([0.4, 2], {}, BinPop, ceil(BinPopObjV), BinPopRank)

 % Perform the collection of the best individuals (check for identical individuals and objective values)
 % only 20 individuals are collected (0.1 * 200), but the individuals with the best objective values
 >> BestIndNew=colbestind([0.1, 1], {}, BinPop, ceil(BinPopObjV), BinPopRank)

 See also: geamain2

Cross-Reference Information

This function calls This function is called by
GEATbx: Main page  Tutorial  Algorithms  M-functions  Parameter/Options  Example functions 

This document is part of version 3.8 of the GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with Matlab -
The Genetic and Evolutionary Algorithm Toolbox is not public domain.
© 1994-2006 Hartmut Pohlheim, All Rights Reserved, (