79370328

Date: 2025-01-20 05:11:06
Score: 0.5
Natty:
Report link

Yes, the kernel crashes because the solver is destroyed (out of scope) while you still hold references to its variables or try to call its methods. In Python, you must keep the solver or routing model in scope until you are truly finished with it. Returning (or storing) the solver object—or just returning raw solution data—avoids the crash.

This is a common pitfall when using OR-Tools in Jupyter notebooks (or any environment) if you structure your code so that the solver is a local variable in a function and you still want to inspect the variables afterward. The simplest fix is to either:

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Marc Escandell MaRI