-
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
137 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,92 @@ | ||
#include "BindingConstraintDay.h" | ||
|
||
void BindingConstraintDay::add(int cntCouplante) | ||
void BindingConstraintDay::add(int cntCouplante, std::shared_ptr<BindingConstraintDayData> data) | ||
{ | ||
const CONTRAINTES_COUPLANTES& MatriceDesContraintesCouplantes | ||
= problemeHebdo->MatriceDesContraintesCouplantes[cntCouplante]; | ||
if (MatriceDesContraintesCouplantes.TypeDeContrainteCouplante != CONTRAINTE_JOURNALIERE) | ||
if (data->TypeDeContrainteCouplante != CONTRAINTE_JOURNALIERE) | ||
return; | ||
|
||
const int nbInterco | ||
= MatriceDesContraintesCouplantes.NombreDInterconnexionsDansLaContrainteCouplante; | ||
const int nbClusters | ||
= MatriceDesContraintesCouplantes.NombreDePaliersDispatchDansLaContrainteCouplante; | ||
const int nbInterco = data->NombreDInterconnexionsDansLaContrainteCouplante; | ||
const int nbClusters = data->NombreDePaliersDispatchDansLaContrainteCouplante; | ||
|
||
const int NombreDePasDeTempsPourUneOptimisation | ||
= problemeHebdo->NombreDePasDeTempsPourUneOptimisation; // TODO | ||
const int NombreDePasDeTempsDUneJournee = problemeHebdo->NombreDePasDeTempsDUneJournee; | ||
= builder->data->NombreDePasDeTempsPourUneOptimisation; // TODO | ||
const int NombreDePasDeTempsDUneJournee = data->NombreDePasDeTempsDUneJournee; | ||
int pdtDebut = 0; | ||
while (pdtDebut < NombreDePasDeTempsPourUneOptimisation) | ||
{ | ||
int jour = problemeHebdo->NumeroDeJourDuPasDeTemps[pdtDebut]; | ||
CORRESPONDANCES_DES_CONTRAINTES_JOURNALIERES& CorrespondanceCntNativesCntOptimJournalieres | ||
= problemeHebdo->CorrespondanceCntNativesCntOptimJournalieres[jour]; | ||
int jour = data->NumeroDeJourDuPasDeTemps[pdtDebut]; | ||
|
||
for (int index = 0; index < nbInterco; index++) | ||
{ | ||
int interco = MatriceDesContraintesCouplantes.NumeroDeLInterconnexion[index]; | ||
double poids = MatriceDesContraintesCouplantes.PoidsDeLInterconnexion[index]; | ||
int offset = MatriceDesContraintesCouplantes.OffsetTemporelSurLInterco[index]; | ||
int interco = data->NumeroDeLInterconnexion[index]; | ||
double poids = data->PoidsDeLInterconnexion[index]; | ||
int offset = data->OffsetTemporelSurLInterco[index]; | ||
|
||
for (int pdt = pdtDebut; pdt < pdtDebut + NombreDePasDeTempsDUneJournee; pdt++) | ||
{ | ||
builder.updateHourWithinWeek(pdt).include(Variable::NTCDirect(interco), | ||
poids, | ||
offset, | ||
true, | ||
problemeHebdo->NombreDePasDeTemps); | ||
int pdt1; | ||
if (offset >= 0) | ||
{ | ||
pdt1 = (pdt + offset) % builder->data->NombreDePasDeTempsPourUneOptimisation; | ||
} | ||
else | ||
{ | ||
pdt1 = (pdt + offset + builder->data->NombreDePasDeTemps) | ||
% builder->data->NombreDePasDeTempsPourUneOptimisation; | ||
} | ||
builder->updateHourWithinWeek(pdt1).include(NewVariable::NTCDirect(interco), | ||
poids, | ||
0, | ||
false, | ||
builder->data->NombreDePasDeTemps); | ||
} | ||
} | ||
|
||
for (int index = 0; index < nbClusters; index++) | ||
{ | ||
int pays = MatriceDesContraintesCouplantes.PaysDuPalierDispatch[index]; | ||
const PALIERS_THERMIQUES& PaliersThermiquesDuPays | ||
= problemeHebdo->PaliersThermiquesDuPays[pays]; | ||
int pays = data->PaysDuPalierDispatch[index]; | ||
const PALIERS_THERMIQUES& PaliersThermiquesDuPays = data->PaliersThermiquesDuPays[pays]; | ||
const int palier | ||
= PaliersThermiquesDuPays.NumeroDuPalierDansLEnsembleDesPaliersThermiques | ||
[MatriceDesContraintesCouplantes.NumeroDuPalierDispatch[index]]; | ||
double poids = MatriceDesContraintesCouplantes.PoidsDuPalierDispatch[index]; | ||
int offset = MatriceDesContraintesCouplantes.OffsetTemporelSurLePalierDispatch[index]; | ||
[data->NumeroDuPalierDispatch[index]]; | ||
double poids = data->PoidsDuPalierDispatch[index]; | ||
int offset = data->OffsetTemporelSurLePalierDispatch[index]; | ||
|
||
for (int pdt = pdtDebut; pdt < pdtDebut + NombreDePasDeTempsDUneJournee; pdt++) | ||
{ | ||
builder.updateHourWithinWeek(pdt).include(Variable::DispatchableProduction(palier), | ||
poids, | ||
offset, | ||
true, | ||
problemeHebdo->NombreDePasDeTemps); | ||
int pdt1; | ||
if (offset >= 0) | ||
{ | ||
pdt1 = (pdt + offset) % builder->data->NombreDePasDeTempsPourUneOptimisation; | ||
} | ||
else | ||
{ | ||
pdt1 = (pdt + offset + builder->data->NombreDePasDeTemps) | ||
% builder->data->NombreDePasDeTempsPourUneOptimisation; | ||
} | ||
|
||
builder->updateHourWithinWeek(pdt1).include( | ||
NewVariable::DispatchableProduction(palier), | ||
poids, | ||
0, | ||
false, | ||
builder->data->NombreDePasDeTemps); | ||
} | ||
} | ||
|
||
CorrespondanceCntNativesCntOptimJournalieres | ||
data->CorrespondanceCntNativesCntOptimJournalieres[jour] | ||
.NumeroDeContrainteDesContraintesCouplantes[cntCouplante] | ||
= problemeHebdo->ProblemeAResoudre->NombreDeContraintes; | ||
|
||
std::vector<double*>& AdresseOuPlacerLaValeurDesCoutsMarginaux | ||
= problemeHebdo->ProblemeAResoudre->AdresseOuPlacerLaValeurDesCoutsMarginaux; | ||
= builder->data->nombreDeContraintes; | ||
|
||
char op = MatriceDesContraintesCouplantes.SensDeLaContrainteCouplante; | ||
builder.SetOperator(op); | ||
char op = data->SensDeLaContrainteCouplante; | ||
builder->operatorRHS(op); | ||
{ | ||
ConstraintNamer namer(problemeHebdo->ProblemeAResoudre->NomDesContraintes, | ||
problemeHebdo->NamedProblems); | ||
ConstraintNamer namer(builder->data->NomDesContraintes, builder->data->NamedProblems); | ||
namer.UpdateTimeStep(jour); | ||
namer.BindingConstraintDay(problemeHebdo->ProblemeAResoudre->NombreDeContraintes, | ||
MatriceDesContraintesCouplantes.NomDeLaContrainteCouplante); | ||
namer.BindingConstraintDay(builder->data->nombreDeContraintes, | ||
data->NomDeLaContrainteCouplante); | ||
} | ||
builder.build(); | ||
pdtDebut += problemeHebdo->NombreDePasDeTempsDUneJournee; | ||
builder->build(); | ||
pdtDebut += data->NombreDePasDeTempsDUneJournee; | ||
} | ||
} |
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,19 @@ | ||
#pragma once | ||
#include "constraint_builder.h" | ||
#include "new_constraint_builder.h" | ||
|
||
class BindingConstraintDay : private Constraint | ||
struct BindingConstraintDayData : public BindingConstraintData | ||
{ | ||
std::vector<CORRESPONDANCES_DES_CONTRAINTES_JOURNALIERES>& | ||
CorrespondanceCntNativesCntOptimJournalieres; | ||
|
||
const int32_t& NombreDePasDeTempsDUneJournee; | ||
|
||
std::vector<int32_t>& NumeroDeJourDuPasDeTemps; | ||
}; | ||
|
||
class BindingConstraintDay : private NewConstraint | ||
{ | ||
public: | ||
using Constraint::Constraint; | ||
void add(int cntCouplante); | ||
using NewConstraint::NewConstraint; | ||
void add(int cntCouplante, std::shared_ptr<BindingConstraintDayData> 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,42 @@ | ||
#include "BindingConstraintDayGroup.h" | ||
#include "new_constraint_builder_utils.h" | ||
|
||
std::shared_ptr<BindingConstraintDayData> | ||
BindingConstraintDayGroup::GetBindingConstraintDayDataFromProblemHebdo(int cntCouplante) | ||
{ | ||
const CONTRAINTES_COUPLANTES& MatriceDesContraintesCouplantes | ||
= problemeHebdo_->MatriceDesContraintesCouplantes[cntCouplante]; | ||
|
||
BindingConstraintDayData data | ||
= {MatriceDesContraintesCouplantes.TypeDeContrainteCouplante, | ||
MatriceDesContraintesCouplantes.NombreDInterconnexionsDansLaContrainteCouplante, | ||
MatriceDesContraintesCouplantes.NumeroDeLInterconnexion, | ||
MatriceDesContraintesCouplantes.PoidsDeLInterconnexion, | ||
MatriceDesContraintesCouplantes.OffsetTemporelSurLInterco, | ||
MatriceDesContraintesCouplantes.NombreDePaliersDispatchDansLaContrainteCouplante, | ||
MatriceDesContraintesCouplantes.PaysDuPalierDispatch, | ||
MatriceDesContraintesCouplantes.NumeroDuPalierDispatch, | ||
MatriceDesContraintesCouplantes.PoidsDuPalierDispatch, | ||
MatriceDesContraintesCouplantes.OffsetTemporelSurLePalierDispatch, | ||
MatriceDesContraintesCouplantes.SensDeLaContrainteCouplante, | ||
MatriceDesContraintesCouplantes.NomDeLaContrainteCouplante, | ||
problemeHebdo_->PaliersThermiquesDuPays, | ||
problemeHebdo_->CorrespondanceCntNativesCntOptimJournalieres, | ||
problemeHebdo_->NombreDePasDeTempsDUneJournee, | ||
problemeHebdo_->NumeroDeJourDuPasDeTemps}; | ||
|
||
return std::make_shared<BindingConstraintDayData>(data); | ||
} | ||
void BindingConstraintDayGroup::Build() | ||
{ | ||
std::shared_ptr<NewConstraintBuilder> builder( | ||
NewGetConstraintBuilderFromProblemHebdo(problemeHebdo_)); | ||
|
||
BindingConstraintDay bindingConstraintDay(builder); | ||
for (uint32_t cntCouplante = 0; cntCouplante < problemeHebdo_->NombreDeContraintesCouplantes; | ||
cntCouplante++) | ||
{ | ||
bindingConstraintDay.add(cntCouplante, | ||
GetBindingConstraintDayDataFromProblemHebdo(cntCouplante)); | ||
} | ||
} |
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,16 @@ | ||
#pragma once | ||
#include "ConstraintGroup.h" | ||
#include "BindingConstraintDay.h" | ||
|
||
class BindingConstraintDayGroup : public ConstraintGroup | ||
{ | ||
public: | ||
using ConstraintGroup::ConstraintGroup; | ||
|
||
/*TODO Rename this*/ | ||
void Build() override; | ||
|
||
private: | ||
std::shared_ptr<BindingConstraintDayData> GetBindingConstraintDayDataFromProblemHebdo( | ||
int cntCouplante); | ||
}; |
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