C++ Reference: class MPCallback
Note: This documentation is automatically generated.
Extend this class with model specific logic, and register through
MPSolver::SetCallback, passing a pointer to this object.
See go/mpsolver-callbacks for additional documentation.
Method |
might_add_cuts | Return type: bool |
might_add_lazy_constraints | Return type: bool |
MPCallback | Arguments: bool might_add_cuts, bool might_add_lazy_constraints 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.
|
~MPCallback | Return type: virtual |
RunCallback | Return type: virtual void Arguments: MPCallbackContext* callback_context 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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[null,null,["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."]]],[]]