From 7c42a0dfbd3972bfe7557399076a5159ae08063d Mon Sep 17 00:00:00 2001 From: Laurent Perron Date: Sat, 22 Jul 2023 11:42:08 -0700 Subject: [PATCH] fix ModelIsSUpported --- .../wrappers/model_builder_helper.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ortools/linear_solver/wrappers/model_builder_helper.cc b/ortools/linear_solver/wrappers/model_builder_helper.cc index 142a8523a58..468697b1bc0 100644 --- a/ortools/linear_solver/wrappers/model_builder_helper.cc +++ b/ortools/linear_solver/wrappers/model_builder_helper.cc @@ -318,7 +318,24 @@ ModelSolverHelper::ModelSolverHelper(const std::string& solver_name) { } bool ModelSolverHelper::SolverIsSupported() const { - return solver_type_.has_value(); + if (!solver_type_.has_value()) return false; + if (solver_type_.value() == MPModelRequest::GLOP_LINEAR_PROGRAMMING) { + return true; + } +#ifdef USE_PDLP + if (solver_type_.value() == MPModelRequest::PDLP_LINEAR_PROGRAMMING) { + return true; + } +#endif // USE_PDLP + if (solver_type_.value() == MPModelRequest::SAT_INTEGER_PROGRAMMING) { + return true; + } +#ifdef USE_SCIP + if (solver_type_.value() == MPModelRequest::SCIP_MIXED_INTEGER_PROGRAMMING) { + return true; + } +#endif // USE_SCIP + return false; } void ModelSolverHelper::Solve(const ModelBuilderHelper& model) {