Skip to main content

Hi,

I am solving a huge MIP (4446310 integer variables). I set the relative gap to 0% from CPLEX MIP settings. After 69532.16 sec (19.3 hours), the model stops running and the solver status says 'Terminated by solver' while the gap is 0.14%. Why does this happen? What are the possible causes? Thank you.

 

Best regards,

Wanie Saidi

 

HI @Wanie Saidi. Probably CPLEX ran out of memory. I strongly recommend to print the CPLEX status file by setting the following options:

  • Solvers General option 'Solver listing messages' to 'All'
  • CPLEX option 'MIP display' to 'Nth node + info on node cuts'
  • CPLEX option 'Parameter display' to 'Yes'

The CPLEX status file will be printed in the log folder. It contains useful information about the solving process. See also this topic.


Thank you @Marcel Hunting for the recommendations. I’d like to understand if this issue is solely due to CPLEX running out of memory, or if there might be other factors contributing to the problem. Could you provide further insights into possible alternative causes that could lead to the issues?

Best regards,
Wanie Saidi


Hi @Wanie Saidi. The only realistic possible cause that I see is lack of memory (or lack of disk space, if the node file is written on disk). The CPLEX status file should tell you more.


Where is the option to open the log folder in AIMMS?


Hi @Wanie Saidi. You can open the log folder using the File Explorer. It is a sub-folder inside the folder with the AIMMS project. The CPLEX status file can be opened with a text editor like Notepad.

Note that you can open the CPLEX status file inside AIMMS by selecting File - Open - Text File, select All Files instead of Text Files (bottom-right), browse to the log folder, and select, e.g., 'CPLEX 22.1.sta'.


Is it this folder?

 


That is the correct folder. Please note that the CPLEX status file will be emptied if you re-open the AIMMS project, so you might want to copy it after the solve.


This is the CPLEX status file that I got after the model stopped running. Solver status shows ‘Terminated by Solver’ with the gap 0.15%. It seems that it is because there is not enough memory from the CPLEX status file. Can you give a detailed explanation about the other information in this status file?

 


 


The CPLEX status file indeed shows that CPLEX ran out of memory.

The status file shows the type of cutting planes (cuts) that were added while solving the model. The warning about MIP starts not constructed seems incorrect because MIP starts are used (if enabled) at the beginning of the solve when CPLEX should still have sufficient memory.

You did not show the beginning of the CPLEX status file while it contains very useful information about the CPLEX presolver, e.g., the model size after presolving the model.

There are some ways to reduce the memory usage by CPLEX:

  1. Enabling the AIMMS Presolver, by switching on the Solvers General option ‘Linear presolve’, sometimes helps to (drastically) reduce the memory usage by CPLEX. For this you need AIMMS 4.89 or newer. Preferably AIMMS 4.96 or newer because there have been some improvements for the AIMMS Presolver between AIMMS 4.89 and 4.96.
  2. Set the CPLEX option ‘Node file’ to 'On disk and compressed'. However, your hard disk should then have sufficient free space; at least 70 Gb but more preferably.
  3. Reduce the number of threads used by CPLEX by setting the CPLEX option ‘Global thread limit’ to 16. However, this likely will increase the solving time.
  4. Make the model formulation more tight such that CPLEX needs less nodes to solve the model. But this is not easy. See the paper Practical guidelines for solving difficult mixed integer linear programs by Ed Klotz and Alexandra M.Newman (2013) for more information.

Enabling the AIMMS Presolver would only be useful if the CPLEX status file shows that the CPLEX presolver drastically reduced the model size.


I see. Then I have a few questions to ask,

(1) For now I am using AIMMS 4.91. How do I upgrade the AIMMS version to 4.96?

(2) Can you explain about 'threads'? What is the meaning of threads 28 for these iterations? For the thread setting, is it CPLEX 22.1 - Parallel - Global thread limit? What if I set the 16 (as your suggestion) or 0 for the global thread limit?

(3) What is meant by the 0.08% gap for this solution? Have I reached 99.2% optimality, or something else? If I want to limit the solution to 5%, what value should be entered into the MIP Relative Optimality Tolerance?

