When solving a model in a Jupyter notebook, the log output in the Jupyter notebook may lag one entry behind the log file. For example, the file may contain:
Root simplex log...
Iteration Objective Primal Inf. Dual Inf. Time
9680 -2.8670245e-06 0.000000e+00 2.200658e+00 5s
9687 0.0000000e+00 0.000000e+00 0.000000e+00 5s
while in the Jupyter notebook you only see:
Root simplex log...
Iteration Objective Primal Inf. Dual Inf. Time
9680 -2.8670245e-06 0.000000e+00 2.200658e+00 5s
This behavior is expected, because Jupyter notebooks buffer print statements. To resolve this, you can use this code snippet from Stack Overflow, which implements the Unbuffered class. Note that a very minor performance degradation may occur when using the Unbuffered class.
Further information
Comments
0 comments
Article is closed for comments.