Closed mytarmail closed 5 months ago
Hi,
The error generated is not clear enough to identify the reason why it is generated, but I notice that you are trying to use NSGA-III and you have not defined the reference points (the argument reference_dirs
defines it) when using it, as this parameter is mandatory to be able to execute it. It would also be ideal if you define the number of objectives, looking at the function to evaluate it would be nObj = 3
.
library(rmoo)
fit <- function(inp){
# inp vector length = 100
# some code
x1 <- rnorm(1)
x2 <- rnorm(1)
x3 <- rnorm(1)
# output
return( c(x1,x2,x3) )
}
ref_points <- generate_reference_points(3,12)
result <- rmoo(fitness = fit,
type = "real-valued",
algorithm = "NSGA-III",
lower = rep(-10,100),
upper = rep( 10,100),
monitor = TRUE,
parallel = FALSE,
popSize = 100,
reference_dirs = ref_points,
nObj = 3,
maxiter = 10)
Commenting, we deactivate the parallel
as the overhead of using multiple cores for a function that is not costly would make it slower, so it is ideal to deactivate it.
With these changes, we were able to execute the given function without problems.
Best regards.
Hi!! I'm a little lost... I have a fitness function that takes one vector of size 100, and the output is three values that I need to minimize. What am I doing wrong