Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::MPCallback Class Referenceabstract

#include <linear_solver_callback.h>

Inheritance diagram for operations_research::MPCallback:
operations_research::MPCallbackList

Public Member Functions

 MPCallback (bool might_add_cuts, bool might_add_lazy_constraints)
 
virtual ~MPCallback ()
 
virtual void RunCallback (MPCallbackContext *callback_context)=0
 
bool might_add_cuts () const
 
bool might_add_lazy_constraints () const
 

Detailed Description

Extend this class with model specific logic, and register through MPSolver::SetCallback, passing a pointer to this object.

Definition at line 138 of file linear_solver_callback.h.

Constructor & Destructor Documentation

◆ MPCallback()

operations_research::MPCallback::MPCallback ( bool might_add_cuts,
bool might_add_lazy_constraints )
inline

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.

Definition at line 143 of file linear_solver_callback.h.

◆ ~MPCallback()

virtual operations_research::MPCallback::~MPCallback ( )
inlinevirtual

Definition at line 146 of file linear_solver_callback.h.

Member Function Documentation

◆ might_add_cuts()

bool operations_research::MPCallback::might_add_cuts ( ) const
inline

Definition at line 153 of file linear_solver_callback.h.

◆ might_add_lazy_constraints()

bool operations_research::MPCallback::might_add_lazy_constraints ( ) const
inline

Definition at line 154 of file linear_solver_callback.h.

◆ RunCallback()

virtual void operations_research::MPCallback::RunCallback ( MPCallbackContext * callback_context)
pure virtual

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.

Implemented in operations_research::MPCallbackList.


The documentation for this class was generated from the following file: