seibert.evolve: Evolve a population of parameter values

Description Usage Arguments Value Examples

View source: R/gap_seibert.R

Description

Evolve a population of parameter values

Usage

1
2
3
4
seibert.evolve(params, values, probs = NULL, rescaler = c("rescale_none",
  "rescale", "squish"), seed = NULL, validate = TRUE,
  breedargs = list(breed.use1 = 0.41, breed.use2 = 0.41, breed.rinterpolate =
  0.16, breed.mutate = 0.02))

Arguments

params

A list of parameters with identical names to values

values

A list of parameter values with identical names to params. If all parameters are named parameters, this can be a data.frame.

probs

A vector of probabilities with which to weight sampling of the breeding couples. Can be NULL, indicating there is no preference.

rescaler

Pass TRUE to rescale probs to the range (0, 1). Or optionally a function that transorms probs to valid probability weights. This is useful if the value of probs used is sometimes negative from some objective function.

seed

Seed for random operations

validate

Pass FALSE to skip validation (may be faster).

breedargs

Passed to seibert.breed; may be overridden by parameters.

Value

A list of parameters with identical names to params and values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
params <- list(param.discrete(c('heads', 'tails')),
               param.real(c(0, 1)),
               beersdrank=param.normal.int(5, 1),
               taxes=param.fixed(TRUE))
values <- lapply(params, initial.value, n=10)

seibert.evolve(params, values)

# 'select' for heads
for(i in 1:10) {
  values <- seibert.evolve(params, values,
                           ifelse(values[[1]]=="heads", 0.6, 0.4))
}

paleolimbot/easyoptim documentation built on May 24, 2019, 6:12 p.m.