diff --git a/src/cpp/lpnamer/problem_modifier/FileWriter.cpp b/src/cpp/lpnamer/problem_modifier/FileWriter.cpp index ee359f9de..e94b7c1f1 100644 --- a/src/cpp/lpnamer/problem_modifier/FileWriter.cpp +++ b/src/cpp/lpnamer/problem_modifier/FileWriter.cpp @@ -6,11 +6,7 @@ #include "antares-xpansion/lpnamer/problem_modifier/LinkProblemsGenerator.h" void FileWriter::Write_problem(Problem *in_prblm, const std::filesystem::path &output_file) { - if (output_file.extension() == ".mps") { - in_prblm->write_prob_mps(output_file); - } else { - in_prblm->save_prob(output_file); - } + in_prblm->save_prob(output_file); } FileWriter::FileWriter(std::filesystem::path lp_dir) diff --git a/src/cpp/lpnamer/problem_modifier/MasterGeneration.cpp b/src/cpp/lpnamer/problem_modifier/MasterGeneration.cpp index b52e9610e..549ce52db 100644 --- a/src/cpp/lpnamer/problem_modifier/MasterGeneration.cpp +++ b/src/cpp/lpnamer/problem_modifier/MasterGeneration.cpp @@ -51,10 +51,10 @@ void MasterGeneration::write_master_mps( master_problem._name = "master"; switch (save_mode_) { case SaveMode::MPS: - master_problem.write_prob_mps(rootPath / "lp" / "master"); + master_problem.write_prob_mps(rootPath / "lp" / "master.mps"); break; case SaveMode::SAVE: - master_problem.save_prob(rootPath / "lp" / "master"); + master_problem.save_prob(rootPath / "lp" / "master.svf"); break; default: throw std::runtime_error("Unknown save mode " + std::to_string(static_cast(save_mode_))); diff --git a/src/cpp/lpnamer/problem_modifier/XpansionProblemsFromAntaresProvider.cpp b/src/cpp/lpnamer/problem_modifier/XpansionProblemsFromAntaresProvider.cpp index 2ad25a053..53757ff32 100644 --- a/src/cpp/lpnamer/problem_modifier/XpansionProblemsFromAntaresProvider.cpp +++ b/src/cpp/lpnamer/problem_modifier/XpansionProblemsFromAntaresProvider.cpp @@ -25,7 +25,6 @@ XpansionProblemsFromAntaresProvider::provideProblems( AntaresProblemToXpansionProblemTranslator::translateToXpansionProblem( antares_hebdo_problems, problem_id.year, problem_id.week, solver_name, solver_log_manager); - problem->_name = std::filesystem::path(problem->_name).replace_extension(".svf"); xpansion_problems.push_back(problem); } return xpansion_problems; diff --git a/src/cpp/multisolver_interface/SolverCbc.cpp b/src/cpp/multisolver_interface/SolverCbc.cpp index 50f1baddc..f4cef4048 100644 --- a/src/cpp/multisolver_interface/SolverCbc.cpp +++ b/src/cpp/multisolver_interface/SolverCbc.cpp @@ -143,8 +143,8 @@ void SolverCbc::write_prob_mps(const std::filesystem::path &filename) { if (filename_to_use.extension() != ".mps") { filename_to_use.replace_extension(".mps"); } - writer.writeMps(filename_to_use.string().c_str(), 0 /*gzip it*/, 1, 1, nullptr, 0, - nullptr); + writer.writeMps(filename_to_use.string().c_str(), 0 /*gzip it*/, 1, 1, + nullptr, 0, nullptr); } void SolverCbc::write_prob_lp(const std::filesystem::path &filename) { @@ -186,8 +186,14 @@ void SolverCbc::setClpSimplexRowNamesFromInnerSolver(ClpSimplex *clps) const { } void SolverCbc::read_prob_mps(const std::filesystem::path &prob_name) { - int status = _clp_inner_solver.readMps(prob_name.string().c_str()); - zero_status_check(status, " read problem "s + prob_name.string(), + auto filename_to_use = prob_name; + if (filename_to_use.extension() != ".mps") { + filename_to_use.replace_extension(".mps"); + } + int status = _clp_inner_solver.readMps(filename_to_use.string().c_str()); + zero_status_check(status, + " read problem "s + prob_name.string() + " , filename : "s + + filename_to_use.string(), LOGLOCATION); defineCbcModelFromInnerSolver(); } diff --git a/src/cpp/multisolver_interface/SolverClp.cpp b/src/cpp/multisolver_interface/SolverClp.cpp index c392b6660..0f84f0c04 100644 --- a/src/cpp/multisolver_interface/SolverClp.cpp +++ b/src/cpp/multisolver_interface/SolverClp.cpp @@ -88,8 +88,12 @@ void SolverClp::write_basis(const std::filesystem::path &filename) { } void SolverClp::read_prob_mps(const std::filesystem::path &filename) { - int status = _clp.readMps(filename.string().c_str(), true, false); - zero_status_check(status, " Clp readMps "s + filename.string(), LOGLOCATION); + auto filename_to_use = filename; + if (filename_to_use.extension() != ".mps") { + filename_to_use.replace_extension(".mps"); + } + int status = _clp.readMps(filename_to_use.string().c_str(), true, false); + zero_status_check(status, " Clp readMps "s + filename_to_use.string(), LOGLOCATION); } void SolverClp::read_prob_lp(const std::filesystem::path &filename) {