cmaCalcFitness {rCMA}R Documentation

Calculate the fitness of a population.

Description

The population is usually obtained by cmaSamplePopulation.

Usage

cmaCalcFitness(cma, popR, fitFunc)

Arguments

cma

CMA-ES Java object, already initialized with cmaInit

popR

a (dimension x popSize) matrix from cmaSamplePopulation

fitFunc

a function to be minimized. Signature: accepts a vector x, returns a double.

Value

fitness, a vector of length cmaGetPopulationSize(cma) with the fitness of each individuum

Author(s)

Wolfgang Konen, FHK, 2013

See Also

cmaSamplePopulation, cmaUpdateDistribution, cmaNew

Examples

cma <- cmaNew();
   cmaInit(cma,dimension=2,initialX=1.5);
   popR <- cmaSamplePopulation(cma);
   fitFunc <- function(x) {sum(x*x)};
   fitness <- cmaCalcFitness(cma,popR,fitFunc);
   cmaUpdateDistribution(cma,fitness);

[Package rCMA version 1.1.1 Index]