48 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::StatusOr<bool>
Update(
const ModelUpdateProto& model_update)
override;
60 absl::StatusOr<ComputeInfeasibleSubsystemResultProto>
74 static constexpr auto kSetBounds = glp_set_col_bnds;
75 static constexpr auto kGetLb = glp_get_col_lb;
76 static constexpr auto kGetUb = glp_get_col_ub;
77 static constexpr auto kGetType = glp_get_col_type;
78 static constexpr auto kDelElts = glp_del_cols;
81 static inline bool IsInteger(glp_prob* problem,
int j);
92 std::vector<int64_t> ids;
96 absl::flat_hash_map<int64_t, int> id_to_index;
103 std::vector<double> unrounded_lower_bounds;
108 std::vector<double> unrounded_upper_bounds;
114 struct LinearConstraints {
115 static constexpr auto kSetBounds = glp_set_row_bnds;
116 static constexpr auto kGetLb = glp_get_row_lb;
117 static constexpr auto kGetUb = glp_get_row_ub;
118 static constexpr auto kGetType = glp_get_row_type;
119 static constexpr auto kDelElts = glp_del_rows;
123 static bool IsInteger(glp_prob*,
int) {
return false; }
134 std::vector<int64_t> ids;
139 absl::flat_hash_map<int64_t, int> id_to_index;
145 void AddVariables(
const VariablesProto& new_variables);
148 void AddLinearConstraints(
149 const LinearConstraintsProto& new_linear_constraints);
153 void UpdateObjectiveCoefficients(
154 const SparseDoubleVectorProto& coefficients_proto);
162 void UpdateLinearConstraintMatrix(
163 const SparseDoubleMatrixProto& matrix_updates,
164 std::optional<int64_t> first_new_var_id,
165 std::optional<int64_t> first_new_cstr_id);
173 void AddPrimalSolution(
int (*get_prim_stat)(glp_prob*),
174 double (*obj_val)(glp_prob*),
175 double (*col_val)(glp_prob*,
int),
176 const ModelSolveParametersProto& model_parameters,
177 SolutionProto& solution_proto);
187 void AddDualSolution(
int (*get_dual_stat)(glp_prob*),
188 double (*obj_val)(glp_prob*),
189 double (*row_dual)(glp_prob*,
int),
190 double (*col_dual)(glp_prob*,
int),
191 const ModelSolveParametersProto& model_parameters,
192 SolutionProto& solution_proto);
196 absl::Status AddPrimalOrDualRay(
197 const ModelSolveParametersProto& model_parameters,
198 SolveResultProto& result);
201 absl::Status CheckCurrentThread();
209 std::optional<SolveResultProto> EmptyIntegerBoundsResult();
212 const std::thread::id thread_id_;
214 glp_prob*
const problem_;
216 Variables variables_;
217 LinearConstraints linear_constraints_;
absl::StatusOr< SolveResultProto > Solve(const SolveParametersProto ¶meters, const ModelSolveParametersProto &model_parameters, MessageCallback message_cb, const CallbackRegistrationProto &callback_registration, Callback cb, const SolveInterrupter *interrupter) override