69#ifndef OR_TOOLS_MATH_OPT_CPP_CALLBACK_H_
70#define OR_TOOLS_MATH_OPT_CPP_CALLBACK_H_
77#include "absl/container/flat_hash_set.h"
78#include "absl/status/status.h"
79#include "absl/time/time.h"
80#include "absl/types/span.h"
81#include "ortools/math_opt/callback.pb.h"
112 kMip = CALLBACK_EVENT_MIP,
153 CallbackRegistrationProto
Proto()
const;
162 absl::flat_hash_set<CallbackEvent>
events;
258 CallbackResultProto
Proto()
const;
const ModelStorage * storage() const
CpModelProto proto
The output proto.
#define MATH_OPT_DEFINE_ENUM(CppEnum, proto_unspecified_value)
std::function< CallbackResult(const CallbackData &)> Callback
CallbackEvent
The supported events during a solve for callbacks.
In SWIG mode, we don't want anything besides these top-level includes.
A LinearExpression with upper and lower bounds.
LinearExpression expression
CallbackDataProto::PresolveStats presolve_stats
Only available for event == CallbackEvent::kPresolve.
absl::Duration runtime
Time since Solve() was called. Available for all events.
CallbackDataProto::SimplexStats simplex_stats
Only available for event == CallbackEvent::kSimplex.
CallbackDataProto::BarrierStats barrier_stats
Only available for event == CallbackEvent::kBarrier.
std::optional< VariableMap< double > > solution
CallbackDataProto::MipStats mip_stats
CallbackData(CallbackEvent event, absl::Duration runtime)
Users will typically not need this function other than for testing.
CallbackEvent event
The current state of the underlying solver.
absl::flat_hash_set< CallbackEvent > events
MapFilter< Variable > mip_node_filter
bool add_lazy_constraints
absl::Status CheckModelStorage(const ModelStorage *expected_storage) const
MapFilter< Variable > mip_solution_filter
CallbackRegistrationProto Proto() const
const ModelStorage * storage() const
BoundedLinearExpression linear_constraint
The value returned by the Callback function.
absl::Status CheckModelStorage(const ModelStorage *expected_storage) const
std::vector< GeneratedLinearConstraint > new_constraints
CallbackResultProto Proto() const
void AddLazyConstraint(BoundedLinearExpression linear_constraint)
bool terminate
Stop the solve process and return early. Can be called from any event.
std::vector< VariableMap< double > > suggested_solutions
A solution or partially defined solution to give to the solver.
void AddUserCut(BoundedLinearExpression linear_constraint)