-
Notifications
You must be signed in to change notification settings - Fork 25
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
refactor constraint construction #1627
Merged
Merged
Changes from 60 commits
Commits
Show all changes
177 commits
Select commit
Hold shift + click to select a range
433b799
start
a-zakir bca6733
add FictitiousLoad
a-zakir adbd363
shortTermStorageLevel
a-zakir 79136ac
flowDissociation
a-zakir 60ea81c
bindingConstraintHour
a-zakir e4298f9
ghost
a-zakir c96df9c
this is not only about constraint builder
a-zakir 1af5ead
pay attention to the time step
a-zakir 1d33989
specific issue
a-zakir 3f9f115
bug free
a-zakir 7b2406e
smooth green?
a-zakir 3b0c0d5
M&M
a-zakir bcc63e7
Max Pumping ok?
a-zakir a2de6d7
Area Hydro Level (_-_)
a-zakir b7b022c
finally
a-zakir 317bdb5
basic
a-zakir fcef054
tiny
a-zakir 2364b35
clean code
a-zakir 507e355
add {PMin,PMax}DispatchableGeneration
a-zakir 854ca38
clean code
a-zakir 3029f79
ConsistenceNODU ok
a-zakir 78dab46
NbUnitsOutageLessThanNbUnitsStop
a-zakir 22862bd
NbDispUnitsMinBoundSinceMinUpTime
a-zakir afd0808
MinDownTime
a-zakir 89584b0
setup Access Control
a-zakir d7e197d
remove comments
a-zakir a956ab9
remove comments
a-zakir 34e9559
treat major code smells
a-zakir c81b801
treat major code smells 2
a-zakir 1e65059
more on major code smells
a-zakir 692a8a8
update after review
a-zakir 7f8054d
about objects lifetime
a-zakir 5a047c0
(does not compile) cut into small pieces
a-zakir bd394e3
Revert "(does not compile) cut into small pieces"
a-zakir 676c0a4
aesthetic
a-zakir 1a29e44
remove comment
a-zakir fa422d6
smart move
a-zakir cee5edb
**** move
a-zakir a44c65e
shallow
a-zakir 687d879
customize error exception
a-zakir 9433f0a
work on "group 1"
a-zakir ee2c51f
fix
a-zakir 7364bd5
update
a-zakir f01decd
small
a-zakir 5932373
group of constraint
a-zakir 3c16029
from free function to class (LinearProblemMatrixBuilder)
a-zakir 3622cfb
update LinearProblemMatrixBuilder class
a-zakir 84b7e0e
fix
a-zakir a653ada
continue to group
a-zakir 8ed7085
implement week binding constraints group
a-zakir 688b36d
add HydroPowerGroup
a-zakir 9b6de6c
builder as ctor parameter
a-zakir 8256c26
builder as ctor parameter
a-zakir ea87d43
update
a-zakir 1321445
clean
a-zakir bb5e1b6
int is not a bool
a-zakir b3b9c1f
add Hydro Smoothing group
a-zakir b2a2988
MinMaxHydroPowerGroup
a-zakir 065632a
rename
a-zakir 496c1bb
new MaxPumpingGroup
a-zakir 6533cab
AreaHydroLevelGroup
a-zakir 086f72a
God commit
a-zakir 03c246a
new FictitiousLoad
a-zakir f2e6166
New ShortTermStorageLevel
a-zakir 0c9a8ca
New FlowDissociation
a-zakir fced3d6
NEw BindingConstraintHour
a-zakir ae4b0e0
delete copies
a-zakir eb0d6e8
New BindingConstraintDay
a-zakir 3651700
about includes
a-zakir 0d1e4bc
New BindingConstraintWeek
a-zakir 5cfa55c
includes...
a-zakir 7377886
HydroPower
a-zakir 76d4039
include.......
a-zakir fce50aa
new HydroPowerSmoothingUsingVariationSum
a-zakir a5fb74d
new HydroPowerSmoothingUsingVariationMaxDown
a-zakir 9f5bccf
new HydroPowerSmoothingUsingVariationMaxUP
a-zakir 65ee688
MinHydroPower
a-zakir 932d5c9
MaxHydroPower
a-zakir 6d5bef6
MaxPumping
a-zakir f308c96
new AreaHydroLevel
a-zakir 63b3040
setup FinalStockGroup
a-zakir 0cc3d45
fix
a-zakir 62241f8
shrink method: linear problem run
a-zakir 958ae3a
decomposition
a-zakir 2e6352e
remove duplicated includes
a-zakir 8ea67a8
update
a-zakir cbc4059
make FinalStockGroup is built
a-zakir d42fcca
just stay up-to-date
a-zakir 09760f3
merge conflict fix
a-zakir 1c62402
Merge branch 'develop' into feature/reshape-constraint-construction
a-zakir 4a17f03
new P{Min, Max}DispatchableGeneration & PMinMaxDispatchableGeneration…
a-zakir 312a3a5
renew StartUpCosts
a-zakir b599a35
add NbUnitsOutageLessThanNbUnitsStopGroup
a-zakir 5efb48c
minuptime
a-zakir 87ba06a
remove copy error
a-zakir 0947de7
new LinearProblemMatrixStartUpCosts
a-zakir 1f7eddb
fix
a-zakir 985d063
fix 2
a-zakir d270e8c
update CmakeLists.txt
a-zakir 4a30f57
fix
a-zakir f867b95
include errors
a-zakir 62add4f
fix read-write data
a-zakir bd9a530
add documentation
a-zakir 5aadd06
add doc for StartUpCosts group of constraints
a-zakir 1a37a86
remove deprecated
a-zakir 6aa9d35
work on CsrQuadraticProblem / CsrFlowDissociation
a-zakir 737b87c
missing include
a-zakir cc5b442
Update CsrFlowDissociation.h
a-zakir 7d22d33
get rid of old code
a-zakir b74118a
inline function
a-zakir a55cd5c
CsrAreaBalance new way & rename
a-zakir 921b322
fix : CsrAreaBalance = Group
a-zakir 690349c
logic issue
a-zakir a90e7bd
fix doubled NegativeUnsuppliedEnergy
a-zakir 47c92f1
:snake: CsrBindingConstraintHour :boom:
a-zakir 31077ac
method call syntax
a-zakir 34f0aef
remove old logs
a-zakir 7df7f6e
remove old code
a-zakir 473ee98
update QuadraticProblemMatrix
a-zakir 293e87d
remove copy error
a-zakir 5d05312
;
a-zakir f00844d
unused params
a-zakir 039e180
add return type
a-zakir 1514cec
it's :running:
a-zakir d632bf3
update
a-zakir 7e49fe6
fix
a-zakir 6154e44
remove old Style Constraint Builder
a-zakir 599e749
ConstraintBuilder is the New ConstraintBuilder
a-zakir 0ed0bee
rename file
a-zakir 072ca6e
rename classes
a-zakir e98d6f6
keep renaming
a-zakir 7de521b
rename new_exportPaliers
a-zakir ec4772b
transform shared_ptr data to ref: first try
a-zakir dde5d3e
FictitiousLoadData as ref
a-zakir 84826d5
shortTermStorageLevelData :floppy_disk:
a-zakir f267c9a
FlowDissociationData
a-zakir 2922556
BindingConstraintHourData
a-zakir 0079281
bindingConstraintDayData
a-zakir 68ba741
BindingConstraintWeekData
a-zakir 59c0993
HydroPowerData
a-zakir ca3f587
Min/Max/HydroPowerData
a-zakir c70a3a0
MaxPumpingData
a-zakir 109b725
AreaHydroLevelData
a-zakir c4cc825
data as ctor parameter
a-zakir 30c8257
perf issue
a-zakir 389cec5
fix perf issue
a-zakir e885483
small change
a-zakir 6d2dcd0
updates
a-zakir d385be6
about FlowDissociationData
a-zakir 6a463a0
optimized loop in bindingConstraintHour
a-zakir 4f07212
remove empty line
a-zakir fcc3a71
continue refactor
a-zakir 8d84c8e
re-work binding Constraint Week Data
a-zakir 4fd81f8
move HydroPowerData to ctor
a-zakir b1d4871
set data once for {Min, Max}HydroPower
a-zakir 53b72d8
skip windows & sonar
a-zakir 26449a2
same for MaxPumping
a-zakir 0f39ad4
we're ok AreaHydroLevelGroup
a-zakir 41bf732
ok FinalStockGroup
a-zakir 65fb1fa
fix
a-zakir 16e9f0e
update StartUpCosts Group
a-zakir 924b649
fix constraint index
a-zakir fc1ccd3
changes
a-zakir 8a6887c
CsrAreaBalance
a-zakir 2c17e51
no shared_ptr of data anymore!
a-zakir 213463d
test MinDownTime elsewhere
a-zakir c665732
test NbDispUnitsMinBoundSinceMinUpTime out of it's inner loop
a-zakir 7908b15
test NbUnitsOutageLessThanNbUnitsStop out of it's inner loop
a-zakir 61a1c1d
big one
a-zakir 28c7eb1
shared????
a-zakir 8bbd2e9
reactivate w&s
a-zakir c469974
reshape constraint construction (#1815)
a-zakir 912e3d3
new & newer
a-zakir 4212098
@guilpier-code's remark
a-zakir a53474a
typo
a-zakir f2ed940
from PR
a-zakir 8462829
move unrelated jobs from LinearProblemMatrix
a-zakir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#include "AreaBalance.h" | ||
#include "opt_rename_problem.h" | ||
|
||
static void shortTermStorageBalance(const ::ShortTermStorage::AREA_INPUT& shortTermStorageInput, | ||
std::shared_ptr<NewConstraintBuilder> constraintBuilder, | ||
std::vector<int>& InjectionVariable, | ||
std::vector<int>& WithdrawalVariable) | ||
{ | ||
for (const auto& storage : shortTermStorageInput) | ||
{ | ||
unsigned index = storage.clusterGlobalIndex; | ||
if (const int varInjection = InjectionVariable[index]; varInjection >= 0) | ||
{ | ||
constraintBuilder->include(NewVariable::ShortTermStorageInjection(index), 1.0); | ||
} | ||
if (const int varWithdrawal = WithdrawalVariable[index]; varWithdrawal >= 0) | ||
{ | ||
constraintBuilder->include(NewVariable::ShortTermStorageWithdrawal(index), -1.0); | ||
} | ||
} | ||
} | ||
|
||
// Constraint definitions | ||
void AreaBalance::odd(int pays, std::shared_ptr<AreaBalanceData> data) | ||
{ | ||
int a = 13; | ||
int b = a * 36; | ||
logs.info() << "int odd builder->data->nombreDeContraintes" | ||
<< builder->data->nombreDeContraintes << "\n"; | ||
logs.info() << "int odd data->NumeroDeContrainteDesBilansPays[pays]" | ||
<< data->NumeroDeContrainteDesBilansPays[pays] << "\n"; | ||
data->NumeroDeContrainteDesBilansPays[pays] = builder->data->nombreDeContraintes; | ||
logs.info() << "int odd 2" << a << "\n"; | ||
} | ||
void AreaBalance::add(int pdt, int pays, std::shared_ptr<AreaBalanceData> data) | ||
{ | ||
/** can be done without this --- keep it for now**/ | ||
data->NumeroDeContrainteDesBilansPays[pays] = builder->data->nombreDeContraintes; | ||
|
||
/******/ | ||
// TODO improve this | ||
|
||
ConstraintNamer namer(builder->data->NomDesContraintes, builder->data->NamedProblems); | ||
namer.UpdateTimeStep(builder->data->weekInTheYear * 168 + pdt); | ||
namer.UpdateArea(builder->data->NomsDesPays[pays]); | ||
namer.AreaBalance(builder->data->nombreDeContraintes); | ||
|
||
builder->updateHourWithinWeek(pdt); | ||
|
||
int interco = data->IndexDebutIntercoOrigine[pays]; | ||
while (interco >= 0) | ||
{ | ||
builder->include(NewVariable::NTCDirect(interco), 1.0); | ||
interco = data->IndexSuivantIntercoOrigine[interco]; | ||
} | ||
|
||
interco = data->IndexDebutIntercoExtremite[pays]; | ||
while (interco >= 0) | ||
{ | ||
builder->include(NewVariable::NTCDirect(interco), -1.0); | ||
interco = data->IndexSuivantIntercoExtremite[interco]; | ||
} | ||
|
||
new_exportPaliers(data->PaliersThermiquesDuPays, builder); | ||
builder->include(NewVariable::HydProd(pays), -1.0) | ||
.include(NewVariable::Pumping(pays), 1.0) | ||
.include(NewVariable::PositiveUnsuppliedEnergy(pays), -1.0) | ||
.include(NewVariable::NegativeUnsuppliedEnergy(pays), 1.0); | ||
|
||
shortTermStorageBalance( | ||
data->ShortTermStorage[pays], builder, data->InjectionVariable, data->WithdrawalVariable); | ||
|
||
builder->equalTo(); | ||
builder->build(); | ||
} |
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,25 @@ | ||
#pragma once | ||
#include "new_constraint_builder.h" | ||
|
||
struct AreaBalanceData | ||
{ | ||
std::vector<int>& NumeroDeContrainteDesBilansPays; | ||
std::vector<int>& InjectionVariable; | ||
std::vector<int>& WithdrawalVariable; | ||
const std::vector<int>& IndexDebutIntercoOrigine; | ||
const std::vector<int>& IndexSuivantIntercoOrigine; | ||
const std::vector<int>& IndexDebutIntercoExtremite; | ||
const std::vector<int>& IndexSuivantIntercoExtremite; | ||
const PALIERS_THERMIQUES& PaliersThermiquesDuPays; | ||
const std::vector<::ShortTermStorage::AREA_INPUT>& ShortTermStorage; | ||
}; | ||
|
||
class AreaBalance : public NewConstraint | ||
{ | ||
public: | ||
using NewConstraint::NewConstraint; | ||
|
||
void add(int pdt, int pays, std::shared_ptr<AreaBalanceData> data); | ||
void odd(int pays, std::shared_ptr<AreaBalanceData> data); | ||
// void add(int pdt, int pays, AreaBalanceData& 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,36 @@ | ||
#include "AreaHydroLevel.h" | ||
|
||
void AreaHydroLevel::add(int pays, int pdt) | ||
{ | ||
const auto& CorrespondanceVarNativesVarOptim | ||
= problemeHebdo->CorrespondanceVarNativesVarOptim[pdt]; | ||
CORRESPONDANCES_DES_CONTRAINTES& CorrespondanceCntNativesCntOptim | ||
= problemeHebdo->CorrespondanceCntNativesCntOptim[pdt]; | ||
CorrespondanceCntNativesCntOptim.NumeroDeContrainteDesNiveauxPays[pays] | ||
= problemeHebdo->ProblemeAResoudre->NombreDeContraintes; | ||
if (problemeHebdo->CaracteristiquesHydrauliques[pays].SuiviNiveauHoraire) | ||
{ | ||
builder.updateHourWithinWeek(pdt).include(Variable::HydroLevel(pays), 1.0); | ||
if (pdt > 0) | ||
{ | ||
builder.updateHourWithinWeek(pdt - 1).include(Variable::HydroLevel(pays), -1.0); | ||
} | ||
ConstraintNamer namer(problemeHebdo->ProblemeAResoudre->NomDesContraintes, | ||
problemeHebdo->NamedProblems); | ||
|
||
namer.UpdateArea(problemeHebdo->NomsDesPays[pays]); | ||
namer.UpdateTimeStep(problemeHebdo->weekInTheYear * 168 + pdt); | ||
namer.AreaHydroLevel(problemeHebdo->ProblemeAResoudre->NombreDeContraintes); | ||
CorrespondanceCntNativesCntOptim.NumeroDeContrainteDesNiveauxPays[pays] | ||
= problemeHebdo->ProblemeAResoudre->NombreDeContraintes; | ||
builder.updateHourWithinWeek(pdt) | ||
.include(Variable::HydProd(pays), 1.0) | ||
.include(Variable::Pumping(pays), | ||
-problemeHebdo->CaracteristiquesHydrauliques[pays].PumpingRatio) | ||
.include(Variable::Overflow(pays), 1.) | ||
.equalTo() | ||
.build(); | ||
} | ||
else | ||
CorrespondanceCntNativesCntOptim.NumeroDeContrainteDesNiveauxPays[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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
#include "constraint_builder.h" | ||
|
||
class AreaHydroLevel : private Constraint | ||
{ | ||
public: | ||
using Constraint::Constraint; | ||
void add(int pays, int pdt); | ||
}; |
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,92 @@ | ||
#include "BindingConstraintDay.h" | ||
|
||
void BindingConstraintDay::add(int cntCouplante, std::shared_ptr<BindingConstraintDayData> data) | ||
{ | ||
if (data->TypeDeContrainteCouplante != CONTRAINTE_JOURNALIERE) | ||
return; | ||
|
||
const int nbInterco = data->NombreDInterconnexionsDansLaContrainteCouplante; | ||
const int nbClusters = data->NombreDePaliersDispatchDansLaContrainteCouplante; | ||
|
||
const int NombreDePasDeTempsPourUneOptimisation | ||
= builder->data->NombreDePasDeTempsPourUneOptimisation; // TODO | ||
const int NombreDePasDeTempsDUneJournee = data->NombreDePasDeTempsDUneJournee; | ||
int pdtDebut = 0; | ||
while (pdtDebut < NombreDePasDeTempsPourUneOptimisation) | ||
{ | ||
int jour = data->NumeroDeJourDuPasDeTemps[pdtDebut]; | ||
|
||
for (int index = 0; index < nbInterco; index++) | ||
{ | ||
int interco = data->NumeroDeLInterconnexion[index]; | ||
double poids = data->PoidsDeLInterconnexion[index]; | ||
int offset = data->OffsetTemporelSurLInterco[index]; | ||
|
||
for (int pdt = pdtDebut; pdt < pdtDebut + NombreDePasDeTempsDUneJournee; pdt++) | ||
{ | ||
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 = data->PaysDuPalierDispatch[index]; | ||
const PALIERS_THERMIQUES& PaliersThermiquesDuPays = data->PaliersThermiquesDuPays[pays]; | ||
const int palier | ||
= PaliersThermiquesDuPays.NumeroDuPalierDansLEnsembleDesPaliersThermiques | ||
[data->NumeroDuPalierDispatch[index]]; | ||
double poids = data->PoidsDuPalierDispatch[index]; | ||
int offset = data->OffsetTemporelSurLePalierDispatch[index]; | ||
|
||
for (int pdt = pdtDebut; pdt < pdtDebut + NombreDePasDeTempsDUneJournee; pdt++) | ||
{ | ||
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); | ||
} | ||
} | ||
|
||
data->CorrespondanceCntNativesCntOptimJournalieres[jour] | ||
.NumeroDeContrainteDesContraintesCouplantes[cntCouplante] | ||
= builder->data->nombreDeContraintes; | ||
|
||
char op = data->SensDeLaContrainteCouplante; | ||
builder->operatorRHS(op); | ||
{ | ||
ConstraintNamer namer(builder->data->NomDesContraintes, builder->data->NamedProblems); | ||
namer.UpdateTimeStep(jour); | ||
namer.BindingConstraintDay(builder->data->nombreDeContraintes, | ||
data->NomDeLaContrainteCouplante); | ||
} | ||
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
#include "new_constraint_builder.h" | ||
|
||
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 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,40 @@ | ||
#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() | ||
{ | ||
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); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must refrain, when not necessary, to use heap allocation (in particular for perf reason), and even more shared ownership (little perf but mostly for clarity sake).
Here the method will clearly not take ownership of the data, and not modify it --> it must be passed by const reference.
Same thing everywhere in other constraint types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'v tried refs data & faced huge amount of segfault-ish bug #1617
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modify just a little bit :
data->NumeroDeContrainteDesBilansPays[pays]=.....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! maybe a non const ref is needed.
Ok for the segaults issues: well, I think if we come over that again, we can find out another solution than doing heap allocation, because this should not really change the lifetime of our objects here (not completely true, they might be moved and possibly copied in a few places, but I don't think it should be an issue). Easier said than done though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sylvlecl shared what?☺️