(4) As shown in this progress window, the solver status is 'Terminated by Solver' and I can't get a result for this solution (since I am looking for a solution to the university exam scheduling problem, the result I should get is in the form of an exam schedule). Is there any way for me to get the entire result from this solver even up to the solution that has been carried out by AIMMS before it was terminated?

 


​​​​​​(1) You can download older AIMMS versions from here. After installing AIMMS 4.96 (or newer) you can just open the project with AIMMS 4.96.

(2) CPLEX uses threads to solve the problem in parallel on multiple cores. In general using more threads results in a better performance but with a higher memory consumption. The CPLEX option 'Global thread limit’ controls the amount of threads used by CPLEX. The value 0 means that the number of threads used is set equal to the number of (logical) cores in the computer.

(3) A gap of 0.08% means that the objective value found is within 0.08% of the optimal objective value. (So, in theory, CPLEX could find an objective value that is 0.08% better if it would have been able to solve the model to optimality.) If you want to limit the solution to 5% then you should set the 'MIP Relative Optimality Tolerance' to 0.05.

(4) You should install an incumbent callback which is called whenever CPLEX finds a new integer feasible solution, which can be stored in AIMMS. After the solve, the last of these solutions can be restored. See the attached example.


How to install an incumbent callback?


Did you check the example that was attached to my previous post?


(1) To install incumbent callback, should I change body of ‘Main Execution’ 

solve Maximum;
if(Maximum.ProgramStatus<>'Optimal')then
    empty X,Z,S,U,YTotal;
endif;

 

to,

 

myGMP := GMP::Instance::Generate( Maximum );

! Install incumbent callback.
GMP::Instance::SetCallbackIncumbent( myGMP, 'IncumbentCallback' );

GMP::Instance::Solve( myGMP );

if ( Maximum.SolverStatus = 'TerminatedBySolver' ) then
    GMP::Solution::SendToModel( myGMP, 2 );
endif;

 

And add as below

 

Is there anything else I need to do to install this incumbent?

 

(2) A gap of 0.08% that I got like the attached file before means that the result is 99.92% optimality or 99.2% optimality?

 


(1) No, that is it. Note that CPLEX might have returned a solution while it ran out of memory but your code

if(Maximum.ProgramStatus<>'Optimal')then
empty X,Z,S,U,YTotal;
endif;

will empty the solution if Maximum.ProgramStatus equals 'IntegerSolution’.

(2) 99.92%


Alright. Thank you. 

 

(1) I have specific question regarding your third suggestion about reduce the memory usage by CPLEX, which is ‘reduce the number of threads used by CPLEX by setting the CPLEX option ‘Global thread limit’ to 16. However, this likely will increase the solving time’.

Currently, the system provides 28 threads for solving the problem. I understand that reducing the number of threads can help manage memory usage, but could you please elaborate on why the specific recommendation is reduce it to 16 threads? Is there a particular reason this value was chosen over other possible values that less than 28?

Would it be equally beneficial or perhaps more effective to choose a different number of threads, such as 12 or 8, if the goal is to further reduce memory usage without excessively increasing the solving time?

 

 

(2) For the nodes, it shows that ‘(Left: 427997)’. Does it mean that there are 427997 nodes left unsolved in solving this problem?

 

I look forward to your detailed explanation on this matter


(1) Using 16 threads seems like a good trade off between performance and memory consumption. If you use 8 or 12 threads then the chance that CPLEX will run out of memory will be smaller, so these can be good choices as well.

(2) There are 427997 nodes that have not been explored (or solved).


I see.

(2) Based on Nodes, there are another 427,997 out of 595,559 nodes that have not been explored. It looks like only a few nodes have been explored (157,562), but if you look at the remaining gap is only 0.08%. What I understand is that this solution has reached 99.92% optimality, but it seems that there are still many Nodes that have not been explored? How is that?


Your CPLEX status file showed that CPLEX ran out of memory. In that case CPLEX will terminate the solve, and therefore it will also stop exploring (unexplored) nodes.

Apparently there are many nodes with a (potential) solution between the Best LP Bound and the Best Solution.


Ok noted. Thank you @Marcel Hunting !

 


Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator