21#include "absl/container/flat_hash_set.h"
22#include "absl/status/status.h"
23#include "absl/status/statusor.h"
24#include "absl/strings/string_view.h"
25#include "absl/time/time.h"
26#include "absl/types/span.h"
51 return "mip_solution";
66 return absl::MakeConstSpan(kCallbackEventValues);
88 CHECK_OK(maybe_time.status());
95 <<
"invalid mip_node_filter";
97 <<
"invalid mip_solution_filter";
98 return absl::OkStatus();
121 <<
"invalid new_constraints";
124 for (
const auto& [v, _] :
solution) {
126 v.storage(), expected_storage))
127 <<
"invalid variable " << v <<
" in suggested_solutions";
130 return absl::OkStatus();
144 constraint.linear_constraint.lower_bound_minus_offset());
146 constraint.linear_constraint.upper_bound_minus_offset());
#define RETURN_IF_ERROR(expr)
::operations_research::math_opt::CallbackEventProto event() const
bool has_primal_solution_vector() const
.operations_research.math_opt.SparseDoubleVectorProto primal_solution_vector = 2;
const ::google::protobuf::Duration & runtime() const
const ::operations_research::math_opt::SparseDoubleVectorProto & primal_solution_vector() const
::operations_research::math_opt::SparseVectorFilterProto *PROTOBUF_NONNULL mutable_mip_node_filter()
::operations_research::math_opt::SparseVectorFilterProto *PROTOBUF_NONNULL mutable_mip_solution_filter()
void set_add_lazy_constraints(bool value)
::google::protobuf::RepeatedField< int > *PROTOBUF_NONNULL mutable_request_registration()
void add_request_registration(::operations_research::math_opt::CallbackEventProto value)
void set_add_cuts(bool value)
void set_is_lazy(bool value)
void set_upper_bound(double value)
::operations_research::math_opt::SparseDoubleVectorProto *PROTOBUF_NONNULL mutable_linear_expression()
void set_lower_bound(double value)
CallbackResultProto_GeneratedLinearConstraint GeneratedLinearConstraint
nested types -------------------------------------------------—
::operations_research::math_opt::SparseDoubleVectorProto *PROTOBUF_NONNULL add_suggested_solutions()
void set_terminate(bool value)
::operations_research::math_opt::CallbackResultProto_GeneratedLinearConstraint *PROTOBUF_NONNULL add_cuts()
absl::Status CheckModelStorage(const NullableModelStorageCPtr storage, const ModelStorageCPtr expected_storage)
An object oriented wrapper for quadratic constraints in ModelStorage.
absl::flat_hash_map< Variable, V > VariableMap
absl::Nonnull< const ModelStorage * > ModelStorageCPtr
std::optional< typename EnumProto< P >::Cpp > EnumFromProto(P proto_value)
CallbackEvent
The supported events during a solve for callbacks.
SparseDoubleVectorProto VariableValuesToProto(const VariableMap< double > &variable_values)
Returns the proto equivalent of variable_values.
Enum< E >::Proto EnumToProto(std::optional< E > value)
absl::StatusOr< VariableMap< double > > VariableValuesFromProto(const ModelStorageCPtr model, const SparseDoubleVectorProto &vars_proto)
In SWIG mode, we don't want anything besides these top-level includes.
Select next search node to expand Select next item_i to add this new search node to the search Generate a new search node where item_i is not in the knapsack Check validity of this new partial solution(using propagators) - If valid
inline ::absl::StatusOr< absl::Duration > DecodeGoogleApiProto(const google::protobuf::Duration &proto)
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(ModelStorageCPtr expected_storage) const
MapFilter< Variable > mip_solution_filter
CallbackRegistrationProto Proto() const
std::vector< GeneratedLinearConstraint > new_constraints
CallbackResultProto Proto() const
std::vector< VariableMap< double > > suggested_solutions
A solution or partially defined solution to give to the solver.
absl::Status CheckModelStorage(ModelStorageCPtr expected_storage) const
static absl::Span< const E > AllValues()
Returns all possible values of the enum.
static std::optional< absl::string_view > ToOptString(E value)