Skip to content

Optimization freezes #25

Closed
Closed
@epsilon64

Description

@epsilon64

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
  )  

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions