Dear Ravi,
As I've already written to you, the problem indeed is to find a solution
to the transcendental equation y = x * T^(x-1), given y and T and the
optimization problem below only a workaround.
John C. Nash has been so kind to help me on here. In case anyone faces a
similar problem in the future, the solution looks as follows:
*****
func1 <- function(y,x,T){
out <- x*T^(x-1)-y
return(out)
}
# Assign the known values to y and T:
y <- 3
T <- 123
root <- uniroot(func1,c(-10,100),y=y,T=T)
print(root)
********
Somewhat simpler than I thought....
Thanks again!
Uli
Am 26.07.2010 17:44, schrieb Ravi Varadhan:
Hi Uli,
I am not sure if this is the problem that you really want to solve. The
answer is the solution to the equation y = x * T^(x-1), provided a solution
exists. There is no optimization involved here. What is the real problem
that you are trying to solve?
If you want to solve a more meaningful constrained optimization problem, you
may want to try the "abalama" package which I just put on CRAN. It can
optimize smooth nonlinear functions subject to linear and nonlinear equality
and inequality constraints.
http://cran.r-project.org/web/packages/alabama/index.html
Let me know if you run into any problems using it.
Best,
Ravi.
-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Uli Kleinwechter
Sent: Monday, July 26, 2010 10:16 AM
To: r-help@r-project.org
Subject: [R] Optimization problem with nonlinear constraint
Dear all,
I'm looking for a way to solve a simple optimization problem with a
nonlinear constraint. An example would be
max x s.t. y = x * T ^(x-1)
where y and T are known values.
optim() and constrOptim() do only allow for box or linear constraints,
so I did not succedd here. I also found hints to donlp2 but this does
not seem to be available anymore.
Any hints are welcome,
Uli
______________________________________________
R-help@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.