Decision Optimization

Decision Optimization

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


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

How to define such a variable in CPLEX?

  • 1.  How to define such a variable in CPLEX?

    Posted 03/23/16 09:39 AM

    Originally posted by: OverflowChu


    Hello,

    Does anyone know how to define a variable x[ i ][ j ]where i <= j in IBM ILOG CPLEX Studio?

    I tried for example

    range j = 0..10;

    range i=0..j;

    dvar float x[ i ][ j ];

     

    but didn't work. I don't want to use a tuple as others suggested

     

    tuple T { int i; int j; };

    {T} tuples = { <i,j> | i,j in I : i<=j };

    dvar float x[tuples];}

     

    because I'd like to keep my variable in the format of x[ i ] [ j ] instead of x[ i ].

    Thanks in advance.

     

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: How to define such a variable in CPLEX?

    Posted 03/23/16 03:55 PM

    Hi,

    you could use dexpr for that:

    range I = 0..10;

    tuple T { int i; int j; };

    {T} tuples = { <i,j> | i,j in I : i<=j };

    dvar float y[tuples];

    dexpr float x[i in I,j in I]=y[<i,j>];

    subject to
    {
    x[1,2]<=4;
    }

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer