MClapply: MultiCore apply of library parallel.

View source: R/parModel.R

MClapplyR Documentation

MultiCore apply of library parallel.

Description

The evaluation of the fitness of the genes of the population is distributed to one worker on each core of the CPU of the local machine. The package parallel of base R is used. The number of cores is provided by lF$Cores.

Usage

MClapply(pop, EvalGene, lF)

Arguments

pop

Population of genes.

EvalGene

Function for evaluating a gene.

lF

Local function configuration which provides all functions needed in EvalGene().

Details

Be aware that

  • parallel::mclapply() assumes that each function evaluation needs approximately the same time.

  • Best results are obtained if popsize modulo cores-1 is 0.

  • Does not work on Windows.

Value

Fitness vector.

See Also

Other Execution Model: MClapplyHet(), PparLapply(), PparLapplyHet(), futureLapply(), futureLapplyHet()

Examples

library(parallelly) 
if (supportsMulticore()){
lFxegaGaGene$Cores<-function() {2}
pop<-xegaInitPopulation(1000, lFxegaGaGene)
popnew<-MClapply(pop, lFxegaGaGene$EvalGene, lFxegaGaGene)
}


xegaPopulation documentation built on Aug. 22, 2025, 5:14 p.m.