Skip to content

Commit

Permalink
move unrelated jobs from LinearProblemMatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Dec 15, 2023
1 parent f2ed940 commit 8462829
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
10 changes: 0 additions & 10 deletions src/solver/optimisation/LinearProblemMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@
using namespace Antares::Data;

LinearProblemMatrix::LinearProblemMatrix(PROBLEME_HEBDO* problemeHebdo,
Solver::IResultWriter& writer,
ConstraintBuilder& builder) :
ProblemMatrixEssential(problemeHebdo),
builder_(builder),
writer_(writer),
group1_(problemeHebdo, builder),
bindingConstraintDayGroup_(problemeHebdo, builder),
bindingConstraintWeekGroup_(problemeHebdo, builder),
Expand All @@ -59,14 +57,6 @@ LinearProblemMatrix::LinearProblemMatrix(PROBLEME_HEBDO* problemeHebdo,
&areaHydroLevelGroup_,
&finalStockGroup_};
}
void LinearProblemMatrix::ExportStructures()
{
if (problemeHebdo_->ExportStructure && problemeHebdo_->firstWeekOfSimulation)
{
OPT_ExportInterco(writer_, problemeHebdo_);
OPT_ExportAreaName(writer_, problemeHebdo_->NomsDesPays);
}
}

void LinearProblemMatrix::Run()
{
Expand Down
6 changes: 1 addition & 5 deletions src/solver/optimisation/LinearProblemMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,11 @@ using namespace Antares::Data;
class LinearProblemMatrix : public ProblemMatrixEssential
{
public:
explicit LinearProblemMatrix(PROBLEME_HEBDO* problemeHebdo,
Solver::IResultWriter& writer,
ConstraintBuilder& builder);
explicit LinearProblemMatrix(PROBLEME_HEBDO* problemeHebdo, ConstraintBuilder& builder);

void Run() override;
void ExportStructures();

private:
Solver::IResultWriter& writer_;
ConstraintBuilder& builder_;
Group1 group1_;
BindingConstraintDayGroup bindingConstraintDayGroup_;
Expand Down
6 changes: 6 additions & 0 deletions src/solver/optimisation/opt_export_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,9 @@ void OPT_ExportAreaName(Antares::Solver::IResultWriter& writer,
}
writer.addEntryFromBuffer(filename, Flot);
}

void OPT_ExportStructures(PROBLEME_HEBDO* problemeHebdo, Antares::Solver::IResultWriter& writer)
{
OPT_ExportInterco(writer, problemeHebdo);
OPT_ExportAreaName(writer, problemeHebdo->NomsDesPays);
}
1 change: 1 addition & 0 deletions src/solver/optimisation/opt_export_structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ void OPT_ExportInterco(Antares::Solver::IResultWriter& writer,
PROBLEME_HEBDO* problemeHebdo);
void OPT_ExportAreaName(Antares::Solver::IResultWriter& writer,
const std::vector<const char*>& areaNames);
void OPT_ExportStructures(PROBLEME_HEBDO* problemeHebdo, Antares::Solver::IResultWriter& writer);

#endif
5 changes: 3 additions & 2 deletions src/solver/optimisation/opt_optimisation_lineaire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "sim_structure_probleme_economique.h"
#include "opt_fonctions.h"
#include "opt_export_structure.h"

#include <antares/logs/logs.h>
#include "antares/solver/utils/filename.h"
Expand Down Expand Up @@ -160,9 +161,9 @@ bool OPT_OptimisationLineaire(const OptimizationOptions& options,

auto builder_data = NewGetConstraintBuilderFromProblemHebdo(problemeHebdo);
ConstraintBuilder builder(builder_data);
LinearProblemMatrix linearProblemMatrix(problemeHebdo, writer, builder);
LinearProblemMatrix linearProblemMatrix(problemeHebdo, builder);
linearProblemMatrix.Run();
linearProblemMatrix.ExportStructures();
OPT_ExportStructures(problemeHebdo, writer);

bool ret = runWeeklyOptimization(
options, problemeHebdo, adqPatchParams, writer, PREMIERE_OPTIMISATION);
Expand Down

0 comments on commit 8462829

Please sign in to comment.