I have a situation here which i am trying hard to solve, I have a dataset with 4 variables - a,b,c,d
. I am trying to optimize the variables c and d
to minimize the objective function 100*c + 50*d > 0
. where 100 & 50
are my constants. 'b
' has unique values for every 10 records in my data set.
The problem I have is that my constraints are for every subset of records in my dataset. So the granularity differs here. constraints are,
1. sum(c) for every unique 'b' should be less than a constant specified for that unique b
2. sum(d) for every unique 'b' should be less than a constant specified for that unique b
3. c+d should be equal to a
c & d mentioned in the dataset are just initial values, i am trying to solve them. Any idea how to formulate this in R?