[R] Optimize selected variables but not all - nloptr

Narendra Modi bjpmodi2016 at gmail.com
Thu Oct 20 17:59:46 CEST 2016


Thanks Prof Nash.
The reason I used nlopr() in my problem is due to non linear
constraints. I wonder if optimrx/optim can model the below scenario. I
will be elated if it can.
The problem in hand goes like this:

There are 2 injectors and 2 producers. Consider these as some entity.

I have an actual dataset, Act.Matrix; assume row=50, col=2.
The predicted dataset is calculated by using the attached equation,
i.e for each row of the prediction, that equation is used.

The parameters to be evaluated are Tau, and a set of Fij's such that
sum of Fij's <=1 .
Fij represents connectivity between each inj to each prod, hence for
this example there will be a total of 4 fij. and 2 tau (one tau for
each producer)

The lb for each parameter that I provided is 0 and ub as Inf

    TAU                 fij                fij2
>>  [1,] 14.3      0.01        0.01449572
>>  [2,] 14.3      0.2          0.00000000

The constraints being Sum of each column of Fij<=1.

With nloptr (algorithm NLOPT_LN_COYLA) , I am able to solve it to some
extent. but when the dataset is scaled (consider having 50 producers
and 25 injectors!! ), the number of variables to be solved is much
higher!

Do you think OPTIMX/OPTIMRX can handle non linear constraints like
that? if it can then I can definitely use the MASKED parameters.

NM


On Wed, Oct 19, 2016 at 8:48 PM, ProfJCNash <profjcnash at gmail.com> wrote:
> 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.
>>
>
> ______________________________________________
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: equation.PNG
Type: image/png
Size: 6087 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20161020/82e67e1b/attachment.png>


More information about the R-help mailing list