If you intend to call call MPCallbackContext::AddCut(), you must set
might_add_cuts below to be true. Likewise for
MPCallbackContext::AddLazyConstraint() and might_add_lazy_constraints.
Threading behavior may be solver dependent:
* Gurobi: RunCallback always runs on the same thread that you called
MPSolver::Solve() on, even when Gurobi uses multiple threads.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["The `MPCallback` class is designed to be extended with custom logic for specific optimization models."],["Register your custom callback using `MPSolver::SetCallback`, passing a pointer to your `MPCallback` object."],["You must indicate during construction whether your callback will add cuts or lazy constraints to the solver."],["The `RunCallback` method is where you implement your core logic and interact with the solver via `MPCallbackContext`."],["Refer to go/mpsolver-callbacks for further details and advanced usage."]]],["The `MPCallback` class in C++ allows users to extend model-specific logic. Users must register instances of extended classes via `MPSolver::SetCallback`. The class includes virtual methods: `RunCallback`, which executes custom logic within a solver's process, and `~MPCallback`, `might_add_cuts` and `might_add_lazy_constraints`. The user has to indicate in the constructor of `MPCallback` if the methods `AddCut` and/or `AddLazyConstraint` are going to be called. Threading behavior is solver-dependent.\n"]]