Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Conditional if sum constraint

    Posted 06/27/19 12:58 PM

    Originally posted by: Wannie_G


    Hi

     

    In Ilog CPLEX, I want to sum over a range (Areas), except if j equals k.

    The constraint looks like this:

        forall( k in Areas ) 

              sum ( j in Areas: j!=k) X[k][j] == 1;

    However, this does not work.

    Can anybody help me?

    Kind regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Conditional if sum constraint

    Posted 06/27/19 03:04 PM

    Hi

    similar question at https://stackoverflow.com/questions/56796414/conditional-if-sum/56797253#56797253

     
     

    you wrote "except if j is not equal to k"

    So instead of

    
    forall( k in Areas)
            sum ( i in Areas: i!=k) X[i][k] == 1;
    
    

    I would write

    
    forall( k in Areas)
            sum ( i in Areas: i==k) X[i][k] == 1;
    
    

    and if you mean the opposite then you may turn your model into

    //maximize sum( i in Areas ) P[i] * Y[i];
    subject to {
        forall( k in Areas )
            ct1:sum ( j in Areas: j!=k) X[k][j] == 1;
        forall( k in Areas)
            ct2:sum ( i in Areas: i!=k) X[i][k] == 1;
        forall( i in Areas) forall (j in Areas) ct3:T[i] + FROMTO[i][j] -     T[j] - 100*(1-X[i][j]) <= 0;
        ct4:T[1] == 0;
        forall( i in Areas: i!=1) ct5:T[i] - D[i] - 1000*(1-Y[i]) <= 0;

    }

    and then you ll see some conflicts and relaxations.

    regards

     

    https://www.linkedin.com/pulse/making-decision-optimization-simple-alex-fleischer/


    #DecisionOptimization
    #OPLusingCPLEXOptimizer