[R] Non Linear Solver - Optim in R

Ranjan Maitra maitra.mbox.ignored at inbox.com
Fri Jun 17 16:22:22 CEST 2016


You need to send e-mail from a properly identifiable address (which has a correct name/e-mail address) and not a made-up scam address. You can easily be reported for impersonation!

Ranjan


On Fri, 17 Jun 2016 08:51:59 -0500 Narendra Modi <bjpmodi2016 at gmail.com> wrote:

> Hello,
> Resending this message in "Plain-text".
> 
> Thank you for the add to the list.
> 
> I have written a R snippet to solve a non-linear problem using Optim solver.
> 
> The parameters to be solved are supposed to be in a matrix form as attached
> 
> such that summation of columns is <=1 except for the first column. ie,
> P1.F1j + P2.F1j <=1 ,  P1.F2j + P2.F2j <=1 ,  P1.F3j + P2.F3j <=1 and so
> on..
> 
> Since OPTIM solver considers "pars" only as vector, I defined the vector as
> 
> my.data.var <- vector("numeric",length = 12)
> 
> and in the OPTIM solver, I passed it as
> 
> optim(my.data.var, Error.func, method="L-BFGS-B",
> upper=c(Inf,1,1,1,1,1,Inf,1,1,1,1,1))
> 
> Then in the error function, I stacked the vector into a matrix as :
> 
> my.data.var.mat <- matrix(my.data.var,nrow = 2, ncol = 6,byrow = TRUE)
> 
> So, my first question is how do I define the constraints for each column
> except the first one in the OPTIM solver? As you can see, with the UPPER
> limit in the OPTIM solver, I can fix the upper bound, but there is no way
> for me set the summation constraint to <=1.
> 
> Do I need a different solver for this scenario which allows me to use
> Matrix elements as parameters?
> 
> Thanks!


-- 
Important Notice: This mailbox is ignored: e-mails are set to be deleted on receipt. Please respond to the mailing list if appropriate. For those needing to send personal or professional e-mail, please use appropriate addresses.

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!



More information about the R-help mailing list