From d750959d135ee3b53fc2394e9c21773182dbd551 Mon Sep 17 00:00:00 2001 From: Andrea Sgattoni <andrea.sgattoni@rte-france.com> Date: Mon, 13 Nov 2023 15:29:08 +0100 Subject: [PATCH] remove MPSWriteError --- ortools/linear_solver/BUILD.bazel | 1 - ortools/linear_solver/MPSWriteError.h | 25 ----------------------- ortools/linear_solver/linear_solver.h | 2 +- ortools/linear_solver/xpress_interface.cc | 4 +--- 4 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 ortools/linear_solver/MPSWriteError.h diff --git a/ortools/linear_solver/BUILD.bazel b/ortools/linear_solver/BUILD.bazel index 3bffe2aae6c..9bf36205b6c 100644 --- a/ortools/linear_solver/BUILD.bazel +++ b/ortools/linear_solver/BUILD.bazel @@ -204,7 +204,6 @@ cc_library( "linear_solver_callback.h", "scip_callback.h", "scip_helper_macros.h", - "MPSWriteError.h", ] + select({ ":use_glop": ["glop_utils.h"], "//conditions:default": [], diff --git a/ortools/linear_solver/MPSWriteError.h b/ortools/linear_solver/MPSWriteError.h deleted file mode 100644 index 9fc0e2ca4dc..00000000000 --- a/ortools/linear_solver/MPSWriteError.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2023 RTE -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Initial version of this code was provided by RTE - -#ifndef ORTOOLS_MPSWRITEERROR_H -#define ORTOOLS_MPSWRITEERROR_H -#include <stdexcept> -namespace operations_research { -class MPSWriteError : public std::runtime_error { - public: - MPSWriteError(const std::string& message) : std::runtime_error(message) {} -}; -} // namespace operations_research -#endif // ORTOOLS_MPSWRITEERROR_H diff --git a/ortools/linear_solver/linear_solver.h b/ortools/linear_solver/linear_solver.h index a7157e8d963..edcc49ee61e 100644 --- a/ortools/linear_solver/linear_solver.h +++ b/ortools/linear_solver/linear_solver.h @@ -1663,7 +1663,7 @@ class MPSolverInterface { } // Writes the model using the solver internal write function. Currently only - // available for GurobiInterface. + // available for GurobiInterface and XpressInterface. virtual void Write(const std::string& filename); // ----- Model modifications and extraction ----- diff --git a/ortools/linear_solver/xpress_interface.cc b/ortools/linear_solver/xpress_interface.cc index d129355f63a..c28cab27fdf 100644 --- a/ortools/linear_solver/xpress_interface.cc +++ b/ortools/linear_solver/xpress_interface.cc @@ -25,8 +25,6 @@ #include "absl/strings/str_format.h" #include "ortools/base/logging.h" #include "ortools/base/timer.h" -#include "ortools/base/types.h" -#include "ortools/linear_solver/MPSWriteError.h" #include "ortools/linear_solver/linear_solver.h" #include "ortools/xpress/environment.h" @@ -2093,7 +2091,7 @@ void XpressInterface::Write(const std::string& filename) { VLOG(1) << "Writing Xpress MPS \"" << filename << "\"."; const int status = XPRSwriteprob(mLp, filename.c_str(), ""); if (status) { - throw MPSWriteError("Failed to write MPS."); + LOG(ERROR) << "Xpress: Failed to write MPS! "; } }