p = ps(x = p_dbl(-5, 5))
data = data.frame(x = rep(0, 5))
sa = scl("aggregate", list(
scl("one", objective = 1),
scl("one", objective = 2)
))
sa$prime(p)
(fitnesses = matrix(c(1, 5, 2, 3, 0, 3, 1, 0, 10, 8), ncol = 2))
# to see the fitness matrix, use:
## plot(fitnesses, pch = as.character(1:5))
# default weight 1 -- sum of both objectives
sa$operate(data, fitnesses)
# only first objective
sa$param_set$values[c("weight_1", "weight_2")] = c(1, 0)
sa$operate(data, fitnesses)
# only 2 * second objective
sa$param_set$values[c("weight_1", "weight_2")] = c(0, 2)
sa$operate(data, fitnesses)
Run the code above in your browser using DataLab