diff --git a/src/cpp/lpnamer/problem_modifier/MasterGeneration.cpp b/src/cpp/lpnamer/problem_modifier/MasterGeneration.cpp index 31f3478d2..7002b68a2 100644 --- a/src/cpp/lpnamer/problem_modifier/MasterGeneration.cpp +++ b/src/cpp/lpnamer/problem_modifier/MasterGeneration.cpp @@ -59,14 +59,7 @@ std::filesystem::path FileNameForStructureFile(const std::string& problemName, const std::string save_ext = ".svf"; const std::string default_ext = ".mps"; if (problemName == "master") return {"master"}; - SolverConfig solverConfig(std::move(solverName)); - std::filesystem::path path{problemName}; - if (solverConfig.use_save_restore) { - path.replace_extension(save_ext); - } else { - path.replace_extension(default_ext); - } - return path; + return SolverConfig::FileName(problemName, SolverConfig(std::move(solverName))); } void MasterGeneration::write_structure_file( diff --git a/src/cpp/multisolver_interface/SolverConfig.cpp b/src/cpp/multisolver_interface/SolverConfig.cpp index 53077fc7c..9c7bd794e 100644 --- a/src/cpp/multisolver_interface/SolverConfig.cpp +++ b/src/cpp/multisolver_interface/SolverConfig.cpp @@ -30,3 +30,16 @@ void SolverConfig::init(std::string solver_name) { save_restore_supported = save_restore_support.at(name); use_save_restore = save_restore_supported; } + +std::filesystem::path SolverConfig::FileName(const std::string& problemName, + const SolverConfig& solverName) { + const std::string save_ext = ".svf"; + const std::string default_ext = ".mps"; + std::filesystem::path path{problemName}; + if (solverName.use_save_restore) { + path.replace_extension(save_ext); + } else { + path.replace_extension(default_ext); + } + return path; +} diff --git a/src/cpp/multisolver_interface/include/antares-xpansion/multisolver_interface/SolverConfig.h b/src/cpp/multisolver_interface/include/antares-xpansion/multisolver_interface/SolverConfig.h index 6794e1f34..c72b4ae64 100644 --- a/src/cpp/multisolver_interface/include/antares-xpansion/multisolver_interface/SolverConfig.h +++ b/src/cpp/multisolver_interface/include/antares-xpansion/multisolver_interface/SolverConfig.h @@ -25,4 +25,6 @@ class SolverConfig { ~SolverConfig() = default; bool operator==(const std::string& rhs) const; SolverConfig& operator=(const std::string& rhs); + static std::filesystem::path FileName(const std::string& problemName, + const SolverConfig& solverName); }; \ No newline at end of file