Created
September 15, 2021 14:09
-
-
Save icaroagostino/aef40f595106028b854206581b5266a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Precisa instalar as bibliotecas abaixo na primeira execução, | |
# remova o simbolo de comentário ara instalar | |
# install.packages('GA') | |
# install.packages('parallel') | |
# install.packages('remotes') | |
# remotes::install_github('ewarchul/cecs') | |
library(GA) | |
library(cecs) | |
test_run <- | |
ga(type = 'real-valued', | |
fitness = function(genes) {cec2014(func_index = 1, x = genes)}, | |
lower = rep( 0, 10), | |
upper = rep(10, 10), | |
popSize = 30, | |
maxiter = 100, | |
run = 30, | |
pcrossover = 0.8, | |
pmutation = 0.4, | |
parallel = parallel::detectCores() - 1, | |
monitor = TRUE) | |
plot(test_run) | |
# pelo que entendi ali na função cec2014 o parâmetro "func_index" | |
# é o indice da equação a ser otimizada, nesse exemplo coloquei 1 | |
# os demais parâmetros como espaços de busca e etc estão aleatorios | |
# pra entender melhor essa implementação do cec2014 | |
# esse o link do cara que implementou: https://github.com/ewarchul/cecs | |
# aqui tem uma resumo do pacote GA: https://cran.r-project.org/web/packages/GA/vignettes/GA.html | |
# esse é o artigo que valida a aimplementação do pacote: http://dx.doi.org/10.18637/jss.v053.i04 | |
# github.com/icaroagostino |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment