Skip to main content

Number of threads used when solving a model within a callback

Answered

Comments

1 comment

  • Mario Ruthmair
    Gurobi Staff Gurobi Staff

    Hi Hugh,

    The outer MIP can use 10 threads, and all those threads might find a solution in branch-and-bound that needs to be checked for violation by your callback.
    However, since the callback in Gurobi is not threadsafe, it is ensured that your callback is only called sequentially (from thread 0), and during its execution, the solver waits.
    Therefore, within your callback, you can run your inner MIP, again spawning 10 new threads, since the outer MIP is currently waiting and nothing else is using the CPU.

    Best regards,
    Mario

    0

Please sign in to leave a comment.