[R] Help with constrained optimization

Spencer Graves spencer.graves at pdf.com
Sun Feb 27 17:48:31 CET 2005


      You say that the total number of parameters is approximately 30, 
but you identify only 4, alpha1, alpha2, beta1 and beta2.  I gather 
these are vectors and g is a scalar? 

       Have you considered making the constraint part of the objective 
function, so you minimize lambda*(g(alpha1)-g(alpha2))^2-f1-a*f2.  I'd 
then start with the values for alpha1, alpha2, beta1 and beta2 you got 
from the individual optimizations and with a small or modest value of 
the "pseudo-Lagrange multiplier", lambda.  After you find a solution, 
increase lambda until the constraint is sufficiently well satisfied. 

      You are using "optim"?  If I ran into trouble with this, I'd 
upgrade to R 2.0.1 and try again.  I don't know if "optim" has changed 
since R 1.9.1, but it's worth upgrading anyway.  Also, "optim" has 4 
unconstrained methods, and I've had good luck rotating between the 4 
methods, using the answer from one as starting values for the other.  
I've had the worse results with SANN, simulated annealing, I think 
because my problems were sufficiently well behaved that the other three 
methods tended to give reasonable results and because SANN spent lots of 
time hopping all over the place without finding a better local minimum. 

      Also, have you tried "www.r-project.org" -> Search -> "R site 
search" for "constrained optimization".  When I did this just now, I got 
87 hits, the third of which was me giving essentially this same comment 
last November. 

      hope this helps. 
      spencer graves
p.s.  You might also find useful the posting guide! 
"http://www.R-project.org/posting-guide.html", in case you haven't 
checked it. 

Vicky Landsman wrote:

>Dear all, 
>I need an advice in the following problem. 
>I have to maximize two functions of the form f1(x)=f(y1,x,alpha1,beta1) and f2(x)=(y2,x,alpha2,beta2), the maximization is with respect to alpha1, alpha2, beta1, beta2.  I can maximize each function separately using nlm. 
>The problem is that I have to add the constraint of the form g(alpha1)=g(alpha2). 
>The total number of parameters is approximately 30.  
>What is the best way to do it? 
>I am using R-1.9.1 on Windows XP. 
>Much thanks in advance for any suggestions, 
>Best regards, 
>Vicky Landsman.   
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>




More information about the R-help mailing list