I encountered an error message as above when I tried to optimize few parameters in a function, I've tried to shrink the range of parameter values but the error still exits. Could you kindly tell me what would be the cause of such error? BTW, I actually reproduced the same error message when I use GA package of MCGA. Many thanks! code:
c<-1
e<-2
f<-3
g<-4
posneg.ratio <- function(x) {
lambda_a<-x[1]
lambda_b<-c(x[2],x[3])
lambda_c<-x[4]
random_effect<-factor_comp (lambda_a,lambda_b,lambda_c,e,f,g)
m<-random_effect$factor_a$b1
pos<-abs(sum(m > 0])
neg<-abs(sum(m < 0])
n<-neg/pos
return(n)
}
lower = c(0.5,0.09,0.05,7)
upper = c(0.9,0.2,0.1,12)
DEoptim(posneg.ratio,lower,upper)