Stay organized with collections
Save and categorize content based on your preferences.
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 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"],null,[]]