14#ifndef OR_TOOLS_MATH_OPT_SOLVERS_GLOP_SOLVER_H_
15#define OR_TOOLS_MATH_OPT_SOLVERS_GLOP_SOLVER_H_
25#include "absl/container/flat_hash_map.h"
26#include "absl/status/status.h"
27#include "absl/status/statusor.h"
28#include "absl/types/span.h"
30#include "ortools/glop/parameters.pb.h"
33#include "ortools/math_opt/callback.pb.h"
37#include "ortools/math_opt/model.pb.h"
38#include "ortools/math_opt/model_parameters.pb.h"
39#include "ortools/math_opt/model_update.pb.h"
40#include "ortools/math_opt/parameters.pb.h"
41#include "ortools/math_opt/result.pb.h"
42#include "ortools/math_opt/solution.pb.h"
43#include "ortools/math_opt/sparse_containers.pb.h"
50 static absl::StatusOr<std::unique_ptr<SolverInterface>>
New(
53 absl::StatusOr<SolveResultProto>
Solve(
55 const ModelSolveParametersProto& model_parameters,
57 const CallbackRegistrationProto& callback_registration,
Callback cb,
59 absl::Status
Update(
const ModelUpdateProto& model_update)
override;
60 bool CanUpdate(
const ModelUpdateProto& model_update)
override;
65 const SolveParametersProto& solver_parameters,
bool setting_initial_basis,
66 bool has_message_callback);
71 void AddVariables(
const VariablesProto& variables);
72 void AddLinearConstraints(
const LinearConstraintsProto& linear_constraints);
74 void DeleteVariables(absl::Span<const int64_t> ids_to_delete);
75 void DeleteLinearConstraints(absl::Span<const int64_t> ids_to_delete);
77 void SetOrUpdateObjectiveCoefficients(
78 const SparseDoubleVectorProto& linear_objective_coefficients);
79 void SetOrUpdateConstraintMatrix(
80 const SparseDoubleMatrixProto& linear_constraint_matrix);
82 void UpdateVariableBounds(
const VariableUpdatesProto& variable_updates);
83 void UpdateLinearConstraintBounds(
84 const LinearConstraintUpdatesProto& linear_constraint_updates);
90 const ModelSolveParametersProto& model_parameters,
91 SolveResultProto& solve_result);
92 absl::StatusOr<SolveResultProto> MakeSolveResult(
94 const ModelSolveParametersProto& model_parameters,
98 absl::Duration solve_time,
99 SolveStatsProto& solve_stats);
101 void SetGlopBasis(
const BasisProto& basis);
106 absl::flat_hash_map<int64_t, glop::ColIndex> variables_;
107 absl::flat_hash_map<int64_t, glop::RowIndex> linear_constraints_;
bool CanUpdate(const ModelUpdateProto &model_update) override
absl::Status Update(const ModelUpdateProto &model_update) override
static absl::StatusOr< std::unique_ptr< SolverInterface > > New(const ModelProto &model, const InitArgs &init_args)
absl::StatusOr< SolveResultProto > Solve(const SolveParametersProto ¶meters, const ModelSolveParametersProto &model_parameters, MessageCallback message_cb, const CallbackRegistrationProto &callback_registration, Callback cb, SolveInterrupter *interrupter) override
static absl::StatusOr< glop::GlopParameters > MergeSolveParameters(const SolveParametersProto &solver_parameters, bool setting_initial_basis, bool has_message_callback)
std::function< void(const std::vector< std::string > &)> MessageCallback
std::function< absl::StatusOr< CallbackResultProto >(const CallbackDataProto &)> Callback
Collection of objects used to extend the Constraint Solver library.