All, I have searched the previous help boards and discovered the problem with Rdonlp2 - Specifically, its non-availability. I thought that this was my solution, but perhaps there is a better way that you all could help me with. I imagine that this problem is trivial to people such as the experts on this mailing list. I am trying to solve this problem over and over again in a simulation: I want to find the values of x and y which minimize f(x,y) = sqrt((z-x)^2+(w-y)^2 subject to the constraints: 0=< sqrt((z2-x)^2+(w2-y)^2) - d2 0=< sqrt((z3-x)^2+(w3-y)^2) - d3 ..... 0=< sqrt((zk-x)^2+(wk-y)^2) - dk where zi, wi, di are known scalars. I would appreciate any help with how to implement this in R. Many thanks, Brandon Z. University of Antwerp
If the data is fairly small, send it and the objective function to me off-list and I'll give it a quick try. However, this looks very much like the kind of distance-constrained type of problem like the "largest small polygon" i.e., what is the maximum area hexagon where no vertex is more than 1 unit from another. (It is NOT a regular hexagon! More like a dented pentagon.) Such problems are often better posed using polar coordinates, but the setup takes work. If you are going to have to do a lot of these problems, it will be worthwhile looking into ways to get very good starts, in which case a very crude method using penalty or barrier functions could be effective. John Nash> From: Brandon Zicha <brandon.zicha at ua.ac.be> > Subject: [R] non-linear contrained optimization > Message-ID: <33C13A02-F603-410A-871D-E78DDE272768 at ua.ac.be> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes > > I have searched the previous help boards and discovered the problem > with Rdonlp2 - Specifically, its non-availability. I thought that this > was my solution, but perhaps there is a better way that you all could > help me with. I imagine that this problem is trivial to people such > as the experts on this mailing list. > > I am trying to solve this problem over and over again in a simulation: > > I want to find the values of x and y which minimize > f(x,y) = sqrt((z-x)2+(w-y)2 > > subject to the constraints: > 0=< sqrt((z2-x)2+(w2-y)2) - d2 > 0=< sqrt((z3-x)2+(w3-y)2) - d3 > ..... > 0=< sqrt((zk-x)2+(wk-y)2) - dk > > where zi, wi, di are known scalars. > > I would appreciate any help with how to implement this in R. > > Many thanks, > > Brandon Z. > > University of Antwerp
Hi, I have a nonlinear constrained optimization code that can handle nonlinear (and linear) constraints. Send me an email if you are interested. There is also a package available on R-forge, called Rsolnp. Hope this is helpful, Ravi. ---------------------------------------------------------------------------- ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvaradhan at jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h tml ---------------------------------------------------------------------------- -------- -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Brandon Zicha Sent: Wednesday, February 17, 2010 10:53 AM To: r-help at r-project.org Subject: [R] non-linear contrained optimization All, I have searched the previous help boards and discovered the problem with Rdonlp2 - Specifically, its non-availability. I thought that this was my solution, but perhaps there is a better way that you all could help me with. I imagine that this problem is trivial to people such as the experts on this mailing list. I am trying to solve this problem over and over again in a simulation: I want to find the values of x and y which minimize f(x,y) = sqrt((z-x)^2+(w-y)^2 subject to the constraints: 0=< sqrt((z2-x)^2+(w2-y)^2) - d2 0=< sqrt((z3-x)^2+(w3-y)^2) - d3 ..... 0=< sqrt((zk-x)^2+(wk-y)^2) - dk where zi, wi, di are known scalars. I would appreciate any help with how to implement this in R. Many thanks, Brandon Z. University of Antwerp ______________________________________________ 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.