Home > Mateda2.0 > functions > decomposable > evalfunctrapn.m

# evalfunctrapn

## PURPOSE

[val]=evalfunctrapn(vector)

## SYNOPSIS

function[val]=evalfunctrapn(vector)

## DESCRIPTION

     [val]=evalfunctrapn(vector)
     evalfunctrapn: Implements the non-overlapping trap function of parameter ntrapparam (passed as a global variable)
     f(x) = f_d(x_1,x_2,...x_{ntrapparam}) + ...+  f_d(x_{ntrapparam*m-ntrapparam-1},x_{ntrapparam*m-1},x_{ntrapparam*m})
     INPUTS
     vector: set of variables
     ntrapparam: number of variables in the trap partition (passed as a global variable)
     OUTPUTS
     val: Evaluation of the deceptive function
     Last version 5/11/08. Carlos Echegoyen and Roberto Santana (carlos.echegoyen@ehu.es)

## CROSS-REFERENCE INFORMATION

This function calls:

- Trapn [decep]=Trapn(vector,ntrap)

This function is called by:

## SOURCE CODE

    0001 function[val]=evalfunctrapn(vector)
    0002 % [val]=evalfunctrapn(vector)
    0003 % evalfunctrapn: Implements the non-overlapping trap function of parameter ntrapparam (passed as a global variable)
    0004 % f(x) = f_d(x_1,x_2,...x_{ntrapparam}) + ...+  f_d(x_{ntrapparam*m-ntrapparam-1},x_{ntrapparam*m-1},x_{ntrapparam*m})
    0005 % INPUTS
    0006 % vector: set of variables
    0007 % ntrapparam: number of variables in the trap partition (passed as a global variable)
    0008 % OUTPUTS
    0009 % val: Evaluation of the deceptive function
    0010 % Last version 5/11/08. Carlos Echegoyen and Roberto Santana (carlos.echegoyen@ehu.es)
    0011
    0012 global ntrapparam
    0013 NumbVar = size(vector,2);
    0014
    0015 val = 0;
    0016
    0017 for i=1:ntrapparam:NumbVar
    0018    val = val+Trapn(vector(i:i+ntrapparam-1),ntrapparam);
    0019 end
    0020
    0021
    0022