-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add adequacy patch optimization number to MPS filename to avoid overwrite #1187
Conversation
- Move createOptimizationFilename to class OptPeriodStringGenerator - Remove unused arg from `getFilenameWithExtension` - Remove std::shared_ptr from function arguments
Kudos, SonarCloud Quality Gate passed! |
@@ -45,9 +45,9 @@ AdequacyPatchOptimization::AdequacyPatchOptimization(PROBLEME_HEBDO* problemeHeb | |||
} | |||
void AdequacyPatchOptimization::solve(uint weekInTheYear, int hourInTheYear) | |||
{ | |||
problemeHebdo_->adqPatchParams->AdequacyFirstStep = true; | |||
problemeHebdo_->adequacyPatchRuntimeData->LMR_FirstOptimization = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.
Should conflict with #1189
const std::string filename = createMPSfilename(optPeriodStringGenerator, optimizationNumber); | ||
mpsWriterFactory mps_writer_factory(problemeHebdo->ExportMPS, problemeHebdo->exportMPSOnError, optimizationNumber, &Probleme, ortoolsUsed, solver); | ||
|
||
auto adqPatchOptNumber |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the oral talk we just had, I think that the MPS filename should not be computed here, but at a higher in the call stack.
Here this name should be passed as an argument.
See this comment
@@ -110,16 +111,20 @@ bool OPT_OptimisationLineaire(PROBLEME_HEBDO* problemeHebdo, uint numSpace) | |||
problemeHebdo->year); | |||
|
|||
if (!OPT_AppelDuSimplexe( | |||
problemeHebdo, NumeroDeLIntervalle, optimizationNumber, optPeriodStringGenerator)) | |||
problemeHebdo, NumeroDeLIntervalle, optimizationNumber, *optPeriodStringGenerator)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should have (something like) :
auto mpsFileNames = MPSfileNames(problemeHebdo->OptimisationAuPasHebdomadaire,
NumeroDeLIntervalle,
problemeHebdo->adequacyPatchRuntimeData
problemeHebdo->weekInTheYear,
problemeHebdo->year)
if (!OPT_AppelDuSimplexe(problemeHebdo,
NumeroDeLIntervalle,
optimizationNumber,
mpsFileNames->mps()))
return false;
if (problemeHebdo->ExportMPS ......)
{
...
OPT_EcrireResultatFonctionObjectiveAuFormatTXT(optimalSolutionCost,
mpsFileNames->criterion());
}
This would allow :
- extracting filenames creation from functions that print into these files
- calling getAdqPatchOptmizationNumber(...) only once.
@@ -37,4 +38,8 @@ class OptPeriodStringGenerator | |||
public: | |||
virtual std::string to_string() const = 0; | |||
virtual ~OptPeriodStringGenerator() = default; | |||
std::string createOptimizationFilename(const std::string& title, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Base class OptPeriodStringGenerator is an abstraction for the optimization period, that is either :
- <year>-<week>
- <year>-<week>-<day>
inside the filename.
So why do we have a new createOptimizationFilename function that take many arguments about the whole file name ?
I guess OptPeriodStringGenerator should concern the optimization period only.
if (problemeHebdo->adqPatchParams | ||
&& problemeHebdo->adequacyPatchRuntimeData->LMR_FirstOptimization) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (problemeHebdo->adqPatchParams | |
&& problemeHebdo->adequacyPatchRuntimeData->LMR_FirstOptimization) | |
if (problemeHebdo->adequacyPatchRuntimeData | |
&& problemeHebdo->adequacyPatchRuntimeData->LMR_FirstOptimization) |
No description provided.