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

# Trapn

## PURPOSE

[decep]=Trapn(vector,ntrap)

## SYNOPSIS

function[decep]=Trapn(vector,ntrap)

## DESCRIPTION

     [decep]=Trapn(vector,ntrap)
     Trapn:  Evaluation of a partition for trap function with parameter ntrap
     f(x) = f_d(x_1,x_2,...x_{ntrap}) + ...+  f_d(x_{ntrap*m-ntrap-1},x_{ntrap*m-1},x_{ntrap*m})
     INPUTS
     vector: set of variables
     ntrap: number of variables in the trap partition
     OUTPUTS
     decep: Evaluation of the deceptive function

     Last version 5/11/2008. Carlos Echegoyen and Roberto Santana(carlos.echegoyen@ehu.es)

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- evalfunctrapn [val]=evalfunctrapn(vector)

## SOURCE CODE

    0001 function[decep]=Trapn(vector,ntrap)
    0002 % [decep]=Trapn(vector,ntrap)
    0003 % Trapn:  Evaluation of a partition for trap function with parameter ntrap
    0004 % f(x) = f_d(x_1,x_2,...x_{ntrap}) + ...+  f_d(x_{ntrap*m-ntrap-1},x_{ntrap*m-1},x_{ntrap*m})
    0005 % INPUTS
    0006 % vector: set of variables
    0007 % ntrap: number of variables in the trap partition
    0008 % OUTPUTS
    0009 % decep: Evaluation of the deceptive function
    0010 %
    0011 % Last version 5/11/2008. Carlos Echegoyen and Roberto Santana(carlos.echegoyen@ehu.es)
    0012
    0013   s=sum(vector);
    0014   if s==ntrap
    0015     decep=ntrap;
    0016   else
    0017     decep=ntrap-1-s;
    0018   end
    0019  return
    0020
    0021
    0022