Documentation of mutbin

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

Function Synopsis

NewChrom = mutbin(Chrom, VLUB, MutRate)

Help text

 MUTation for BINary representation

 This function takes the binary representation of the current
 population, mutates each element with given probability and 
 returns the resulting population.

 Syntax:  NewChrom = mutbin(Chrom, VLUB, MutRate)

 Input parameters:
    Chrom     - A matrix containing the chromosomes of the
                current population. Each row corresponds to
                an individuals string representation.
    VLUB      - Matrix containing the boundaries of each variable.
                not used here, necessary for compatibility with
                real valued mutation
    MutRate   - Scalar containing the mutation rate / probability.
                if omitted or NaN MutRate = 0.7/size(Chrom,2) is
                assumed.

 Output parameter:
    NewChrom  - Matrix containing a mutated version of Chrom.

 See also: mutate, mutint, mutreal, mutbmc, initbp

Cross-Reference Information

This function is called by

Listing of function mutbin



% Author:   Hartmut Pohlheim
% History:  21.10.96    file created
%                       same calling syntax then real valued mutation
%                          (VLUB is second parameter and ignored)
%           17.10.97    name changed to mutbin


function NewChrom = mutbin(Chrom, VLUB, MutRate)

% get population size (Nind) and chromosome length (VarLength)
   [Nind, VarLength] = size(Chrom);

% Check input parameters
   if nargin < 3, MutRate = []; end
   if isnan(MutRate), MutRate = []; end
   if isempty(MutRate), MutRate = 0.7/VarLength; end
   MutRate = MutRate(1);

% Perform mutation of individuals
   % add mutation mask to Chrom
   NewChrom = Chrom + (rand(Nind, VarLength) < MutRate);

   % Change all 2 to 0 by performing reminder of 2
   NewChrom = rem(NewChrom, 2);


% End of function
GEATbx: Main page  Tutorial  Algorithms  M-functions  Parameter/Options  Example functions  www.geatbx.com 

This document is part of version 3.7 of the GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with Matlab - www.geatbx.com.
The Genetic and Evolutionary Algorithm Toolbox is not public domain.
© 1994-2005 Hartmut Pohlheim, All Rights Reserved, (support@geatbx.com).