[R] bug in DEoptim package

Vladimir Eremeev wl2776 at gmail.com
Thu Aug 30 13:30:18 CEST 2007


(the same mail was sent to the author)

When I called the function DEoptim with control=list(strategy=1) or
control=list(strategy=2)
I got the error:

Error in mui[rtd + 1, i] : incorrect number of dimensions


Analysis of the source code of the DEoptim reveals the following fragment

    if (con$strategy > 5)
      st <- con$strategy - 5 ## binomial crossover
    else {
      st <- con$strategy ## exponential crossover
      mui <- sort(t(mui)) ## transpose, collect 1's in each column

      for (i in 1:NP) {
        n <- floor(runif(1) * d)
        if (n > 0) {
          rtd <- (rotd + n) %% d
          mui[,i] <- mui[rtd + 1,i] ## rotate column i by n 
        }
      }
      mui <- t(mui) ## transpose back
    }


sort returns a 1-dimensional vector, this causes the error in the
following indexing operators.

This also shows, that any strategy value from 1 through 5 will cause
this error, while values from 1 through 10 are possible.

Package's DESCRIPTION file contains the following:

Version: 1.1-8
Date: 2007-01-29

My sessionInfo():

> sessionInfo()
R version 2.5.1 Patched (2007-08-19 r42614) 
i386-pc-mingw32 

locale:
LC_COLLATE=Russian_Russia.1251;LC_CTYPE=Russian_Russia.1251;LC_MONETARY=Russian_Russia.1251;LC_NUMERIC=C;LC_TIME=Russian_Russia.1251

attached base packages:
[1] "tcltk"     "stats"     "graphics"  "grDevices" "utils"     "datasets" 
"methods"   "base"     

other attached packages:
   debug mvbutils  DEoptim 
 "1.1.0"  "1.1.1"  "1.1-8" 

Unfortunately I haven't submerged deep enough to the algorithm details to
propose the bug fix.

-- 
View this message in context: http://www.nabble.com/bug-in-DEoptim-package-tf4353533.html#a12405068
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list