Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Adding condition for index of double array decision variables

  • 1.  Adding condition for index of double array decision variables

    Posted 04/03/18 11:24 PM

    Originally posted by: bobby76


    Hello all,

    Suppose I have a double array decision variables, i.e

    int njobs = 2;

    range jobs = 1..njobs;

    dvar int+ c[i in jobs][j in jobs];

     

    Now the numbers of decision variable c is the combination of njobs, i.e. 4, which are c[1][1], c[1][2], c[2][1], c[2][2]. 

    I want to limit the number of c, i.e., adding the condition such that i != j. So the desired decision varibles will be c[1][2], c[2][1].

    How to declare that in dvar declaration?

     

    Thank you

     

     

     

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Adding condition for index of double array decision variables

    Posted 04/04/18 02:17 AM

    One way to do this is to index with a 2-dimensional tuple:

    tuple ij { int i; int j; }                            // A pair of jobs
    {ij} ijs = { <i,j> | i in jobs, j in jobs : i != j }; // All pairs of different jobs
    dvar int+ c[ijs];

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Adding condition for index of double array decision variables

    Posted 04/04/18 03:40 AM

    Originally posted by: bobby76


    Thank you for your answer.Smile


    #CPLEXOptimizers
    #DecisionOptimization