[R] Optimization with constraint.

From: Andreas Klein <klein82517_at_yahoo.de>
Date: Fri, 14 Mar 2008 11:59:33 +0100 (CET)


I have some problems, when I try to model an optimization problem with some constraints.

The original problem cannot be solved analytically, so I have to use routines like "Simulated Annealing" or "Sequential Quadric Programming".

But to see how all this works in R, I would like to start with some simple problem to get to know the basics:

The Problem:
min f(x1,x2)= (x1)^2 + (x2)^2
s.t. x1 + x2 = 1

The analytical solution:
x1 = 0.5
x2 = 0.5

Does someone have some suggestions how to model it in R with the given functions optim or constrOptim with respect to the routines "SANN" or "SQP" to obtain the analytical solutions numerically?

Again, the simple example should only show me the basic working of the complex functions in R.

Hope you can help me.

With regards

      Lesen Sie Ihre E-Mails auf dem Handy.

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. Received on Fri 14 Mar 2008 - 11:06:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 14 Mar 2008 - 20:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive