-
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.
- Loading branch information
Showing
7 changed files
with
81 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,42 @@ | ||
#include "HydroPower.h" | ||
|
||
void HydroPower::add(int pays) | ||
void HydroPower::add(int pays, std::shared_ptr<HydroPowerData> data) | ||
{ | ||
bool presenceHydro | ||
= problemeHebdo->CaracteristiquesHydrauliques[pays].PresenceDHydrauliqueModulable; | ||
bool TurbEntreBornes = problemeHebdo->CaracteristiquesHydrauliques[pays].TurbinageEntreBornes; | ||
|
||
const int NombreDePasDeTempsPourUneOptimisation | ||
= problemeHebdo->NombreDePasDeTempsPourUneOptimisation; | ||
if (presenceHydro && !TurbEntreBornes) | ||
= builder->data->NombreDePasDeTempsPourUneOptimisation; | ||
if (data->presenceHydro && !data->TurbEntreBornes) | ||
{ | ||
if (bool presencePompage | ||
= problemeHebdo->CaracteristiquesHydrauliques[pays].PresenceDePompageModulable) | ||
if (data->presencePompage) | ||
{ | ||
problemeHebdo->NumeroDeContrainteEnergieHydraulique[pays] | ||
= problemeHebdo->ProblemeAResoudre->NombreDeContraintes; | ||
data->NumeroDeContrainteEnergieHydraulique[pays] = builder->data->nombreDeContraintes; | ||
|
||
const double pumpingRatio | ||
= problemeHebdo->CaracteristiquesHydrauliques[pays].PumpingRatio; | ||
const double pumpingRatio = data->pumpingRatio; | ||
for (int pdt = 0; pdt < NombreDePasDeTempsPourUneOptimisation; pdt++) | ||
{ | ||
builder.updateHourWithinWeek(pdt); | ||
builder.include(Variable::HydProd(pays), 1.0) | ||
.include(Variable::Pumping(pays), -pumpingRatio); | ||
builder->updateHourWithinWeek(pdt); | ||
builder->include(NewVariable::HydProd(pays), 1.0) | ||
.include(NewVariable::Pumping(pays), -pumpingRatio); | ||
} | ||
} | ||
else | ||
{ | ||
for (int pdt = 0; pdt < NombreDePasDeTempsPourUneOptimisation; pdt++) | ||
{ | ||
builder.updateHourWithinWeek(pdt); | ||
builder.include(Variable::HydProd(pays), 1.0); | ||
builder->updateHourWithinWeek(pdt); | ||
builder->include(NewVariable::HydProd(pays), 1.0); | ||
} | ||
} | ||
problemeHebdo->NumeroDeContrainteEnergieHydraulique[pays] | ||
= problemeHebdo->ProblemeAResoudre->NombreDeContraintes; | ||
data->NumeroDeContrainteEnergieHydraulique[pays] = builder->data->nombreDeContraintes; | ||
|
||
builder.equalTo(); | ||
builder->equalTo(); | ||
{ | ||
ConstraintNamer namer(problemeHebdo->ProblemeAResoudre->NomDesContraintes, | ||
problemeHebdo->NamedProblems); | ||
namer.UpdateArea(problemeHebdo->NomsDesPays[pays]); | ||
namer.UpdateTimeStep(problemeHebdo->weekInTheYear); | ||
namer.HydroPower(problemeHebdo->ProblemeAResoudre->NombreDeContraintes); | ||
ConstraintNamer namer(builder->data->NomDesContraintes, builder->data->NamedProblems); | ||
namer.UpdateArea(builder->data->NomsDesPays[pays]); | ||
namer.UpdateTimeStep(builder->data->weekInTheYear); | ||
namer.HydroPower(builder->data->nombreDeContraintes); | ||
} | ||
builder.build(); | ||
builder->build(); | ||
} | ||
else | ||
problemeHebdo->NumeroDeContrainteEnergieHydraulique[pays] = -1; | ||
data->NumeroDeContrainteEnergieHydraulique[pays] = -1; | ||
} |
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 |
---|---|---|
@@ -1,9 +1,18 @@ | ||
#pragma once | ||
#include "constraint_builder.h" | ||
#include "new_constraint_builder.h" | ||
struct HydroPowerData | ||
{ | ||
const bool& presenceHydro; | ||
const int& TurbEntreBornes; | ||
const bool& presencePompage; | ||
const int& NombreDePasDeTempsPourUneOptimisation; | ||
std::vector<int>& NumeroDeContrainteEnergieHydraulique; | ||
const double& pumpingRatio; | ||
}; | ||
|
||
class HydroPower : private Constraint | ||
class HydroPower : private NewConstraint | ||
{ | ||
public: | ||
using Constraint::Constraint; | ||
void add(int pays); | ||
using NewConstraint::NewConstraint; | ||
void add(int pays, std::shared_ptr<HydroPowerData> data); | ||
}; |
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,26 @@ | ||
#include "HydroPowerGroup.h" | ||
#include "new_constraint_builder_utils.h" | ||
|
||
std::shared_ptr<HydroPowerData> HydroPowerGroup::GetHydroPowerDataFromProblemHebdo(uint32_t pays) | ||
{ | ||
HydroPowerData data | ||
= {problemeHebdo_->CaracteristiquesHydrauliques[pays].PresenceDHydrauliqueModulable, | ||
problemeHebdo_->CaracteristiquesHydrauliques[pays].TurbinageEntreBornes, | ||
problemeHebdo_->CaracteristiquesHydrauliques[pays].PresenceDePompageModulable, | ||
problemeHebdo_->NombreDePasDeTempsPourUneOptimisation, | ||
problemeHebdo_->NumeroDeContrainteEnergieHydraulique, | ||
problemeHebdo_->CaracteristiquesHydrauliques[pays].PumpingRatio}; | ||
return std::make_shared<HydroPowerData>(data); | ||
} | ||
|
||
void HydroPowerGroup::Build() | ||
{ | ||
std::shared_ptr<NewConstraintBuilder> builder( | ||
NewGetConstraintBuilderFromProblemHebdo(problemeHebdo_)); | ||
HydroPower hydroPower(builder); | ||
|
||
for (uint32_t pays = 0; pays < problemeHebdo_->NombreDePays; pays++) | ||
{ | ||
hydroPower.add(pays, GetHydroPowerDataFromProblemHebdo(pays)); | ||
} | ||
} |
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,15 @@ | ||
#pragma once | ||
#include "ConstraintGroup.h" | ||
#include "HydroPower.h" | ||
|
||
class HydroPowerGroup : public ConstraintGroup | ||
{ | ||
public: | ||
using ConstraintGroup::ConstraintGroup; | ||
|
||
/*TODO Rename this*/ | ||
void Build() override; | ||
|
||
private: | ||
std::shared_ptr<HydroPowerData> GetHydroPowerDataFromProblemHebdo(uint32_t pays); | ||
}; |
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