Re: [R] Constrained Optimization in R (alabama)

2013-02-11 Thread Ravi Varadhan
Varadhan Subject: Re: [R] Constrained Optimization in R (alabama) On 10-02-2013, at 21:16, Axel Urbiz wrote: > Dear List, > > I'm trying to solve this simple optimization problem in R. The parameters > are the exponents to the matrix mm. The constraints specify that each row > of

Re: [R] Constrained Optimization in R (alabama)

2013-02-10 Thread Berend Hasselman
On 10-02-2013, at 21:16, Axel Urbiz wrote: > Dear List, > > I'm trying to solve this simple optimization problem in R. The parameters > are the exponents to the matrix mm. The constraints specify that each row > of the parameter matrix should sum to 1 and their product to 0. I don't > understan

Re: [R] Constrained Optimization in R (alabama)

2013-02-10 Thread Ravi Varadhan
Axel, Your objective function has the wrong sign. The maximum is infinity, so it does not make sense to maximize. YOu should be minimizing the product. So, remove the negative sign and it works as you had expected. ff <- function (x) { mm <- matrix(c(10, 25, 5, 10), 2, 2) matx <- matri

Re: [R] Constrained Optimization in R (alabama)

2013-02-10 Thread Ravi Varadhan
Your constraints are non-sensical. The only way for these constraints to be satisfied is for two of the parameters to be 0 and the other two to be 1. Please spend time to formulate your problem correctly, before imposing on others' time. Ravi From: Axel Ur

Re: [R] constrained optimization help please!

2012-11-06 Thread Berend Hasselman
On 05-11-2012, at 23:56, hayduke wrote: > Thank-you Berend. This approach does work. Now I need to constrain the > problem so that sum(d.NR) is positive for each fleet. I tried this but with > no luck: > I see that on Nabble you have boldified the problem. In the R-help mailing list this is con

Re: [R] constrained optimization help please!

2012-11-05 Thread hayduke
Thank-you Berend. This approach does work. Now I need to constrain the problem so that sum(d.NR) is positive for each fleet. I tried this but with no luck: *nfleets<-2 nareas<-2 M<-1 M<-array(M,dim=c(nfleets,nareas)) N<-1000 cost<-c(40,40) cost<-array(cost,dim=c(nfleets,nareas)) Price<-2 Price<-ar

Re: [R] constrained optimization help please!

2012-11-02 Thread Berend Hasselman
On 01-11-2012, at 21:59, hayduke wrote: > Hi All, > I am having some real difficulty in trying to carry out constrained > optimization. I have had no problems with the Optim() function but when I Being pedantic: I assume you mean optim(...)? > try to constrain the problem I am getting all sort

Re: [R] Constrained Optimization

2011-06-16 Thread Uwe Ligges
On 16.06.2011 10:25, Animesh wrote: I am trying to optimize a simple function, but I want to optimize it for values of k between 0 and 1. I read the help file for constrOptim function but it is always giving me the error constrOptim((0.4),simulation,NULL,ui=rbind(c(0,0),c(1,1))) Your param

Re: [R] constrained optimization -which package?

2010-09-29 Thread Hans W. Borchers
Leonardo Monasterio gmail.com> writes: > > Dear R users, > > In the function bellow I want to find the maximum value of v, > subject to the constrain that the sum of x is equal to 1. > I want to maximize: > v<-t(x)%*%distance%*%x > > Subject to: > sum(x)=1 I do not see why you would take t

Re: [R] constrained optimization -which package?

2010-09-28 Thread Paul Smith
On Tue, Sep 28, 2010 at 9:47 PM, Leonardo Monasterio wrote: > In the function bellow I  want to find the maximum value of v, > subject to the constrain that the sum of x is equal to 1. >  I want to maximize: > v<-t(x)%*%distance%*%x > > Subject to: > sum(x)=1 > > Where: > "x" is a vector n X 1 > "

Re: [R] constrained optimization -which package?

2010-09-28 Thread Ravi Varadhan
Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: "Peng, C" Date: Tuesday, September 28, 2010 7:58 pm Subject: Re: [R] constrained optimization -which package? To: r-help@r-project.org > constrOptim() can do linear and quadratic programmin

Re: [R] constrained optimization -which package?

2010-09-28 Thread Peng, C
constrOptim() can do linear and quadratic programming problems! See the following example from the help document. ## Solves linear and quadratic programming problems ## but needs a feasible starting value # # from example(solve.QP) in 'quadprog' # no derivative

Re: [R] constrained optimization -which package?

2010-09-28 Thread Ravi Varadhan
Peng, C Sent: Tuesday, September 28, 2010 2:54 PM To: r-help@r-project.org Subject: Re: [R] constrained optimization -which package? ?constrOptim -- View this message in context: http://r.789695.n4.nabble.com/constrained-optimization-which-package-tp27176 77p2717719.html

Re: [R] constrained optimization -which package?

2010-09-28 Thread Peng, C
?constrOptim -- View this message in context: http://r.789695.n4.nabble.com/constrained-optimization-which-package-tp2717677p2717719.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz

Re: [R] Constrained Optimization

2009-11-04 Thread Berwin A Turlach
On Wed, 4 Nov 2009 14:48:08 -0800 (PST) s t wrote: > I'm trying to do the following constrained optimization example. > Maximize x1*(1-x1) + x2*(1-x2) + x3*(1-x3) > s.t. x1 + x2 + x3 = 1 > x1 >= 0 and x1 <= 1 > x2 >= 0 and x2 <= 1 > x3 >= 0 and x3 <= 1 > which are the constraints. > I'm expecting

Re: [R] Constrained Optimization

2009-11-04 Thread s t
The penalty constraint worked great with "optim". Thanks Andy. --- On Wed, 11/4/09, apjawor...@mmm.com wrote: From: apjawor...@mmm.com Subject: Re: [R] Constrained Optimization To: "s t" Cc: r-help@r-project.org, r-help-boun...@r-project.org Date: Wednesday, November 4,

Re: [R] Constrained Optimization

2009-11-04 Thread apjaworski
Hi, This probably does not answer your question, which I presume is about the workings of constrOptim function, but I have a couple of comments and different solutions of your problem. 1. In general, in the problem of this type, one can incorporate the equality constraint(s) into the objectiv

Re: [R] Constrained Optimization

2009-11-04 Thread Ravi Varadhan
Your initial value is indeed "infeasible", as the error message says. Your x[1] is 1.4, which is not in the interval [0,1]. To incorporate both equalities and inequalities (linear or nonlinear), you could try my function `constrOptim.nl'. Contact me off the list if you are interested. Ravi.

Re: [R] Constrained Optimization, a full example

2009-06-17 Thread Ravi Varadhan
: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Hesen Peng Sent: Tuesday, June 16, 2009 11:51 PM To: Stu @ AGS; R Help Subject: Re: [R] Constrained Optimization, a full example H, I'm assuming that you are trying to find the solution of \beta to the que

Re: [R] Constrained Optimization, a full example

2009-06-16 Thread Hesen Peng
H, I'm assuming that you are trying to find the solution of \beta to the question: argmin |y-X\beta|_2^2, which is a quadratic programming problem. On Tue, Jun 16, 2009 at 6:29 PM, Hesen Peng wrote: > Hello, > > Since the optimization goal is quadratic and constraint is linear, > quadratic pr

Re: [R] Constrained Optimization, a full example

2009-06-16 Thread Hesen Peng
Hello, Since the optimization goal is quadratic and constraint is linear, quadratic programming functions will help. There are many such packages available, e.g. quadprog. On Tue, Jun 16, 2009 at 5:54 PM, Stu @ AGS wrote: > After a few days of work, I think I nearly have it. > > Unfortunately, th

Re: [R] constrained optimization

2009-04-25 Thread David Winsemius
http://search.r-project.org/cgi-bin/namazu.cgi?query=%22constrained+optimization%22&max=100&result=normal&sort=score&idxname=functions&idxname=Rhelp08 And that is only the help messages from the last two years.' On Apr 26, 2009, at 12:00 AM, wrote: Is there any R package addressing problems

Re: [R] Constrained Optimization

2008-08-08 Thread Ravi Varadhan
Hessian may not even exist in a constrained optimization problem, for example, when the solution is on the boundary of the feasible region. If your solution is on the interior, you can use the hessian() function in "numDeriv" package. Ravi. -Original Message- From: [EMAIL PROTECTED] [mai

Re: [R] Constrained Optimization

2008-08-04 Thread Hans W. Borchers
gmx.net> writes: > > Hello, > > I am trying to run a constrained optimization in R. "constrOptim" is really > useful and has helped me a lot, but unfortunately, it doesn't provide the > hessian. Is there a solution to this problem? You didn't provide an example to understand why 'optim' do

Re: [R] Constrained optimization

2008-07-08 Thread Paul Smith
On Tue, Jul 8, 2008 at 11:28 AM, Kanak Choudhury <[EMAIL PROTECTED]> wrote: > i have a function like > > 1+sin(a+bx) where -pi/2<=a+bx<=pi/2 > > i made a progrom using constrOptim() function but it is not giving good > result. it depends on the initial value. but when i am doing simulation it > is