Skip to content

Commit

Permalink
Move function
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonMarechal25 committed Jan 16, 2025
1 parent 3ec2ca6 commit d2733dd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
9 changes: 1 addition & 8 deletions src/cpp/lpnamer/problem_modifier/MasterGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 13 additions & 0 deletions src/cpp/multisolver_interface/SolverConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

0 comments on commit d2733dd

Please sign in to comment.