title: glmulti runs indefinitely when using genetic algorithm with lme4
body: <p>I'm using glmulti for model averaging in R. There are ~10 variables in my model, making exhaustive screening impractical - I therefore need to use the genetic algorithm (GA) (call: method = "g"). </p>
  
  <p>I need to include random effects so I'm using glmulti as a wrapper for lme4. Methods for doing this are available here <a href="http://www.inside-r.org/packages/cran/glmulti/docs/glmulti" rel="noreferrer">http://www.inside-r.org/packages/cran/glmulti/docs/glmulti</a> and there is also a pdf included with the glmulti package that goes into more detail. The problem is that when telling glmulti to use GA in this setting it runs indefinitely, even after the best model has been found.</p>
  
  <p>This is the example taken from the pdf included in the glmulti package:</p>
  
  <pre><code>library(lme4)
  library(glmulti)
  
  # create a function for glmulti to act as a wrapper for lmer:
  lmer.glmulti &lt;- function (formula, data, random = "", ...) {
  lmer(paste(deparse(formula), random), data = data, REML=F, ...)
  }
  
  # set some random variables:
  y = runif(30,0,10) # mock dependent variable
  a = runif(30) # dummy covariate
  b = runif(30) # another dummy covariate
  c = runif(30) # an another one
  x = as.factor(round(runif(30),1))# dummy grouping factor
  
  # run exhaustive screening with lmer:
  bab &lt;- glmulti(y~a*b*c, level = 2, fitfunc = lmer.glmulti, random = "+(1|x)")
  </code></pre>
  
  <p>This works fine. The problem is when I tell it to use the genetic algorithm:</p>
  
  <pre><code>babs &lt;- glmulti(y~a*b*c, level = 2, fitfunc = lmer.glmulti, random = "+(1|x)", method = "g")
  </code></pre>
  
  <p>It just keeps running indefinitely and the AIC does not change:</p>
  
  <pre><code>...
  
  After 19550 generations:
  Best model: y~1
  Crit= 161.038899734164
  Mean crit= 164.13629335762
  Change in best IC: 0 / Change in mean IC: 0
  
  After 19560 generations:
  Best model: y~1
  Crit= 161.038899734164
  Mean crit= 164.13629335762
  Change in best IC: 0 / Change in mean IC: 0
  
  After 19570 generations:
  Best model: y~1
  Crit= 161.038899734164
  Mean crit= 164.13629335762
  
  ... etc.
  </code></pre>
  
  <p>I have tried using calls that tell glmulti when to stop (deltaB = 0, deltaM = 0.01, conseq = 6) but nothing seems to work. I think the problem must lie with setting the function (?). It may be something really obvious however I'm new to R and I can't work it out.</p>
  
  <p>Any help with this would be much appreciated.</p>