Documentation of objfun8

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

Function Synopsis

ObjVal = objfun8(Chrom, option);

Help text

 OBJective function for griewangk's FUNction

 This function implements the GRIEWANGK function 8.

 Syntax:  ObjVal = objfun8(Chrom, option)

 Input parameters:
    Chrom     - Matrix containing the chromosomes of the current
                population. Each row corresponds to one individual's
                string representation.
                if Chrom == [], then speziell values will be returned
    option    - if Chrom == [] and
                option == 1 (or []) return boundaries
                option == 2 return title
                option == 3 return value of global minimum

 Output parameters:
    ObjVal    - Column vector containing the objective values of the
                individuals in the current population.
                if called with Chrom == [], then ObjVal contains
                option == 1, matrix with the boundaries of the function
                option == 2, text for the title of the graphic output
                option == 3, value of global minimum
                
 See also: objfun1, objfun1a, objfun1b, objfun2, objfun6, objfun7, objfun9, objfun10

Cross-Reference Information

This function is called by

Listing of function objfun8



% Author:     Hartmut Pohlheim
% History:    12.12.93     file created (copy of valfun7.m)
%             16.12.93     option == 3, return value of global minimum
%             27.01.94     20* in formula, correction ??
%             01.03.94     name changed in obj*
%             17.02.95     direct Dim removed and function cleaned


function ObjVal = objfun8(Chrom, option);

% Compute population parameters
   [Nind, Nvar] = size(Chrom);

% Check size of Chrom and do the appropriate thing
   % if Chrom is [], then define size of boundary-matrix and values
   if Nind == 0
      % Default dimension of objective function
      Dim = 10;
      % return text of title for graphic output
      if option == 2
         ObjVal = ['GRIEWANGKs function 8'];
      % return value of global minimum
      elseif option == 3
         ObjVal = 0;
      % define size of boundary-matrix and values
      else   
         % lower and upper bound, identical for all n variables        
         ObjVal = repmat([-600; 600], [1 Dim]);
      end
   % compute values of function
   else
      % function 8, sum(xi^2/4000) - 20 * prod(cos(xi/sqrt(i))) + 1 for i = 1:Nvar (Nvar = 10)
      % n = Nvar, -600 <= xi <= 600
      % global minimum at (xi) = (0) ; fmin = 0
      nummer = repmat(1:Nvar, [Nind 1]);
      ObjVal = sum(((Chrom.^2) / 4000)')' - prod(cos(Chrom ./ sqrt(nummer))')' + 1;
   end   


% 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).