[R] Help with constrained optimization

Spencer Graves spencer.graves at pdf.com
Sun Feb 27 18:58:30 CET 2005


	  1.  I have not used nlm, but I would think for many problems, it 
would be roughly equivalent to optim.

	  2.  The parameter "a" in the objective function I wrote was the 
relative weight between optimization of f1 and f2.  I would expect to 
get different answer with a = 0.5, 1, 2, though I could be mistaken. 
This simplest way is to fix "a" in your objective function, though you 
could also have it as an additional argument and pass it as part of the 
"..." argument in optim.  Venables and Ripley (2002) Modern Applied 
Statistics with S, 4th ed. (Springer) discuss optim further, and "..." 
is discussed in both Venables and Ripley (2002) and V&R (2000) S 
Programming (Springer).  Nonlinear optimization is discussed in many 
places.  The book I know the best on this is Bates and Watts (1988) 
Nonlinear Regression Analysis & Its Applications (Wiley).  This book 
includes an important discussion of intrinsic vs. parameter effects 
curvature, noting parameter effects are much bigger in virtually all the 
examples they examined.  That's good news, because it opens the 
possibilities for getting better convergence and better asymptotically 
normal approximations by changing transformations -- or by using 
asymptotic chi-square instead of asymptotic normality to determine 
confidence intervals.  This latter discussion may not apply to your 
immediate problem but is useful in many applications.

	  3.  If you continue to have problems eith nlm, I suggest you give 
optim another try, working through the examples in the help file until 
you think you understand how it works.
	
	  hope this helps.
	  spencer graves

###############################

Dear Spencer Graves,
Thank you very much for your prompt reply. I read your comment from 
November and tried it but smth goes bad in my programs. I thought that I 
did not understand correct your idea.
I am using nlm not optim, and usually I am satisfied with it.
Just, one question re your comment: what is "a" in the objective 
function you have written below?
Thanks again, Vicky.
PS: I have some problems with R-2.0.1 (under XP) - it crashes after I am 
trying to open a source file. I remember that there was a discussion on 
this problem in the list but I did not find time to solve this. Then, I 
have re-installed R-1.9.1 back.

###############################

      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