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

The value returned by the Callback function. More...

#include <callback.h>

Classes

struct  GeneratedLinearConstraint
 

Public Member Functions

void AddUserCut (BoundedLinearExpression linear_constraint)
 
void AddLazyConstraint (BoundedLinearExpression linear_constraint)
 
absl::Status CheckModelStorage (const ModelStorage *expected_storage) const
 
CallbackResultProto Proto () const
 

Public Attributes

bool terminate = false
 Stop the solve process and return early. Can be called from any event.
 
std::vector< GeneratedLinearConstraintnew_constraints
 
std::vector< VariableMap< double > > suggested_solutions
 A solution or partially defined solution to give to the solver.
 

Detailed Description

The value returned by the Callback function.

Definition at line 225 of file callback.h.

Member Function Documentation

◆ AddLazyConstraint()

void operations_research::math_opt::CallbackResult::AddLazyConstraint ( BoundedLinearExpression linear_constraint)
inline

Adds a "lazy constraint," a linear constraint that excludes integer points. Use only for CallbackEvent::kMipNode and CallbackEvent::kMipSolution.

Definition at line 246 of file callback.h.

◆ AddUserCut()

void operations_research::math_opt::CallbackResult::AddUserCut ( BoundedLinearExpression linear_constraint)
inline

Adds a "user cut," a linear constraint that excludes the current LP solution but does not cut off any integer points. Use only for CallbackEvent::kMipNode.

Definition at line 240 of file callback.h.

◆ CheckModelStorage()

absl::Status operations_research::math_opt::CallbackResult::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 115 of file callback.cc.

◆ Proto()

CallbackResultProto operations_research::math_opt::CallbackResult::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 133 of file callback.cc.

Member Data Documentation

◆ new_constraints

std::vector<GeneratedLinearConstraint> operations_research::math_opt::CallbackResult::new_constraints

The user cuts and lazy constraints added. Prefer AddUserCut() and AddLazyConstraint() to modifying this directly.

Definition at line 265 of file callback.h.

◆ suggested_solutions

std::vector<VariableMap<double> > operations_research::math_opt::CallbackResult::suggested_solutions

A solution or partially defined solution to give to the solver.

Definition at line 268 of file callback.h.

◆ terminate

bool operations_research::math_opt::CallbackResult::terminate = false

Stop the solve process and return early. Can be called from any event.

Definition at line 261 of file callback.h.


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