astamm / nloptr

nloptr provides an R interface to NLopt, a free/open-source library for nonlinear optimization providing a common interface to a number of different optimization routines which can handle nonlinear constraints and lower and upper bounds for the controls.

Home Page:https://astamm.github.io/nloptr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optimization freezes

epsilon64 opened this issue · comments

Hi,

I'm experiencing a problem when trying to perform a derivative free optimization using NLOPT_LN_COBYLA (code below). The optimization stops at one of the iterations and remains frozen for hours (let it run for more than 24h to make sure it wasn't computing) without throwing any error.

Has this problem ever been experienced?

Thanks
Ben

  toOpt = function(w,turnThresh,stock.data){
       tCosts(w,stock.data) * j - cPMOM(w,stock.data)
  }

  
    ineqCon = function(w,stock.data,turnThresh){
    
    rbind (cTurnover(w,turnThresh,stock.data)
           ,cSumWeights.Min(w,stock.data)
           ,cSumWeights.Max(w,stock.data)
           ,cVOL(w,stock.data)
           ,cREGION.US.Min(w,stock.data)
           ,cREGION.US.Max(w,stock.data))
    
  }
  
  resOpt <- nloptr(x0 = (max.vec + min.vec )/ 2
                   ,eval_f = toOpt
                   #,eval_g_eq = eqCon
                   ,eval_g_ineq = ineqCon
                   ,lb = min.vec
                   ,ub = max.vec
                   ,opts = list('algorithm' = 'NLOPT_LN_COBYLA',
                                #'algorithm' = 'NLOPT_GN_ORIG_DIRECT',
                                #'algorithm' = 'NLOPT_GN_ISRES',
                                'xtol_rel' = 1.0e-2,
                                'maxeval' = 2500,
                                'print_level' = 2
                                )
                   ,stock.data=res.all
                   ,turnThresh = 0.22
  )  

It has been over six years and we know there a suggestion that nlopt itself change some of the code. I don't think there is anything we can do in nloptr alone, and I suggest this issue be close as wontfix.