# NOT RUN {
f <- function(x) abs(x)+cos(x)
GA <- ga(type = "real-valued",
fitness = function(x) -f(x),
lower = -20, upper = 20, run = 50)
out <- summary(GA)
print(out)
str(out)
# }
Run the code above in your browser using DataLab