Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

three dimensional array output function

  • 1.  three dimensional array output function

    Posted Tue January 21, 2014 10:05 AM

    Originally posted by: khadeejah


    Dear All,

                    I'm using cplex v12.5.1, my model is a linear model where i've two decision variables X and Y. My input data is in array form.  X & Y are function in s,j,t ; those are the array indices.

    my problem is that i want to have a function that generates the output for X and Y.

    Your help is highly appreciated.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: three dimensional array output function

    Posted Wed January 22, 2014 01:56 AM

    How about using nested loops over the array indices?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: three dimensional array output function

    Posted Wed January 22, 2014 12:38 PM

    Originally posted by: khadeejah


    you mean write it this way:

    for ( s == 0, s < stages+1 , s+

    x[s] == IloNumVarArrayArrayArrayArrayArray(env, stages)

     

    for ( j == 1, j < products+1 , j+

    x[s][j] == IloNumVarArrayArrayArrayArray(env, products);

     

    for ( t == 0, t < periods , t+

    x[s][j][t] == IloNumVarArrayArrayArray(env, periods)


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: three dimensional array output function

    Posted Thu January 23, 2014 02:38 AM

    Originally posted by: Ibrahim_Capar


    If I understand correctly you were able to define decision variables X and Y and you need to get the values of X and Y at the end of optimization. If this is the case, C++ code will be

     

    for (int s=0;s< stages+1; s++)

      for (int j=0;j<products+1; j++)

         for (int t=-;t<periods;t++)

             cout << cplex.getValue(X[s][j][t]) << " ";


    #CPLEXOptimizers
    #DecisionOptimization