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 can I have a 2D array inside a tuple ?

  • 1.  How can I have a 2D array inside a tuple ?

    Posted 09/04/15 09:58 AM

    Originally posted by: mikeab


    Hi,

     

    I'm trying to have a 2D array inside a tuple as below:

     

    tuple m1{

     int index ;

     int m2[1..4][1..5];

     

    It dosent let me to define the m2 inside the tuple. How can I do this ?

     

    Thanks

    Mike

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: How can I have a 2D array inside a tuple ?

    Posted 09/04/15 10:52 AM

    Hi,

    indeed in documentation

    IDE and OPL > Optimization Programming Language (OPL) > Language Reference Manual > OPL, the modeling language > Data types > Data structures

    Data types not allowed in tuples

    • Sets of tuples (instances of IloTupleSet)

    • Arrays of strings, tuples, and tuple sets

    • Multidimensional arrays

    So as a workaround you could try to turn your 2D array into 1D

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: How can I have a 2D array inside a tuple ?

    Posted 09/07/15 03:35 AM

    Hi,

    another workaround is to use a 2D array indexed by the tuple set, so it gets a 3D array:

    tuple m1{

     int index ;
     
    }

    {m1} s={<1>,<2>};

    int m2[s][1..4][1..5];

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer