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!
______________________________________________
R-help@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.

Reply via email to