Topic
2 replies Latest Post - ‏2013-11-18T21:03:34Z by Industrial88
Industrial88
Industrial88
8 Posts
ACCEPTED ANSWER

Pinned topic A constraint definition isue in concert technology/c++ interface

‏2013-11-16T23:57:20Z |

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.

 

  • DanielJunglas
    DanielJunglas
    110 Posts
    ACCEPTED ANSWER

    Re: A constraint definition isue in concert technology/c++ interface

    ‏2013-11-18T11:26:50Z  in response to Industrial88

    To me that looks exactly like the thing you want to do. Do you experience unexpected behavior or why do you have doubts about this?

    • Industrial88
      Industrial88
      8 Posts
      ACCEPTED ANSWER

      Re: A constraint definition isue in concert technology/c++ interface

      ‏2013-11-18T21:03:34Z  in response to DanielJunglas

      Thanks for your comment.

      Actually, I've never had any kind of errors or things like that. I've no longer any doubt about it.