IBM Support

Guidelines for estimating CPLEX memory requirements based on problem size

Question & Answer


Question

How much memory will CPLEX need to solve my problem?

Answer

Memory usage in an application of CPLEX can vary dramatically depending on the type of problem, the parameter settings used to solve it, and the number of threads available for CPLEX to use during the optimization.

For linear programs (LPs), take the number of constraints and divide by 1000 to estimate the number of megabytes required to solve the model. The number of constraints affects memory usage more than the number of variables. Therefore, if the number of constraints dramatically exceeds the number of variables, consider turning on the presolve dual parameter of CPLEX. This setting instructs CPLEX to solve the dual problem, a choice which will probably save memory in this case.

For quadratic programs (QPs), take the number of variables in the quadratic objective, then add the number of constraints in the model. Take the resulting sum and divide by 1000 to estimate the number of megabytes of memory required.

For LPs and QPs, CPLEX’s simplex methods currently run on a single thread, so the presence of multiple cores does not affect memory usage. CPLEX’s barrier method makes use of multiple threads, but it does so in a way that does not significantly increase memory usage. CPLEX’s concurrentopt feature solves LPs and QPs by running different algorithms on different threads. When using this feature on LPs or QPs, one can estimate total memory usage by taking the previously mentioned memory estimates for one thread and multiplying them by the number of algorithms used by concurrentopt (either two or three, depending on the CPLEX version and parameter settings).

For models with quadratic constraints (QCPs), begin with the same estimate for the linear part and the quadratic objective (if it exists). Then for each quadratic constraint, count the number of variables in the quadratic portion of the constraint. Do this for each quadratic constraint. Then add up each of the numbers. Divide the resulting sum by 1000 to obtain the number of additional megabytes required to handle the quadratic constraint. This estimate is not as accurate as the estimates for linear and quadratic programs, but it still provides a useful lower bound.


CPLEX currently solves QCPs with the barrier method, so the concurrentopt feature is not available. As with LPs and QPs, the barrier method for QCPs makes use of multiple threads in a way that does not significantly increase memory usage. Therefore, the previously mentioned memory estimate for QCPs on a single thread applies.

For mixed integer programs (MIPs), CPLEX memory usage varies more than with the previously discussed continuous problems. The list of active nodes in the branch and bound tree can consume large amounts of memory. Therefore, problem size may provide only a weak lower bound on memory usage. CPLEX has solved MIPs with hundreds of thousands of variables and constraints in a matter of minutes and only a modest amount of additional memory beyond that used to solve the initial LP relaxation. On the other hand, there exist small MIPs with a few hundred variables that generate billions of nodes. Neither CPLEX nor any other solvers have (yet) solved some of these hard but small models.

The size of the active node list appears in the column labelled "Nodes Left" in the CPLEX node log. If this value grows rapidly and CPLEX runs out of memory before finding an adequate solution, consider changing the file parameter to 3 (compress the nodes and store them on disk). In exchange for a small performance degradation, this setting dramatically increases the number of active nodes CPLEX can handle. Also, any other settings that reduce the size of the active node list will help. For example, consider setting the variableselect parameter to 3 (strong branching). This setting performs more computation within each node, frequently resulting in a smaller list of active nodes. Setting the MIP emphasis parameter to 1 (emphasize feasibility over optimality) can also reduce the size of the active node list. Setting the nodeselect parameter to 0 (depth first search) results in a very small active list of nodes, essentially guaranteeing that CPLEX will not run out of memory. But, this setting causes CPLEX to use a very rudimentary method to select nodes. Except for situations where the first integer solution will be used, the savings in memory may be offset by extensive run times.


When solving MIPs with multiple threads, one can expect each additional thread to require extra memory needed to maintain and solve a copy of the continuous relaxation of the MIP. For example, when solving a MIQP with 10000 constraints and 20000 variables, 5000 of which appear in the quadratic objective, on a machine with 4 threads, the initial lower bound for the continuous QP is (10000 + 5000)/1000 = 15 MB. Accounting for the 3 additional threads increases the memory usage to 60 MB, establishing the previously described weak lower bound for the MIQP. Additional memory usage will depend primarily on the size of the branch and cut tree.

Users of CPLEX 10.0 and later can save additional memory for any type of problem by turning on the CPLEX memory emphasis parameter. Users of older versions of CPLEX will need instead to set individual parameters such as the presolve compress parameter, the barrier out of core parameter, or the previously discussed file parameter to conserve memory. Performance declines associated with these memory conservation settings typically are modest. Finally, for continuous models, consider using different algorithms to solve the model. Multiple algorithms of CPLEX that solve linear and quadratic programs may differ significantly regarding their memory usage. For all problem types, if none of these memory conservation techniques provide sufficient memory for CPLEX to finish the optimization, consider reducing the number of threads.

[{"Product":{"code":"SSSA5P","label":"IBM ILOG CPLEX Optimization Studio"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Mathematical Programming","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.2;9.1.3;9.1.2;9.1;9.0;8.1;8.0;7.5;7.1;7.0;6.6;12.4;12.3;12.2;12.1;12.0;11.2.1;11.2;11.1.1;11.1;11.0.1;11.0;10.3;10.2.1;10.2;10.1.1;10.1;10.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}},{"Product":{"code":"SSSA5P","label":"IBM ILOG CPLEX Optimization Studio"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"},{"code":"PF017","label":"Mac OS"}],"Version":"12.2","Edition":"All Editions","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

cplex/FAQ/15

Document Information

Modified date:
16 June 2018

UID

swg21399933