[R] Constrained Optimisation
Florent D.
flodel at gmail.com
Tue Dec 20 02:41:31 CET 2011
try the lsei function from the limSolve package.
On Mon, Dec 19, 2011 at 2:32 PM, Russell2 <bhargavaoswal at hotmail.co.uk> wrote:
> Dear All
>
> I have a constrained optimisation problem, I want to maximise the following
> function
>
> t(weights) %*% CovarianceMatrix %*% weights
>
> for the weights,
>
> subject to constraints on each element within the weights & the weights
> vector summing to 1.
>
> i.e.
>
> weights = (x1, x2, x3), where x1 is within some given range (a +b, a - b).
>
> I have tried to do this using the optim function in R, setting the minimum &
> maximum tolerances as lower and upper bounds but once I set the constraint
> of the weights summing to 1 in the function, it creates an error.
>
> I have also looked at the constrOptim & solveQP packages and have similar
> problems with constraint settings.
>
> Thanks in advance.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Constrained-Optimisation-tp4215341p4215341.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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