53 static absl::StatusOr<std::unique_ptr<SolverInterface>>
New(
56 absl::StatusOr<SolveResultProto>
Solve(
58 const ModelSolveParametersProto& model_parameters,
60 const CallbackRegistrationProto& callback_registration,
Callback cb,
62 absl::StatusOr<bool>
Update(
const ModelUpdateProto& model_update)
override;
63 absl::StatusOr<ComputeInfeasibleSubsystemResultProto>
71 const SolveParametersProto& solve_parameters);
80 struct AuxiliaryStructureHandler {
84 absl::Status DeleteStructure(GScip& gscip);
86 std::vector<SCIP_VAR*> variables;
87 std::vector<SCIP_CONS*> constraints;
93 absl::Status AddVariables(
const VariablesProto& variables,
94 const absl::flat_hash_map<int64_t, double>&
95 linear_objective_coefficients);
99 absl::StatusOr<bool> UpdateVariables(
100 const VariableUpdatesProto& variable_updates);
102 absl::Status AddQuadraticObjectiveTerms(
103 const SparseDoubleMatrixProto& new_qp_terms,
bool maximize);
106 absl::Status AddLinearConstraints(
107 const LinearConstraintsProto& linear_constraints,
108 const SparseDoubleMatrixProto& linear_constraint_matrix);
112 absl::Status UpdateLinearConstraints(
113 LinearConstraintUpdatesProto linear_constraint_updates,
114 const SparseDoubleMatrixProto& linear_constraint_matrix,
115 std::optional<int64_t> first_new_var_id,
116 std::optional<int64_t> first_new_cstr_id);
118 absl::Status AddQuadraticConstraints(
119 const google::protobuf::Map<int64_t, QuadraticConstraintProto>&
120 quadratic_constraints);
122 absl::Status AddIndicatorConstraints(
123 const google::protobuf::Map<int64_t, IndicatorConstraintProto>&
124 indicator_constraints);
129 absl::StatusOr<std::pair<SCIP_VAR*, SCIP_CONS*>>
130 AddSlackVariableEqualToExpression(
const LinearExpressionProto& expression);
136 absl::StatusOr<std::pair<GScipSOSData, AuxiliaryStructureHandler>>
137 ProcessSosProto(
const SosConstraintProto& sos_constraint);
139 absl::Status AddSos1Constraints(
140 const google::protobuf::Map<int64_t, SosConstraintProto>&
142 absl::Status AddSos2Constraints(
143 const google::protobuf::Map<int64_t, SosConstraintProto>&
146 absl::flat_hash_set<SCIP_VAR*> LookupAllVariables(
148 absl::StatusOr<SolveResultProto> CreateSolveResultProto(
149 GScipResult gscip_result,
150 const ModelSolveParametersProto& model_parameters,
151 std::optional<double> cutoff);
163 std::unique_ptr<GScipSolverConstraintData> constraint_data_;
164 const std::unique_ptr<GScip> gscip_;
168 bool has_quadratic_objective_ =
false;
169 absl::flat_hash_map<int64_t, SCIP_CONS*> linear_constraints_;
170 absl::flat_hash_map<int64_t, SCIP_CONS*> quadratic_constraints_;
174 absl::flat_hash_map<int64_t, std::optional<std::pair<SCIP_CONS*, int64_t>>>
175 indicator_constraints_;
176 absl::flat_hash_map<int64_t, std::pair<SCIP_CONS*, AuxiliaryStructureHandler>>
178 absl::flat_hash_map<int64_t, std::pair<SCIP_CONS*, AuxiliaryStructureHandler>>