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,sum(d)*8))
df <-cbind(df,df[,10]*c(1,2,3,2))?and I would like to minimize the value for
sum(df[,11]) under the following conditions:?1. all values of a,b,c, and d are
binary variables and are the variables to change to get the optimal result
2. sum(a), sum(b), and sum(d) should be each 5 or more
3. sum(c) should be 3 or less
4. a[2], a[3], b[2], d[7] and d[8] are fixed to their current values.
?sorry about that and thanks for taking the time to respond,?Andras
On Thursday, October 2, 2014 8:40 AM, "Adams, Jean" <jvadams
at usgs.gov> wrote:
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)b
<-c(1,0,1,1,1,1,0,0,0)c <-c(1,0,1,1,0,0,0,0,0)d
<-c(1,1,1,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))
Jean
On Wed, Oct 1, 2014 at 7:30 PM, Andras Farkas <motyocska at yahoo.com>
wrote:
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 value for sum(df[,9]) under the following
conditions:
1. all values of a,b,c, and d are binary variables and are the variables to
change to get the optimal result
2. sum(a), sum(b), and sum(d) should be each 5 or more
3. sum(c) should be 3 or less
4. a[2], a[3], b[2], d[7] and d[8] are fixed to their current values.
any thoughts or reference examples you could help with is greatly appreciated
thanks
andras
______________________________________________
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.
[[alternative HTML version deleted]]