Skip to content
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

Remove manual alloc and update code standards in hydro/daily2 #1651

Merged
merged 33 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1361943
[DEV] TurbineMax/min
payetvin Sep 26, 2023
7dc46fd
[FIX] Use new to call constructor for vector
payetvin Sep 26, 2023
8a10425
Merge branch 'develop' into feature/hydro-daily2
payetvin Sep 26, 2023
99918d6
[DEV] niveauxbas apports
payetvin Sep 26, 2023
cab118e
[DEV] DONNEES_MENSUELLES_ETENDUES
payetvin Sep 26, 2023
1ceef4f
[DEV] CoutLineaire CoefficientsDeLaMatriceDesContraintes
payetvin Sep 26, 2023
c33eb16
[DEV] Sens
payetvin Sep 26, 2023
6a45734
[FIX] Using new
payetvin Sep 26, 2023
aa6a096
[DEV] NombreDeTermesDesLignes IndicesDebutDeLigne
payetvin Sep 26, 2023
dfecf31
[DEV] IndicesColonnes
payetvin Sep 26, 2023
6878b29
[DEV] Xmin Xmax SecondMembre
payetvin Sep 26, 2023
7012fac
[DEV] X CoutsReduits CoutsMarginauxDesContraintes
payetvin Sep 26, 2023
ab9fc95
[DEV] PositionDeLaVariable ComplementDeLaBase
payetvin Sep 26, 2023
838fd52
[DEV] AdresseOuPlacerLaValeurDesVariablesOptimisees
payetvin Sep 26, 2023
1ea14b9
[DEV] CORRESPONDANCE_DES_VARIABLES_PB_ETENDU
payetvin Sep 26, 2023
e5ff4cb
[DEV] NbJoursDUnProbleme
payetvin Sep 26, 2023
33f4552
[DEV] ProblemeSpx
payetvin Sep 26, 2023
b7aee6e
[DEV] TypeDeVariable
payetvin Sep 26, 2023
86020f8
[DEV] CorrespondanceDesVariables
payetvin Sep 26, 2023
f2bf172
[DEV] ProblemeLineaireEtenduPartieFixe
payetvin Sep 27, 2023
b5cae89
[DEV] ProblemeLineaireEtenduPartieVariable
payetvin Sep 27, 2023
6685522
[DEV] Var scope
payetvin Sep 27, 2023
89ec850
[DEV] ProblemeHydrauliqueEtendu
payetvin Sep 27, 2023
ed9558f
[DEV] Use unique_ptr for Probleme
payetvin Sep 28, 2023
f3d73c0
[DEV] Remove probleme in struct
payetvin Sep 28, 2023
acf388e
[DEV] Remove probleme in monthly
payetvin Sep 28, 2023
4408e83
[DEV] Remove probleme in daily/
payetvin Sep 28, 2023
7b567ab
[DEV] DONNEES_MENSUELLES_ETENDUES&
payetvin Sep 28, 2023
0eca803
[FIX] code smells
payetvin Sep 28, 2023
2ec7a40
[FIX] vois* for probspx
payetvin Sep 28, 2023
9833271
[DEV] std::vector<PROBLEME_SPX*> ProblemeSpx for daily and monthly
payetvin Sep 28, 2023
dbaa874
[DEV] Remove error checking for unique_ptr
payetvin Oct 3, 2023
ba4d6c2
[FIX] Code smell
payetvin Oct 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/solver/hydro/daily/h2o_j_donnees_optimisation.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
#ifndef __SOLVER_H2O_J_STRUCTURE_INTERNE__
#define __SOLVER_H2O_J_STRUCTURE_INTERNE__

#ifdef __CPLUSPLUS
extern "C"
{
#endif

#include "spx_definition_arguments.h"
#include "spx_fonctions.h"

#ifdef __CPLUSPLUS
}
#endif

#define LINFINI 1.e+80

#define JOURS_28 28
Expand Down Expand Up @@ -127,7 +139,7 @@ struct PROBLEME_HYDRAULIQUE
std::vector<PROBLEME_LINEAIRE_PARTIE_FIXE> ProblemeLineairePartieFixe;
std::vector<PROBLEME_LINEAIRE_PARTIE_VARIABLE> ProblemeLineairePartieVariable;

std::vector<void*> ProblemeSpx; /* Il y en a 1 par reservoir. Un probleme couvre 1 mois */
std::vector<PROBLEME_SPX*> ProblemeSpx; /* Il y en a 1 par reservoir. Un probleme couvre 1 mois */
};

#endif
16 changes: 2 additions & 14 deletions src/solver/hydro/daily/h2o_j_resoudre_le_probleme_lineaire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@
** SPDX-License-Identifier: licenceRef-GPL3_WITH_RTE-Exceptions
*/

#ifdef __CPLUSPLUS
extern "C"
{
#endif

#include "spx_definition_arguments.h"
#include "spx_fonctions.h"

#ifdef __CPLUSPLUS
}
#endif

#include "h2o_j_donnees_mensuelles.h"
#include "h2o_j_fonctions.h"

Expand All @@ -58,7 +46,7 @@ void H2O_J_ResoudreLeProblemeLineaire(DONNEES_MENSUELLES* DonneesMensuelles, int
PROBLEME_LINEAIRE_PARTIE_FIXE& ProblemeLineairePartieFixe
= ProblemeHydraulique.ProblemeLineairePartieFixe[NumeroDeProbleme];

PROBLEME_SPX* ProbSpx = (PROBLEME_SPX*)ProblemeHydraulique.ProblemeSpx[NumeroDeProbleme];
PROBLEME_SPX* ProbSpx = ProblemeHydraulique.ProblemeSpx[NumeroDeProbleme];
std::unique_ptr<PROBLEME_SIMPLEXE> Probleme = std::make_unique<PROBLEME_SIMPLEXE>();

if (!Probleme)
payetvin marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -140,7 +128,7 @@ void H2O_J_ResoudreLeProblemeLineaire(DONNEES_MENSUELLES* DonneesMensuelles, int
ProbSpx = SPX_Simplexe(Probleme.get(), ProbSpx);

if (ProbSpx)
ProblemeHydraulique.ProblemeSpx[NumeroDeProbleme] = (void*)ProbSpx;
ProblemeHydraulique.ProblemeSpx[NumeroDeProbleme] = ProbSpx;

ProblemeLineairePartieVariable.ExistenceDUneSolution = Probleme->ExistenceDUneSolution;

Expand Down
14 changes: 13 additions & 1 deletion src/solver/hydro/daily2/h2o2_j_donnees_optimisation.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
#ifndef __SOLVER_H2O2_J_STRUCTURE_INTERNE__
#define __SOLVER_H2O2_J_STRUCTURE_INTERNE__

#ifdef __CPLUSPLUS
extern "C"
{
#endif

#include "spx_definition_arguments.h"
#include "spx_fonctions.h"

#ifdef __CPLUSPLUS
}

#endif
#include "../daily/h2o_j_donnees_optimisation.h"
#include <antares/study/study.h>
#include <antares/mersenne-twister/mersenne-twister.h>
Expand Down Expand Up @@ -129,7 +141,7 @@ typedef struct
std::vector<PROBLEME_LINEAIRE_ETENDU_PARTIE_FIXE> ProblemeLineaireEtenduPartieFixe;
std::vector<PROBLEME_LINEAIRE_ETENDU_PARTIE_VARIABLE> ProblemeLineaireEtenduPartieVariable;

std::vector<void*> ProblemeSpx; /* Il y en a 1 par reservoir. Un probleme couvre 1 mois */
std::vector<PROBLEME_SPX*> ProblemeSpx; /* Il y en a 1 par reservoir. Un probleme couvre 1 mois */
} PROBLEME_HYDRAULIQUE_ETENDU;

namespace Antares::Constants
Expand Down
16 changes: 2 additions & 14 deletions src/solver/hydro/daily2/h2o2_j_resoudre_le_probleme_lineaire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@
** SPDX-License-Identifier: licenceRef-GPL3_WITH_RTE-Exceptions
*/

#ifdef __CPLUSPLUS
extern "C"
{
#endif

#include "spx_definition_arguments.h"
#include "spx_fonctions.h"

#ifdef __CPLUSPLUS
}
#endif

#include "h2o2_j_donnees_mensuelles.h"
#include "h2o2_j_fonctions.h"

Expand All @@ -56,7 +44,7 @@ void H2O2_J_ResoudreLeProblemeLineaire(DONNEES_MENSUELLES_ETENDUES& DonneesMensu
auto& ProblemeLineaireEtenduPartieFixe
= ProblemeHydrauliqueEtendu.ProblemeLineaireEtenduPartieFixe[NumeroDeProbleme];

auto ProbSpx = (PROBLEME_SPX*)ProblemeHydrauliqueEtendu.ProblemeSpx[NumeroDeProbleme];
PROBLEME_SPX* ProbSpx = ProblemeHydrauliqueEtendu.ProblemeSpx[NumeroDeProbleme];
auto Probleme = std::make_unique<PROBLEME_SIMPLEXE>();

if (!Probleme)
Expand Down Expand Up @@ -138,7 +126,7 @@ void H2O2_J_ResoudreLeProblemeLineaire(DONNEES_MENSUELLES_ETENDUES& DonneesMensu
ProbSpx = SPX_Simplexe(Probleme.get(), ProbSpx);

if (ProbSpx)
ProblemeHydrauliqueEtendu.ProblemeSpx[NumeroDeProbleme] = (void*)ProbSpx;
ProblemeHydrauliqueEtendu.ProblemeSpx[NumeroDeProbleme] = ProbSpx;

ProblemeLineaireEtenduPartieVariable.ExistenceDUneSolution = Probleme->ExistenceDUneSolution;

Expand Down
14 changes: 13 additions & 1 deletion src/solver/hydro/monthly/h2o_m_donnees_optimisation.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
#ifndef __SOLVER_H2O_M_STRUCTURE_INTERNE__
#define __SOLVER_H2O_M_STRUCTURE_INTERNE__

#ifdef __CPLUSPLUS
extern "C"
{
#endif

#include "spx_definition_arguments.h"
#include "spx_fonctions.h"

#ifdef __CPLUSPLUS
}
#endif

#include <vector>

#define LINFINI 1.e+80
Expand Down Expand Up @@ -115,7 +127,7 @@ typedef struct
PROBLEME_LINEAIRE_PARTIE_FIXE ProblemeLineairePartieFixe;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@payetvin there is another definition for PROBLEME_HYDRAULIQUE PROBLEME_LINEAIRE_PARTIE_FIXE in h2o_j_donn

PROBLEME_LINEAIRE_PARTIE_VARIABLE ProblemeLineairePartieVariable;

std::vector<void*> ProblemeSpx; /* Il y en a 1 par reservoir */
std::vector<PROBLEME_SPX*> ProblemeSpx; /* Il y en a 1 par reservoir */

double CoutDeLaSolution;
double CoutDeLaSolutionBruite;
Expand Down
16 changes: 2 additions & 14 deletions src/solver/hydro/monthly/h2o_m_resoudre_le_probleme_lineaire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@
** SPDX-License-Identifier: licenceRef-GPL3_WITH_RTE-Exceptions
*/

#ifdef __CPLUSPLUS
extern "C"
{
#endif

#include "spx_definition_arguments.h"
#include "spx_fonctions.h"

#ifdef __CPLUSPLUS
}
#endif

#include "h2o_m_donnees_annuelles.h"
#include "h2o_m_fonctions.h"

Expand All @@ -57,7 +45,7 @@ void H2O_M_ResoudreLeProblemeLineaire(DONNEES_ANNUELLES& DonneesAnnuelles, int N
= ProblemeHydraulique.ProblemeLineairePartieFixe;


PROBLEME_SPX* ProbSpx = (PROBLEME_SPX*)ProblemeHydraulique.ProblemeSpx[NumeroDeReservoir];
PROBLEME_SPX* ProbSpx = ProblemeHydraulique.ProblemeSpx[NumeroDeReservoir];
std::unique_ptr<PROBLEME_SIMPLEXE> Probleme = std::make_unique<PROBLEME_SIMPLEXE>();

if (!Probleme)
Expand Down Expand Up @@ -139,7 +127,7 @@ void H2O_M_ResoudreLeProblemeLineaire(DONNEES_ANNUELLES& DonneesAnnuelles, int N
ProbSpx = SPX_Simplexe(Probleme.get(), ProbSpx);

if (ProbSpx)
ProblemeHydraulique.ProblemeSpx[NumeroDeReservoir] = (void*)ProbSpx;
ProblemeHydraulique.ProblemeSpx[NumeroDeReservoir] = ProbSpx;

ProblemeLineairePartieVariable.ExistenceDUneSolution = Probleme->ExistenceDUneSolution;

Expand Down