Re: [R] optimization question

2014-10-02 Thread Andras Farkas
There is an error jean, I apologize... I made changes to the vectors and did not correct the bottom line... this is the correct run:a <-c(0,1,1,0,1,0,0,0,0) b <-c(0,0,0,1,0,0,0,0,0) c <-c(1,0,1,0,1,1,0,0,0) d <-c(0,1,0,1,0,1,0,0,0) df <-rbind(a,b,c,d) df <-cbind(df,h=c(sum(a)*8,sum(b)*8,sum(c)*8,s

Re: [R] optimization question

2014-10-02 Thread Adams, Jean
Andras, Is there an error in your post or am I missing something? df[, 9] is made up of the last (9th) element of each of a, b, c, and d. The minimum value for sum(df[, 9]) is 0. Given your conditions, there are many, many ways to get this result. Here is just one example: a <-c(1,1,1,1,1,0,0,0,0

[R] optimization question

2014-10-01 Thread Andras Farkas
Dear All, please provide help with the following: we have a <-c(0,1,1,0,1,0,0,0,0) b <-c(0,0,0,1,0,0,0,0,0) c <-c(1,0,1,0,1,1,0,0,0) d <-c(0,1,0,1,0,1,0,0,0) df <-rbind(a,b,c,d) df <-cbind(df,h=c(sum(a)*8,sum(b)*8,sum(c)*8,sum(d)*8)) df <-cbind(df,df[,8]*c(1,2,3,2)) I would like to minimize the

Re: [R] Optimization Question

2011-02-14 Thread Ravi Varadhan
du -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ravi Varadhan Sent: Monday, February 14, 2011 10:20 AM To: 'Gabrielsen, Alexandros'; r-help@r-project.org Subject: Re: [R] Optimization Question Your function is non-smooth

Re: [R] Optimization Question

2011-02-14 Thread Ravi Varadhan
On Behalf Of Gabrielsen, Alexandros Sent: Monday, February 14, 2011 7:17 AM To: r-help@r-project.org Subject: [R] Optimization Question Hi all, This is my first optimization code and am receiving the following error for the following function: fn <- function(p) { +263*log(sqrt(2*pi)*sd(test$A))+ sum(

[R] Optimization Question

2011-02-14 Thread Gabrielsen, Alexandros
Hi all, This is my first optimization code and am receiving the following error for the following function: fn <- function(p) { +263*log(sqrt(2*pi)*sd(test$A))+ sum(log(abs(c(test$A[-1], 1))^p[3])) + (sum(((test$A-p[1]+(p[2]+1)*c(test$A[-1], 1)))^2)/sum(sd(test$A)*(abs(c(test$A[-1], 1))^p[3])

Re: [R] Optimization Question

2009-06-12 Thread spencerg
The "1L", etc., forces the number to be integer: > is.integer(1) [1] FALSE > is.integer(1L) [1] TRUE Hope this helps. Spencer Paul Smith wrote: On Thu, Jun 11, 2009 at 9:56 PM, Brecknock, Peter wrote: Apologies if this is not the correct list for this question. The Rglpk pac

Re: [R] Optimization Question

2009-06-12 Thread Paul Smith
On Thu, Jun 11, 2009 at 9:56 PM, Brecknock, Peter wrote: > Apologies if this is not the correct list for this question. > > The Rglpk package offers the following example in its documentation > > library(Rglpk) > ## Simple mixed integer linear program. > ## maximize: 3 x_1 + 1 x_2 + 3 x_3 > ## subj

[R] Optimization Question

2009-06-11 Thread Brecknock, Peter
Hi All Apologies if this is not the correct list for this question. The Rglpk package offers the following example in its documentation library(Rglpk) ## Simple mixed integer linear program. ## maximize: 3 x_1 + 1 x_2 + 3 x_3 ## subject to: -1 x_1 + 2 x_2 + x_3 <= 4 ## 4 x_2 - 3 x_3 <= 2 ## x