Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

How to Improve the Speed of Retrieving Solution Information in CPLEX Concert Technology

  • 1.  How to Improve the Speed of Retrieving Solution Information in CPLEX Concert Technology

    Posted Mon May 27, 2013 03:30 PM

    Originally posted by: EhsanN


    I'm solving an optimization problem using a B&C algorithm in CPLEX. In my algorithm, I've used a lazy cut callback to derive the cuts. This process requires solving a separation problem based on the current node solution. As the solution is a 4-index decision variable, I've implemented the following code to retrieve the solution:

       fourDNumArray myCallbackAlloc(myMainEnv, nbNodes);
       for(i = 0; i < nbNodes; i++){
          myCallbackAlloc[i] = IloArray<IloArray<IloNumArray> >(myMainEnv, nbNodes);
          for(j = 0; j < nbNodes; j++){
             myCallbackAlloc[i][j] = IloArray<IloNumArray>(myMainEnv, nbNodes);
             for(k = 0; k < nbNodes; k++){
                myCallbackAlloc[i][j][k] = IloNumArray(myMainEnv);
                getValues(myCallbackAlloc[i][j][k], allocation[i][j][k]);
             }
          }
       }

    The above procedure is fast enough for instances of 10 nodes or less. However, for instances of 20 nodes or more, this is ineffective. In fact, this procedure requires 20 seconds for a 20-node instance, while solving the separation problem itself requires just 2 or 3 seconds.

    My understanding is the getValues method only retrieves one-dimensional arrays of decision variables, and not 2D or more arrays. So, I'm wondering if there is any other way to retrieve the solution information faster.

    PS. I'm using the 64-bit edition of CPLEX 12.5 on both Windows 7 64-bit and Linux 64-bit Machines with enough memory and CPU power.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to Improve the Speed of Retrieving Solution Information in CPLEX Concert Technology

    Posted Tue May 28, 2013 03:49 PM

    Flatten the allocation matrix into a vector of variables, pass it to getValues along with a double vector of the same length, then inflate the double vector into a matrix of values. I would not be surprised to find open-source code libraries for converting between matrices and vectors, but it would not be at all challenging to code it yourself. 

    Paul


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How to Improve the Speed of Retrieving Solution Information in CPLEX Concert Technology

    Posted Tue May 28, 2013 05:41 PM

    Originally posted by: EhsanN


    Thanks for the advice, Paul. I guess changing the solution representation would be a fit solution to my application.


    #CPLEXOptimizers
    #DecisionOptimization