Home > Mateda2.0 > functions > EvaluateGeneralFunction.m

# EvaluateGeneralFunction

## PURPOSE

[val] = EvaluateGeneralFunction(vector):

## SYNOPSIS

function[val] = EvaluateGeneralFunction(vector)

## DESCRIPTION

     [val] =  EvaluateGeneralFunction(vector):
              Evaluates a vector on a multimodal function whose structure and
              values are respectively defined as global variables
              FunctionStructure and FunctionTables.
     INPUT:
     vector: Solution to be evaluated
     FunctionStructure: A global variable. FunctionStructure{i} is a vector of
                        those variables indices where the function i depends on.
     FunctionTables: A global variable. FunctionTables{i}(j) is the value
                     given by the objective i to the configuration indexed by j.
     FunctionAccCard: A global variable. FunctionAccCard{i} stores the
                      accumulated cardinality of variables that belong to objective i.
     OUTPUT
     val: A vector of number_objective values

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

## CROSS-REFERENCE INFORMATION

This function calls:

- NumconvertCard [valindex] = NumconvertCard(num,length,AccCard)

This function is called by:

- SumEvaluateGeneralFunction [val] = SumEvaluateGeneralFunction(vector):

## SOURCE CODE

    0001 function[val] = EvaluateGeneralFunction(vector)
    0002 % [val] =  EvaluateGeneralFunction(vector):
    0003 %          Evaluates a vector on a multimodal function whose structure and
    0004 %          values are respectively defined as global variables
    0005 %          FunctionStructure and FunctionTables.
    0006 % INPUT:
    0007 % vector: Solution to be evaluated
    0008 % FunctionStructure: A global variable. FunctionStructure{i} is a vector of
    0009 %                    those variables indices where the function i depends on.
    0010 % FunctionTables: A global variable. FunctionTables{i}(j) is the value
    0011 %                 given by the objective i to the configuration indexed by j.
    0012 % FunctionAccCard: A global variable. FunctionAccCard{i} stores the
    0013 %                  accumulated cardinality of variables that belong to objective i.
    0014 % OUTPUT
    0015 % val: A vector of number_objective values
    0016 %
    0017 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0018
    0019  global FunctionTables;
    0020  global FunctionStructure;
    0021  global FunctionAccCard;
    0022
    0023  nfactors = size(FunctionStructure,2);
    0024
    0025  val = zeros(1,nfactors);
    0026  for i=1:nfactors
    0027    length = size(FunctionStructure{i},2);
    0028    j = NumconvertCard(vector(FunctionStructure{i}),length,FunctionAccCard{i})+1;
    0029    val(i) = val(i) + FunctionTables{i}(j);
    0030  end
    0031