[R] optimization question

Andras Farkas motyocska at yahoo.com
Thu Oct 2 02:30:26 CEST 2014


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



More information about the R-help mailing list