Decision Optimization

Decision Optimization

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


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

Three dimensional variable array conversion to a one dimensional array

  • 1.  Three dimensional variable array conversion to a one dimensional array

    Posted 01/27/14 08:37 AM

    Originally posted by: KarolisK.


    Hello all,

    I am using column generation to solve my mathematical problem.

    The problem that I encounter is that the decision variable in my submodel is three dimensional z[j][k][c] which is used later to add new patterns to a tuple by using following line of script:

    masterData.LocPattern.add(masterData.LocPattern.size, 1, subOpl.z.solutionValue);

    As it is known a tuple does not support multidimensional arrays. So my question is how can a three dimensional dvar be converted into a flat one dimensional array which could be used in a tuple afterwards?

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Three dimensional variable array conversion to a one dimensional array

    Posted 01/28/14 04:07 AM

    Originally posted by: KarolisK.


    I have found that 3-dimensional array can be transformed into 1-dimensional array like this:

    z[j][k][c]  -->> z[j*K*C+k*C+c]   where capital K and C are sizes of arrays.

    But my question still remains the same: how and where this should be implemented in OPL?..


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Three dimensional variable array conversion to a one dimensional array

    Posted 01/28/14 10:14 AM

    Hi

    could

    int C=4;
      int J=5;
      int K=2;
     
     
      int z[c in 1..C][j in 1..J][k in 1..K]=c+j+k;
     
      int Z[1..C*J*K]=[ 1+(c-1)*J*K+(j-1)*K+k-1: z[c][j][k] | c in 1..C,j in 1..J,k in 1..K];

     

    help ?


    #DecisionOptimization
    #OPLusingCPLEXOptimizer