-
Notifications
You must be signed in to change notification settings - Fork 28
refactor constraint construction #1627
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
Changes from 171 commits
433b799
bca6733
adbd363
79136ac
60ea81c
e4298f9
c96df9c
1af5ead
1d33989
3f9f115
7b2406e
3b0c0d5
bcc63e7
a2de6d7
b7b022c
317bdb5
fcef054
2364b35
507e355
854ca38
3029f79
78dab46
22862bd
afd0808
89584b0
d7e197d
a956ab9
34e9559
c81b801
1e65059
692a8a8
7f8054d
5a047c0
bd394e3
676c0a4
1a29e44
fa422d6
cee5edb
a44c65e
687d879
9433f0a
ee2c51f
7364bd5
f01decd
5932373
3c16029
3622cfb
84b7e0e
a653ada
8ed7085
688b36d
9b6de6c
8256c26
ea87d43
1321445
bb5e1b6
b3b9c1f
b2a2988
065632a
496c1bb
6533cab
086f72a
03c246a
f2e6166
0c9a8ca
fced3d6
ae4b0e0
eb0d6e8
3651700
0d1e4bc
5cfa55c
7377886
76d4039
fce50aa
a5fb74d
9f5bccf
65ee688
932d5c9
6d5bef6
f308c96
63b3040
0cc3d45
62241f8
958ae3a
2e6352e
8ea67a8
cbc4059
d42fcca
09760f3
1c62402
4a17f03
312a3a5
b599a35
5efb48c
87ba06a
0947de7
1f7eddb
985d063
d270e8c
4a30f57
f867b95
62add4f
bd9a530
5aadd06
1a37a86
6aa9d35
737b87c
cc5b442
7d22d33
b74118a
a55cd5c
921b322
690349c
a90e7bd
47c92f1
31077ac
34f0aef
7df7f6e
473ee98
293e87d
5d05312
f00844d
039e180
1514cec
d632bf3
7e49fe6
6154e44
599e749
0ed0bee
072ca6e
e98d6f6
7de521b
ec4772b
dde5d3e
84826d5
f267c9a
2922556
0079281
68ba741
59c0993
ca3f587
c70a3a0
109b725
c4cc825
30c8257
389cec5
e885483
6d2dcd0
d385be6
6a463a0
4f07212
fcc3a71
8d84c8e
4fd81f8
b1d4871
53b72d8
26449a2
0f39ad4
41bf732
65fb1fa
16e9f0e
924b649
fc1ccd3
8a6887c
2c17e51
213463d
c665732
7908b15
61a1c1d
28c7eb1
8bbd2e9
c469974
912e3d3
4212098
a53474a
f2ed940
8462829
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
** Copyright 2007-2023 RTE | ||
** Authors: Antares_Simulator Team | ||
** | ||
** This file is part of Antares_Simulator. | ||
** | ||
** Antares_Simulator is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 3 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** There are special exceptions to the terms and conditions of the | ||
** license as they are applied to this software. View the full text of | ||
** the exceptions in file COPYING.txt in the directory of this software | ||
** distribution | ||
** | ||
** Antares_Simulator is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
** GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with Antares_Simulator. If not, see <http://www.gnu.org/licenses/>. | ||
** | ||
** SPDX-License-Identifier: licenceRef-GPL3_WITH_RTE-Exceptions | ||
*/ | ||
|
||
#include "LinearProblemMatrix.h" | ||
#include "opt_export_structure.h" | ||
#include "../utils/filename.h" | ||
#include "opt_fonctions.h" | ||
#include "LinearProblemMatrixStartUpCosts.h" | ||
|
||
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), | ||
hydroPowerGroup_(problemeHebdo, builder), | ||
hydraulicSmoothingGroup_(problemeHebdo, builder), | ||
minMaxHydroPowerGroup_(problemeHebdo, builder), | ||
maxPumpingGroup_(problemeHebdo, builder), | ||
areaHydroLevelGroup_(problemeHebdo, builder), | ||
finalStockGroup_(problemeHebdo, builder) | ||
{ | ||
constraintgroups_ = {&group1_, | ||
&bindingConstraintDayGroup_, | ||
&bindingConstraintWeekGroup_, | ||
&hydroPowerGroup_, | ||
&hydraulicSmoothingGroup_, | ||
&minMaxHydroPowerGroup_, | ||
&maxPumpingGroup_, | ||
&areaHydroLevelGroup_, | ||
&finalStockGroup_}; | ||
} | ||
void LinearProblemMatrix::ExportStructures() | ||
flomnes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
if (problemeHebdo_->ExportStructure && problemeHebdo_->firstWeekOfSimulation) | ||
{ | ||
OPT_ExportInterco(writer_, problemeHebdo_); | ||
OPT_ExportAreaName(writer_, problemeHebdo_->NomsDesPays); | ||
} | ||
} | ||
|
||
void LinearProblemMatrix::Run() | ||
a-zakir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
InitiliazeProblemAResoudreCounters(); | ||
a-zakir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ProblemMatrixEssential::Run(); | ||
a-zakir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (problemeHebdo_->OptimisationAvecCoutsDeDemarrage) | ||
{ | ||
LinearProblemMatrixStartUpCosts(problemeHebdo_, false, builder_).Run(); | ||
} | ||
|
||
return; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
** Copyright 2007-2023 RTE | ||
** Authors: Antares_Simulator Team | ||
** | ||
** This file is part of Antares_Simulator. | ||
** | ||
** Antares_Simulator is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 3 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** There are special exceptions to the terms and conditions of the | ||
** license as they are applied to this software. View the full text of | ||
** the exceptions in file COPYING.txt in the directory of this software | ||
** distribution | ||
** | ||
** Antares_Simulator is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
** GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with Antares_Simulator. If not, see <http://www.gnu.org/licenses/>. | ||
** | ||
** SPDX-License-Identifier: licenceRef-GPL3_WITH_RTE-Exceptions | ||
*/ | ||
#pragma once | ||
#include "opt_structure_probleme_a_resoudre.h" | ||
#include "sim_structure_probleme_economique.h" | ||
#include "ProblemMatrixEssential.h" | ||
#include "constraints/ConstraintGroup.h" | ||
#include "constraints/Group1.h" | ||
#include "constraints/BindingConstraintDayGroup.h" | ||
#include "constraints/BindingConstraintWeekGroup.h" | ||
#include "constraints/HydroPowerGroup.h" | ||
#include "constraints/HydraulicSmoothingGroup.h" | ||
#include "constraints/MinMaxHydroPowerGroup.h" | ||
#include "constraints/MaxPumpingGroup.h" | ||
#include "constraints/AreaHydroLevelGroup.h" | ||
#include "constraints/FinalStockGroup.h" | ||
|
||
#include <antares/study/study.h> | ||
|
||
using namespace Antares::Data; | ||
class LinearProblemMatrix : public ProblemMatrixEssential | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should call this class LP_ConstraintGroupList (see review of ProblemMatrixEssential.h) |
||
{ | ||
public: | ||
explicit LinearProblemMatrix(PROBLEME_HEBDO* problemeHebdo, | ||
Solver::IResultWriter& writer, | ||
ConstraintBuilder& builder); | ||
|
||
void Run() override; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a consequence of ProblemMatrixEssential.h's review, we don't need run() here. |
||
void ExportStructures(); | ||
|
||
private: | ||
Solver::IResultWriter& writer_; | ||
a-zakir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ConstraintBuilder& builder_; | ||
Group1 group1_; | ||
a-zakir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
BindingConstraintDayGroup bindingConstraintDayGroup_; | ||
BindingConstraintWeekGroup bindingConstraintWeekGroup_; | ||
HydroPowerGroup hydroPowerGroup_; | ||
HydraulicSmoothingGroup hydraulicSmoothingGroup_; | ||
MinMaxHydroPowerGroup minMaxHydroPowerGroup_; | ||
MaxPumpingGroup maxPumpingGroup_; | ||
AreaHydroLevelGroup areaHydroLevelGroup_; | ||
FinalStockGroup finalStockGroup_; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
** Copyright 2007-2023 RTE | ||
** Authors: Antares_Simulator Team | ||
** | ||
** This file is part of Antares_Simulator. | ||
** | ||
** Antares_Simulator is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 3 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** There are special exceptions to the terms and conditions of the | ||
** license as they are applied to this software. View the full text of | ||
** the exceptions in file COPYING.txt in the directory of this software | ||
** distribution | ||
** | ||
** Antares_Simulator is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
** GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with Antares_Simulator. If not, see <http://www.gnu.org/licenses/>. | ||
** | ||
** SPDX-License-Identifier: licenceRef-GPL3_WITH_RTE-Exceptions | ||
*/ | ||
#pragma once | ||
#include "LinearProblemMatrixStartUpCosts.h" | ||
using namespace Antares::Data; | ||
|
||
LinearProblemMatrixStartUpCosts::LinearProblemMatrixStartUpCosts(PROBLEME_HEBDO* problemeHebdo, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the review of the associated header file and remove this class. |
||
bool Simulation, | ||
ConstraintBuilder& builder) : | ||
ProblemMatrixEssential(problemeHebdo), | ||
simulation_(Simulation), | ||
pMinMaxDispatchableGenerationGroup_(problemeHebdo, simulation_, builder), | ||
consistenceNumberOfDispatchableUnitsGroup_(problemeHebdo, simulation_, builder), | ||
nbUnitsOutageLessThanNbUnitsStopGroup_(problemeHebdo, simulation_, builder), | ||
nbDispUnitsMinBoundSinceMinUpTimeGroup_(problemeHebdo, simulation_, builder), | ||
minDownTimeGroup_(problemeHebdo, simulation_, builder) | ||
{ | ||
constraintgroups_ = {&pMinMaxDispatchableGenerationGroup_, | ||
&consistenceNumberOfDispatchableUnitsGroup_, | ||
&nbUnitsOutageLessThanNbUnitsStopGroup_, | ||
&nbDispUnitsMinBoundSinceMinUpTimeGroup_, | ||
&minDownTimeGroup_}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
** Copyright 2007-2023 RTE | ||
** Authors: Antares_Simulator Team | ||
** | ||
** This file is part of Antares_Simulator. | ||
** | ||
** Antares_Simulator is free software: you can redistribute it and/or modify | ||
** it under the terms of the GNU General Public License as published by | ||
** the Free Software Foundation, either version 3 of the License, or | ||
** (at your option) any later version. | ||
** | ||
** There are special exceptions to the terms and conditions of the | ||
** license as they are applied to this software. View the full text of | ||
** the exceptions in file COPYING.txt in the directory of this software | ||
** distribution | ||
** | ||
** Antares_Simulator is distributed in the hope that it will be useful, | ||
** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
** GNU General Public License for more details. | ||
** | ||
** You should have received a copy of the GNU General Public License | ||
** along with Antares_Simulator. If not, see <http://www.gnu.org/licenses/>. | ||
** | ||
** SPDX-License-Identifier: licenceRef-GPL3_WITH_RTE-Exceptions | ||
*/ | ||
#pragma once | ||
#include "opt_structure_probleme_a_resoudre.h" | ||
#include "sim_structure_probleme_economique.h" | ||
#include "constraints/ConstraintGroup.h" | ||
#include "ProblemMatrixEssential.h" | ||
#include "opt_structure_probleme_a_resoudre.h" | ||
|
||
#include "constraints/PMinMaxDispatchableGenerationGroup.h" | ||
#include "constraints/ConsistenceNumberOfDispatchableUnitsGroup.h" | ||
#include "constraints/NbUnitsOutageLessThanNbUnitsStopGroup.h" | ||
#include "constraints/NbDispUnitsMinBoundSinceMinUpTimeGroup.h" | ||
#include "constraints/MinDownTimeGroup.h" | ||
|
||
#include <antares/study/study.h> | ||
|
||
using namespace Antares::Data; | ||
|
||
class LinearProblemMatrixStartUpCosts : public ProblemMatrixEssential | ||
a-zakir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
public: | ||
explicit LinearProblemMatrixStartUpCosts(PROBLEME_HEBDO* problemeHebdo, | ||
bool Simulation, | ||
ConstraintBuilder& builder); | ||
|
||
private: | ||
bool simulation_ = false; | ||
PMinMaxDispatchableGenerationGroup pMinMaxDispatchableGenerationGroup_; | ||
ConsistenceNumberOfDispatchableUnitsGroup consistenceNumberOfDispatchableUnitsGroup_; | ||
NbUnitsOutageLessThanNbUnitsStopGroup nbUnitsOutageLessThanNbUnitsStopGroup_; | ||
NbDispUnitsMinBoundSinceMinUpTimeGroup nbDispUnitsMinBoundSinceMinUpTimeGroup_; | ||
MinDownTimeGroup minDownTimeGroup_; | ||
}; |
Uh oh!
There was an error while loading. Please reload this page.