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

Wraps the MPCallback in order to catch and store exceptions. More...

Public Member Functions

 MPCallbackWrapper (MPCallback *callback)
 
MPCallbackGetCallback () const
 
void CatchException (XPRSprob cbprob)
 
void LogCaughtExceptions ()
 

Detailed Description

Wraps the MPCallback in order to catch and store exceptions.

Definition at line 261 of file xpress_interface.cc.

Constructor & Destructor Documentation

◆ MPCallbackWrapper()

operations_research::MPCallbackWrapper::MPCallbackWrapper ( MPCallback * callback)
inlineexplicit

Definition at line 263 of file xpress_interface.cc.

Member Function Documentation

◆ CatchException()

void operations_research::MPCallbackWrapper::CatchException ( XPRSprob cbprob)
inline

Since our (C++) call-back functions are called from the XPRESS (C) code, exceptions thrown in our call-back code are not caught by XPRESS. We have to catch them, interrupt XPRESS, and log them after XPRESS is effectively interrupted (ie after solve).

Definition at line 269 of file xpress_interface.cc.

◆ GetCallback()

MPCallback * operations_research::MPCallbackWrapper::GetCallback ( ) const
inline

Definition at line 264 of file xpress_interface.cc.

◆ LogCaughtExceptions()

void operations_research::MPCallbackWrapper::LogCaughtExceptions ( )
inline

We don't want the interface to throw exceptions, plus it causes SWIG issues in Java & Python. Instead, we'll only log them. (The use cases where the user has to raise an exception inside their call-back does not seem to be frequent, anyway.)

Definition at line 275 of file xpress_interface.cc.


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