excelmemorytuplescplexcp-optimizer

How to delete parameters of arrays after the data is read into tuples for sparsity in CPLEX CP optimizer?


I have a mixed integer program that stops due to insufficient memory (64GB). The data are read from Excel sheets into arrays and sparse. The parameter arrays are then used to create tuples to make use of sparsity. My question is related to what happens to those parameter arrays that are not used. Since memory is of concern, I wonder if and how it is possible to delete those parameter arrays and if this will help with memory usage. Thanks in advance.

The tuple definition is what I came up with to solve the memory problem but then it got me thinking about the parameter arrays that may still use memory.


Solution

  • You can end arrays you no longer need.

    For instance

    using CP;
    
    range r=1..10;
    
    int x[i in r]=i;
    
    int x2[i in r]=2*x[i];
    
    execute
    {
      x2;
      x.end();
    }
    
    dvar int y;
    
    subject to
    {
      y==sum(i in r) x2[i];
    }
    
    execute
    {
      writeln(y);
    }
    

    I used x to compute x2 and then ended x since I no longer need x