# Randomly initialize population
set.seed(123)
population <- gena.population(pop.n = 10,
lower = c(-5, -5),
upper = c(5, 5))
# Impose lower and upper bounds constraints
pop.constr <- gena.constr(population,
method = "bounds",
par = list(lower = c(-1, 2),
upper = c(1, 5)))
print(pop.constr)
Run the code above in your browser using DataLab