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

[R] Constrained Optimization in R (alabama)

2013-02-10 Thread Axel Urbiz
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 understand why the constraints are not satisfied at the solution. I

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

[R] constrained optimization help please!

2012-11-01 Thread hayduke
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 try to constrain the problem I am getting all sorts of error messages. The model is a simple 2 area, 2 fleet, 1 stock model of a fishery. The code i

[R] constrained optimization with vectors using the package alabama

2012-04-05 Thread Bjoern Guse
Hello everyone, I want to estimate a function for the relationship between the distance and the cross-correlation coefficients. This means that I have several pairs of distance and cross-correlation coefficients. Hence, I have a function which includes two vectors with the same length (for dis

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

[R] Constrained Optimization

2011-06-16 Thread Animesh
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))) "Error in ui %*% theta : non-conformable arguments

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

[R] constrained optimization -which package?

2010-09-28 Thread Leonardo Monasterio
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 Where: "x" is a vector n X 1 "distance" is a matrix n*n and it is given. (In practice, the numbe

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

[R] constrained optimization -which package?

2010-09-28 Thread Leonardo Monasterio
Dear R users, I want to find the maximum value of v, subject to the constrain that the sum of x is equal to 1. So, I want to maximize: v<-t(x)%*%distance%*%x Subject to: sum(x)=1 Where: "x" is a vector n X 1 "distance" is a matrix n*n and it is given. (In practive, the number of n can go up to

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
Research Laboratory - E-mail: apjawor...@mmm.com Tel: (651) 733-6092 Fax: (651) 736-3122 From: s t To: r-help@r-project.org Date: 11/04/2009 04:48 PM Subject: [R] Constrained Optimization Sent by: Hi All, I'm trying to do the following constrained optimization example. Maximize x1*(1-

Re: [R] Constrained Optimization

2009-11-04 Thread Ravi Varadhan
g] On Behalf Of s t Sent: Wednesday, November 04, 2009 5:48 PM To: r-help@r-project.org Subject: [R] Constrained Optimization Hi All, 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 x

[R] Constrained Optimization

2009-11-04 Thread s t
Hi All, 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 the answer x1=x2=x3 = 1/3. I tried the "constrOptim" functi

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

[R] Constrained Optimization, a full example

2009-06-16 Thread Stu @ AGS
After a few days of work, I think I nearly have it. Unfortunately, theta is unchanged after I run this (as a script from a file). I thought that theta would contain the fitted parameters. The goal here is to find the least squares fit according to the function defined as "rss" subject to the

Re: [R] R: constrained optimization

2009-04-28 Thread Patrick Burns
kled a similar problem. Maura -Messaggio originale- Da: David Winsemius [mailto:dwinsem...@comcast.net] Inviato: dom 26/04/2009 6.55 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] constrained optimization http://search.r-project.org/cgi-bin/namazu.cgi?query=%22constrained+optimiz

[R] R: constrained optimization

2009-04-26 Thread mauede
. Maura -Messaggio originale- Da: David Winsemius [mailto:dwinsem...@comcast.net] Inviato: dom 26/04/2009 6.55 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] constrained optimization http://search.r-project.org/cgi-bin/namazu.cgi?query=%22constrained+optimization%22&max

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

[R] constrained optimization

2009-04-25 Thread mauede
Is there any R package addressing problems of constrained optimization ? I have the following "apparently" simple problem: Given a set V with fixed cardinality:nv Given a set S whose cardinality is a parameter:nHat Let the cardinality of the intersection S.and.V be:

Re: [R] Constrained Optimization

2008-08-08 Thread Ravi Varadhan
PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Monday, August 04, 2008 7:52 PM To: r-help@r-project.org Subject: [R] Constrained Optimization Hello, I am trying to run a constrained optimization in R. "constrOptim" is really useful and has helped me a lot, b

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

[R] Constrained Optimization

2008-08-04 Thread alan . ng
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? I've tried "optim" with penalty-functions and "L-BFGS-B", but it doesn't help. Alan. --

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

[R] Constrained optimization

2008-07-08 Thread Kanak Choudhury
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 impossible of find the best initial value for every step. also i am not exactly sure how