Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to Segregate SUM?

    Posted 01/18/17 03:26 PM

    Originally posted by: BhavnaJha


    How do I code an eqn which represents flow balance like     

    sum (q in 1..n) x[q][i][j] == sum (p in 1..n) y[i][p][j]  ;  for all i and j

    When I code it like this , it executes it as, 

    sum (q in 1..n) ( x[q][i][j] == sum (p in 1..n) y[i][p][j] ) //Sums over this whole expression 

    What I want it to do is, 

    (sum (q in 1..n)  x[q][i][j] ) ==  ( sum (p in 1..n) y[i][p][j] 

    Will putting parantheses help? 

    I did put them but output is still the same, as in I think it is still evaluating it in the previous way. 

     

     

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: How to Segregate SUM?

    Posted 01/19/17 04:13 AM

    Hi,

    this looks fine but you may use asser to double check sometimes:

    int n=2;

    dvar int x[1..n][1..n][1..n] in 0..10;
    dvar int y[1..n][1..n][1..n] in 0..10;

    subject to

    {

    forall(i in 1..n,j in 1..n)
      sum (q in 1..n) x[q][i][j] == sum (p in 1..n) y[i][p][j]  ;  
     
     
    }

    assert forall(i in 1..n,j in 1..n)
      sum (q in 1..n) x[q][i][j] == sum (p in 1..n) y[i][p][j]  ;

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer