-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modeler 1.1c: Scenarize problem filler [ANT-2003] (#2445)
- Loading branch information
Showing
8 changed files
with
170 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/tests/src/solver/modeler/api/mock-fillers/FillerContext.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
|
||
#include "antares/solver/modeler/api/linearProblemFiller.h" | ||
|
||
namespace Antares::Solver::Modeler::Api | ||
{ | ||
|
||
class VarFillerContext: public LinearProblemFiller | ||
{ | ||
public: | ||
explicit VarFillerContext() = default; | ||
void addVariables(ILinearProblem& pb, LinearProblemData& data, FillContext& ctx) override; | ||
void addConstraints(ILinearProblem& pb, LinearProblemData& data, FillContext& ctx) override; | ||
void addObjective(ILinearProblem& pb, LinearProblemData& data, FillContext& ctx) override; | ||
|
||
std::array<std::array<int, 3>, 5> timeseries = { | ||
{{1, 3, 5}, {2, 4, 6}, {7, 9, 11}, {8, 10, 12}, {13, 15, 17}}}; | ||
}; | ||
|
||
void VarFillerContext::addVariables(ILinearProblem& pb, | ||
[[maybe_unused]] LinearProblemData& data, | ||
[[maybe_unused]] FillContext& ctx) | ||
{ | ||
for (unsigned timestep = ctx.getFirstTimeStep(); timestep < ctx.getLastTimeStep(); timestep++) | ||
{ | ||
for (unsigned scenario: ctx.scenariosSelected) | ||
{ | ||
pb.addNumVariable(timeseries[timestep][scenario], | ||
timeseries[timestep][scenario], | ||
"variable-ts" + std::to_string(timestep) + "-sc" | ||
+ std::to_string(scenario)); | ||
} | ||
} | ||
} | ||
|
||
void VarFillerContext::addConstraints([[maybe_unused]] ILinearProblem& pb, | ||
[[maybe_unused]] LinearProblemData& data, | ||
[[maybe_unused]] FillContext& ctx) | ||
{ | ||
} | ||
|
||
void VarFillerContext::addObjective([[maybe_unused]] ILinearProblem& pb, | ||
[[maybe_unused]] LinearProblemData& data, | ||
[[maybe_unused]] FillContext& ctx) | ||
{ | ||
} | ||
|
||
} // namespace Antares::Solver::Modeler::Api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters