[R] Optimize selected variables but not all - nloptr

ProfJCNash profjcnash at gmail.com
Thu Oct 20 03:48:47 CEST 2016


I refer to such parameters as "masked" in my 2014 book Nonlinear parameter optimization with R tools.
Recently I put package optimrx on R-forge (and optimr with fewer solvers on CRAN) that allows for masks with
all the parameters. The masks can be specified as you suggest with start=lower=upper. However, for reasons
I won't go into here, nloptr solvers are not yet included. However, I suspect either Rvmmin or Rcgmin will
work fine.

I will guess that nloptr does NOT cater for masks.

JN

On 16-10-19 05:59 PM, Narendra Modi wrote:
> Hello All,
> I have a matrix with initial values as below and I need to optimize
> the variables that are greater than 0.
> 
>           TAU       fij      fij2
>  [1,] 14.33375 0.0000000 0.01449572
>  [2,] 14.33375 0.0000000 0.00000000
>  [3,] 14.33375 0.0000000 0.00000000
>  [4,] 14.33375 0.0000000 0.02206446
>  [5,] 14.33375 0.0000000 0.00000000
>  [6,] 14.33375 0.0000000 0.00000000
>  [7,] 14.33375 0.0000000 0.00000000
>  [8,] 14.33375 0.8279846 0.00000000
>  [9,] 14.33375 0.0000000 0.03695833
> [10,] 14.33375 0.0000000 0.00000000
> 
> Or structure(c(14.3337481730129, 14.3337481730129, 14.3337481730129,
> 14.3337481730129, 14.3337481730129, 14.3337481730129, 14.3337481730129,
> 14.3337481730129, 14.3337481730129, 14.3337481730129, 0, 0, 0,
> 0, 0, 0, 0, 0.827984553120177, 0, 0, 0.0144957197835888, 0, 0,
> 0.0220644627842788, 0, 0, 0, 0, 0.0369583294835073, 0), .Dim = c(10L,
> 3L), .Dimnames = list(NULL, c("TAU", "fij", "fij2")))
> 
> Is it possible to provide lowerbound and upperbound as 0 for variables
> (< 0 in the initial matrix) and nloptr will consider them "unchanged"
> during optimization?
> 
> Rstudio crashes when I try to do that. Is this a bug or I should
> approach it differently?
> 
> NM
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list