Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Indexing Arrays with Decision Variables

Archive User

Archive UserTue November 20, 2018 12:59 PM

  • 1.  Indexing Arrays with Decision Variables

    Posted Tue November 20, 2018 12:59 PM

    Originally posted by: 88Simon88


    Hello everybody,

     

    I want to read some data from Excel, but the index is defined by decision variables. I have:

    TM[1..N][1..3] : this is the data which I have in the excel

    Now, instead of the first index, I want to find that value by a summation like below:

    sum (p in ppp) (Yp * p);

    Y is binary variable and p is an integer, so the outcome is an integer variable, but when I write the array as below, I face with an error "Indexing the array "TM" with the type dexpr int is not supported by this algorithm."

    Could you please help me in this regard?

    Thanks in advance for your help.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Indexing Arrays with Decision Variables

    Posted Tue November 20, 2018 05:08 PM

    Hi,

    in

    https://www.linkedin.com/pulse/how-opl-alex-fleischer/

    you could have a look at

    How to use a decision variable as an index with CPLEX ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Indexing Arrays with Decision Variables

    Posted Tue November 20, 2018 05:53 PM

    Originally posted by: 88Simon88


    Hi

    It was not clear enough for me.

    Take a look at the below table. This is the table which I want to read data from it.

    It is a 2D array named TM[1..7][1..3], but in order to find the first index, I want to use a summation of some decision variables like below:

    sum (p in 1..7) (Ytip *p)  for each t and i 

    This summation provides an integer value for the first index, but the CPLEX cannot recognize it.

    Please help me in this regard. Thank you so much.

     


    #DecisionOptimization