Decision Optimization

Decision Optimization

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

 View Only
  • 1.  variable indexer size for an array?

    Posted Tue February 05, 2013 04:32 PM

    Originally posted by: arguen


    Hi all,
    I want to define an array such that its indexer size varies.
    For example: Let x v in V i in N j in N is a binary variable which equals 1 if vehicle v goes from i to j; 0 otherwise.

    In my case x[V][N][N] is a very sparse matrix. But i know that, i depends on v and j depends on i and j.
    In other words, a vehicle v can visit only the set of N_v(v) and can proceed to only j's element of set N_iv(i,v).

    Thus I wrote the following code:
    x[v in V][i in N_v[v]][j in N_iv[i,v]]
    


    But, OPL didn't allow this.

    Do you know if it is possible to somehow code this in OPL.
    If OPL doesn't support "variable indexer size" do you know if C++ or Java support .

    Thank you for any help or tip.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: variable indexer size for an array?

    Posted Tue February 05, 2013 04:47 PM

    Originally posted by: arguen


    By the way,
    I know one solution is using Tuple sets in OPL.
    But I afraid it may create problem when I want to solve the model with "flow-control" using OPL script.
    Also it would be difficult to write hundreds of lines to dictate each possibility.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: variable indexer size for an array?

    Posted Thu February 07, 2013 07:20 AM

    Originally posted by: SystemAdmin


    Go this tuples.

    You don't have to read the data in tuples, you can generate them from arrays on the generation step. I am not familiar with problems with tuples and flow control.

    Regards,
    Zahar
    #DecisionOptimization
    #OPLusingCPLEXOptimizer