Originally posted by: Industrial88
Dear all,
I want to to formulate the following mathematical programming constraint using concert technology in C++ interface.
sum(i in I)(j in J) x[i][j] >= 0.5 * sum(j in J)(k in K) y[j][k]
where x[i][j] and y[j][k] are both non-negative continuous decision variables. This constraint means the summation over all "i" and "j" for decision variable "x" is at least greater or equal than half of the summation over all "j" and "k" for decision variable "y".
I am using the following piece of code within my code. However, I'm a little bit skeptical whether it is well-defined or it's wrong!
IloExpr vi(env), vii(env);
for(i = 0; i < I; i++){
for(j = 0; j < J; j++){
vi += x[i][j];}
}
for(j = 0; j < J; j++){
for(k = 0; k < K; k++){
vii += y[j][k];}
}
mipmodel.add(vi >= 0.5*vii);
vi.end();
vii.end();
"env" and "mipmodel" are the names of my environment and my model, respectively.
Any comment would be highly appreciated.
#DecisionOptimization#MathematicalProgramming-General