ortools: make search progress logging work in jupyter/IPython
@@ -210,6 +210,11 @@ class CPM_ortools(SolverInterface):
for (kw, val) in kwargs.items():
setattr(self.ort_solver.parameters, kw, val)
+ if kwargs['log_search_progress'] and hasattr(self.ort_solver, "log_callback"):
+ # ortools>9.0, for IPython use, force output redirecting
+ # see https://github.com/google/or-tools/issues/1903
+ self.ort_solver.log_callback = print
+
if solution_callback is None:
ort_status = self.ort_solver.Solve(self.ort_model)
else:
