Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to define 3 dimentional data matrix.

    Posted 07/30/12 10:13 AM

    Originally posted by: y82li


    typedef IloArray<IloNumArray> NumMatrix;
    typedef IloArray<NumMatrix> NumMatrix3d;
    IloInt nbPart = 3;
    IloInt nbPeriod = 4;
    IloInt nbSite = 5;

    NumMatrix3d lamdabar(env, nbPart);
    for(i = 1; i < nbPart; i++)
    {
    lamda[i] = NumMatrix(env, nbPeriod);
    }
    for(j = 1; j < nbPeriod; j++)
    {
    lamda[i][j] = IloNumArray(env, nbSite);
    }

    lamda[0][0][0] = 5;
    lamda[0][0][1] = 8;
    ......
    lamda[2][3][4] = 10;

    This code does not work. It looks that the way define multi-dimensional data matrix and multi-dimensional var matrix is different.

    I need your help. Thank you!
    BTW, what happen to the display resolution of this forum. I see very small font size. Thanks!
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to define 3 dimentional data matrix.

    Posted 07/30/12 11:37 AM

    Originally posted by: y82li


    There are some typo in the post above. Plese see the code below. Thank you for your help.

    typedef IloArray<IloNumArray> NumMatrix;
    typedef IloArray<NumMatrix> NumMatrix3d;

    IloInt nbPart = 3;
    IloInt nbPeriod = 4;
    IloInt nbSite = 5;

    NumMatrix3d lamdabar(env, nbPart);
    for(i = 1; i < nbPart; i++)
    {
    lamdabar[i] = NumMatrix(env, nbPeriod);
    }
    for(j = 1; j < nbPeriod; j++)
    {
    lamdabar[i][j] = IloNumArray(env, nbSite);
    }

    lamda[0][0][0] = 5;
    lamda[0][0][1] = 8;
    ......
    lamda[2][3][4] = 10;
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How to define 3 dimentional data matrix.

    Posted 07/31/12 03:20 AM

    Originally posted by: SystemAdmin


    Please be more specific. What exactly is the problem? Do you get a compile time error, a runtime error, etc.?
    One very obvious error is that your loops start at index 1 while they should start at index 0 (otherwise the first slot in each dimension is never initialized).
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: How to define 3 dimentional data matrix.

    Posted 07/31/12 12:27 PM

    Originally posted by: y82li


    I Solved the problem already. Thanks a lot!
    #CPLEXOptimizers
    #DecisionOptimization