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 nonnegative 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 welldefined 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.
Topic
This topic has been locked.
2 replies
Latest Post
 20131118T21:03:34Z by Industrial88
ACCEPTED ANSWER
Pinned topic A constraint definition isue in concert technology/c++ interface
20131116T23:57:20Z

Answered question
This question has been answered.
Unanswered question
This question has not been answered yet.

ACCEPTED ANSWER
Re: A constraint definition isue in concert technology/c++ interface
20131118T11:26:50Z in response to Industrial88To me that looks exactly like the thing you want to do. Do you experience unexpected behavior or why do you have doubts about this?

ACCEPTED ANSWER
Re: A constraint definition isue in concert technology/c++ interface
20131118T21:03:34Z in response to DanielJunglasThanks for your comment.
Actually, I've never had any kind of errors or things like that. I've no longer any doubt about it.
