Forum Discussion

FICO's avatar
FICO
Community Manager
2 years ago

How to reduce memory usage by the solver?

We have a large model and it ran out of memory when it is starting concurrent solve with dual and barrier method. So is it possible to just pick one method here to reduce the memory requirement? Thank you.

=============== log output ============================

FICO Xpress v9.3.0, Hyper, solve started 11:51:09, Apr 17, 2024

Heap usage: 56GB (peak 56GB, 10GB system)

Maximizing MILP PCTO_Duration using up to 32 threads and up to 251GB memory, with these control settings:

OUTPUTLOG = 1

Original problem has:

 76783959 rows  111750376 cols  548702657 elements 111750376 entities

Presolved problem has:

  8539375 rows   37089513 cols  136913748 elements 37089513 entities

LP relaxation tightened

Presolve finished in 1729 seconds

Heap usage: 71GB (peak 126GB, 10GB system)

Coefficient range          original         solved     

 Coefficients  [min,max] : [ 2.62e-05, 5.78e+02] / [ 1.55e-12, 1.68e+00]

 RHS and bounds [min,max] : [ 1.00e+00, 1.00e+00] / [ 1.00e+00, 4.41e+03]

 Objective   [min,max] : [ 3.90e-01, 3.09e+04] / [ 2.02e-01, 5.39e+04]

Autoscaling applied standard scaling

Symmetric problem: generators: 55, support set: 168

 Number of orbits: 58, largest orbit: 18

 Row orbits: 29, row support: 84

Will try to keep branch and bound tree memory usage below 176.1GB

 *** Solution found: 366408331.8  Time: 1946.44  Heuristic: T ***

 *** Solution found: 1539602960.  Time: 1982.51  Heuristic: e ***

 *** Solution found: 1539617893.  Time: 2013.03  Heuristic: h ***

 *** Solution found: 1539630086.  Time: 2046.97  Heuristic: i ***

Starting concurrent solve with dual (1 thread) and barrier (31 threads)

?20 Error: Out of memory (0)

?20 Error: Out of memory (0)

?20 Error: Out of memory (0)

5 Replies

  • FICO's avatar
    FICO
    Community Manager

    You can use the -d flag to use only dual simplex or the -b flag to use only the barrier algorithm for the root node.

    On a related note, it seems like the presolver managed to remove a large portion of the problem. This suggests that the model could probably be improved, so the initial model isn't as large.

  • FICO's avatar
    FICO
    Community Manager

    Thank you for the reply. We are using Python to formulate and solve the model. Can you provide the Python code for setting this flag? Thank you!

  • FICO's avatar
    FICO
    Community Manager

    You can use the LPFLAGS control:

    https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/HTML/LPFLAGS.html

    You can set it to 2 for barrier or 0 for dual simplex. You can use the setControl method on an xpress problem to set the control value:

    https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/python/HTML/problem.setControl.html

  • FICO's avatar
    FICO
    Community Manager

    It seems there is a little confusion about how the LPFLAGS bit control works: This control allows for a custom mix of root LP algorithms.

    You activate dual simplex by setting bit 0 (value 1) to 1, you activate barrier by setting bit 2 (value 4) to 1. Therefore, setting LPFLAGS = 4 activates barrier, but disables dual simplex. LPFLAGS = 1 activates only dual simplex. Mixing both (the current behavior) is achieved by setting LPFLAGS = 5.

    In python, you therefore use

    p = xpress.problem()
    p.setControl('lpflags', 1)   # or 4

    to only run your favorite LP algorithm.

    It is common that one algorithm solves a root LP faster than the other, so it is a good practice to choose that algorithm only.

  • FICO's avatar
    FICO
    Community Manager

    Thank you very much! This is what I need.