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

#include <callback.h>

Public Member Functions

absl::Status CheckModelStorage (const ModelStorage *expected_storage) const
 
CallbackRegistrationProto Proto () const
 

Public Attributes

absl::flat_hash_set< CallbackEventevents
 
MapFilter< Variablemip_solution_filter
 
MapFilter< Variablemip_node_filter
 
bool add_cuts = false
 
bool add_lazy_constraints = false
 

Detailed Description

Provided with a callback at the start of a Solve() to inform the solver:

  • what information the callback needs,
  • how the callback might alter the solve process.

Definition at line 144 of file callback.h.

Member Function Documentation

◆ CheckModelStorage()

absl::Status operations_research::math_opt::CallbackRegistration::CheckModelStorage ( const ModelStorage * expected_storage) const

Returns a failure if the referenced variables don't belong to the input expected_storage (which must not be nullptr).

Definition at line 92 of file callback.cc.

◆ Proto()

CallbackRegistrationProto operations_research::math_opt::CallbackRegistration::Proto ( ) const

Returns the proto equivalent of this object.

The caller should use CheckModelStorage() as this function does not check internal consistency of the referenced variables.

Definition at line 101 of file callback.cc.

Member Data Documentation

◆ add_cuts

bool operations_research::math_opt::CallbackRegistration::add_cuts = false

If the callback will ever add "user cuts" at event CallbackEvent::kMipNode during the solve process (a linear constraint that excludes the current LP solution but does not cut off any integer points).

Definition at line 175 of file callback.h.

◆ add_lazy_constraints

bool operations_research::math_opt::CallbackRegistration::add_lazy_constraints = false

If the callback will ever add "lazy constraints" at event CallbackEvent::kMipNode or CallbackEvent::kMipSolution during the solve process (a linear constraint that excludes integer points).

Definition at line 180 of file callback.h.

◆ events

absl::flat_hash_set<CallbackEvent> operations_research::math_opt::CallbackRegistration::events

The events the solver should invoke the callback at.

When a solver is called with registered events that are not supported, an InvalidArgument is returned. The supported events may depend on the model. For example registering for CallbackEvent::kMip with a model that only contains continuous variables will fail for most solvers. See the documentation of each event to see their supported solvers/model types.

Definition at line 162 of file callback.h.

◆ mip_node_filter

MapFilter<Variable> operations_research::math_opt::CallbackRegistration::mip_node_filter

Restricts the variable returned in CallbackData.solution for event CallbackEvent::kMipNode. This can improve performance.

Definition at line 170 of file callback.h.

◆ mip_solution_filter

MapFilter<Variable> operations_research::math_opt::CallbackRegistration::mip_solution_filter

Restricts the variable returned in CallbackData.solution for event CallbackEvent::kMipSolution. This can improve performance.

Definition at line 166 of file callback.h.


The documentation for this struct was generated from the following files: