From 1c7de3c8b9bf8f2a1ba8ecbefbc135f756089414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= Date: Fri, 6 Jan 2023 11:01:11 +0100 Subject: [PATCH 1/4] Apply clang-format (#1036) * Apply clang-format --- .../src/yuni/core/string/iterator.inc.hpp | 3 +- src/ext/yuni/src/yuni/thread/utility.h | 1 - src/libs/antares/array/matrix.hxx | 2 - .../antares/benchmarking/info_collectors.cpp | 298 +++--- src/libs/antares/constants.cpp | 6 +- src/libs/antares/constants.h | 6 +- src/libs/antares/logs/cleaner.cpp | 1 - src/libs/antares/logs/logs.h | 16 +- src/libs/antares/memory/memory.cpp | 3 +- src/libs/antares/memory/memory.h | 6 +- src/libs/antares/memory/memory.hxx | 12 +- src/libs/antares/object/intrusive-reference.h | 3 +- src/libs/antares/object/object.h | 3 +- src/libs/antares/study/area/list.cpp | 2 +- .../study/area/store-timeseries-numbers.cpp | 2 +- src/libs/antares/study/fwd.cpp | 5 +- src/libs/antares/study/layerdata.cpp | 4 +- src/libs/antares/study/layerdata.h | 6 +- src/libs/antares/study/memory-usage.cpp | 10 +- src/libs/antares/study/parameters.cpp | 3 +- src/libs/antares/study/parameters.h | 1 - .../antares/study/parts/common/series.hxx | 1 - src/libs/antares/study/parts/hydro/series.cpp | 4 +- src/libs/antares/study/parts/hydro/series.h | 4 +- src/libs/antares/study/parts/hydro/series.hxx | 3 +- .../study/parts/renewable/cluster_list.cpp | 1 - .../study/parts/thermal/cluster_list.cpp | 3 +- .../antares/study/parts/thermal/prepro.hxx | 1 - src/libs/antares/study/runtime/runtime.cpp | 10 +- .../study/scenario-builder/TSnumberData.cpp | 10 +- .../antares/study/scenario-builder/rules.cpp | 14 +- src/libs/antares/study/study.cpp | 1 - .../antares/study/variable-print-info.cpp | 4 +- src/libs/antares/study/xcast/xcast.hxx | 1 - src/solver/constraints-builder/cbuilder.cpp | 2 +- src/solver/constraints-builder/create.cpp | 40 +- src/solver/constraints-builder/grid.hxx | 2 +- .../daily/h2o_j_ajouter_bruit_au_cout.cpp | 3 +- .../daily2/h2o2_j_donnees_optimisation.h | 2 +- src/solver/hydro/management/management.h | 1 - .../hydro/monthly/h2o_m_ajouter_bruit.cpp | 3 +- .../h2o_m_resoudre_le_probleme_lineaire.c | 6 +- .../opt_appel_solveur_lineaire.cpp | 7 +- .../optimisation/opt_export_structure.cpp | 1 - src/solver/optimisation/opt_fonctions.h | 9 +- .../opt_gestion_des_bornes_cas_lineaire.cpp | 5 +- .../opt_gestion_des_couts_cas_lineaire.cpp | 1 - ...opt_gestion_second_membre_cas_lineaire.cpp | 12 +- .../opt_optimisation_lineaire.cpp | 26 +- .../opt_restaurer_les_donnees.cpp | 3 +- .../simulation/sim_alloc_probleme_hebdo.cpp | 2 +- .../simulation/sim_allocation_tableaux.cpp | 1 - .../simulation/sim_calcul_economique.cpp | 3 +- .../sim_structure_probleme_economique.h | 2 +- src/solver/simulation/solver.hxx | 1 - src/solver/ts-generator/xcast/xcast.cpp | 4 +- src/solver/utils/filename.cpp | 27 +- src/solver/utils/filename.h | 13 +- src/solver/utils/mps_utils.cpp | 37 +- src/solver/utils/mps_utils.h | 18 +- src/solver/utils/named_problem.cpp | 8 +- src/solver/utils/named_problem.h | 1 - .../utils/opt_period_string_generator.cpp | 1 - .../utils/opt_period_string_generator.h | 2 - src/solver/utils/ortools_utils.cpp | 23 +- src/solver/utils/ortools_utils.h | 6 +- src/solver/variable/adequacy/all.h | 23 +- .../variable/bc.memory-estimation.inc.hxx | 51 +- src/solver/variable/bindConstraints.h | 1 - src/solver/variable/commons/join.h | 2 +- src/solver/variable/economy/all.h | 15 +- src/solver/variable/storage/intermediate.h | 13 +- .../variable/surveyresults/reportbuilder.hxx | 4 +- .../variable/surveyresults/surveyresults.cpp | 4 +- src/solver/variable/variable.hxx | 12 +- .../kirchhoff-cbuilder/kirchhoff-cbuilder.h | 4 +- src/tools/kirchhoff-cbuilder/main.cpp | 15 +- src/tools/yby-aggregator/result.cpp | 1 - src/ui/simulator/application/main/create.cpp | 7 +- src/ui/simulator/application/menus.cpp | 4 +- .../toolbox/components/map/component.cpp | 5 +- .../toolbox/components/map/component.h | 6 +- src/ui/simulator/windows/connection.cpp | 22 +- src/ui/simulator/windows/connection.h | 7 +- .../windows/link-property-buttons.cpp | 900 +++++++++--------- .../simulator/windows/link-property-buttons.h | 55 +- .../windows/options/advanced/advanced.cpp | 11 +- .../options/optimization/optimization.h | 38 +- src/ui/simulator/windows/simulation/run.cpp | 6 +- 89 files changed, 968 insertions(+), 960 deletions(-) diff --git a/src/ext/yuni/src/yuni/core/string/iterator.inc.hpp b/src/ext/yuni/src/yuni/core/string/iterator.inc.hpp index a97f5c2e8b..cc3f3f8b9c 100644 --- a/src/ext/yuni/src/yuni/core/string/iterator.inc.hpp +++ b/src/ext/yuni/src/yuni/core/string/iterator.inc.hpp @@ -173,7 +173,8 @@ struct Model { do { - if (pChar == (uint)' ' || pChar == (uint)'\t' || pChar == (uint)'\n' || pChar == (uint)'\r') + if (pChar == (uint)' ' || pChar == (uint)'\t' || pChar == (uint)'\n' + || pChar == (uint)'\r') { forward(); if (pOffset >= end) diff --git a/src/ext/yuni/src/yuni/thread/utility.h b/src/ext/yuni/src/yuni/thread/utility.h index 9377114b7a..ed30800760 100644 --- a/src/ext/yuni/src/yuni/thread/utility.h +++ b/src/ext/yuni/src/yuni/thread/utility.h @@ -31,7 +31,6 @@ class Taskgroup; namespace Yuni { - /*! ** \brief Convenient wrapper for executing some code every X milliseconds ** diff --git a/src/libs/antares/array/matrix.hxx b/src/libs/antares/array/matrix.hxx index 6a846b7aab..e1c4b5ef42 100644 --- a/src/libs/antares/array/matrix.hxx +++ b/src/libs/antares/array/matrix.hxx @@ -1267,7 +1267,6 @@ void Matrix::resizeWithoutDataLost(uint x, uint y, const T& defVa for (uint j = minH; j < y; ++j) column[j] = defVal; - } if (defVal == T()) @@ -1423,7 +1422,6 @@ void Matrix::copyFrom(const Matrix& rhs) // optimisations if (Yuni::Static::Type::StrictlyEqual::Yes) { - (void)::memcpy((void*)column, (void*)src, sizeof(T) * height); } else diff --git a/src/libs/antares/benchmarking/info_collectors.cpp b/src/libs/antares/benchmarking/info_collectors.cpp index 83d8b85719..5290d7496a 100644 --- a/src/libs/antares/benchmarking/info_collectors.cpp +++ b/src/libs/antares/benchmarking/info_collectors.cpp @@ -8,161 +8,163 @@ using namespace Antares::Data; namespace Benchmarking { - // Collecting data study - // --------------------------- - void StudyInfoCollector::toFileContent(FileContent& file_content) - { - areasCountToFileContent(file_content); - linksCountToFileContent(file_content); - performedYearsCountToFileContent(file_content); - enabledThermalClustersCountToFileContent(file_content); - enabledBindingConstraintsCountToFileContent(file_content); - unitCommitmentModeToFileContent(file_content); - maxNbYearsInParallelToFileContent(file_content); - solverVersionToFileContent(file_content); - ORToolsUsed(file_content); - ORToolsSolver(file_content); - } - - void StudyInfoCollector::areasCountToFileContent(FileContent& file_content) - { - file_content.addItemToSection("study", "areas", study_.areas.size()); - } - - void StudyInfoCollector::linksCountToFileContent(FileContent& file_content) - { - file_content.addItemToSection("study", "links", study_.areas.areaLinkCount()); - } - - void StudyInfoCollector::performedYearsCountToFileContent(FileContent& file_content) - { - // Computing the number of performed years - unsigned int nbPerformedYears = 0; - for (uint i = 0; i < study_.parameters.nbYears; i++) - { - if (study_.parameters.yearsFilter[i]) - nbPerformedYears++; - } - - // Adding an item related to number of performed years to the file content - file_content.addItemToSection("study", "performed years", nbPerformedYears); - } - - void StudyInfoCollector::enabledThermalClustersCountToFileContent(FileContent& file_content) - { - // Computing the number of enabled thermal clusters - unsigned int nbEnabledThermalClusters = 0; - - auto end = study_.areas.end(); - for (auto i = study_.areas.begin(); i != end; ++i) - { - Area& area = *(i->second); - auto end = area.thermal.list.end(); - for (auto i = area.thermal.list.begin(); i != end; ++i) - { - auto& cluster = i->second; - if (cluster->enabled) - nbEnabledThermalClusters++; - } - } - - // Adding an item related to number of enabled thermal clusters to the file content - file_content.addItemToSection("study", "enabled thermal clusters", nbEnabledThermalClusters); - } - - void StudyInfoCollector::enabledBindingConstraintsCountToFileContent(FileContent& file_content) - { - unsigned int nbEnabledBC = study_.runtime->bindingConstraintCount; - unsigned int nbEnabledHourlyBC(0), nbEnabledDailyBC(0), nbEnabledWeeklyBC(0); - - for (uint i = 0; i < nbEnabledBC; i++) - { - switch (study_.runtime->bindingConstraint[i].type) - { - case BindingConstraint::Type::typeHourly: - nbEnabledHourlyBC++; - break; - case BindingConstraint::Type::typeDaily: - nbEnabledDailyBC++; - break; - case BindingConstraint::Type::typeWeekly: - nbEnabledWeeklyBC++; - break; - default: - break; - } - } - - file_content.addItemToSection("study", "enabled BC", nbEnabledBC); - file_content.addItemToSection("study", "enabled hourly BC", nbEnabledHourlyBC); - file_content.addItemToSection("study", "enabled daily BC", nbEnabledDailyBC); - file_content.addItemToSection("study", "enabled weekly BC", nbEnabledWeeklyBC); - } - - void StudyInfoCollector::unitCommitmentModeToFileContent(FileContent& file_content) - { - const char* unitCommitment = UnitCommitmentModeToCString(study_.parameters.unitCommitment.ucMode); - file_content.addItemToSection("study", "unit commitment", unitCommitment); - } - - void StudyInfoCollector::maxNbYearsInParallelToFileContent(FileContent& file_content) - { - file_content.addItemToSection("study", "max parallel years", study_.maxNbYearsInParallel); - } - - void StudyInfoCollector::solverVersionToFileContent(FileContent& file_content) - { - // Example : 8.3.0 -> 830 - const unsigned int version - = 100 * ANTARES_VERSION_HI + 10 * ANTARES_VERSION_LO + ANTARES_VERSION_BUILD; - - file_content.addItemToSection("study", "antares version", version); - } - - void StudyInfoCollector::ORToolsUsed(FileContent& file_content) +// Collecting data study +// --------------------------- +void StudyInfoCollector::toFileContent(FileContent& file_content) +{ + areasCountToFileContent(file_content); + linksCountToFileContent(file_content); + performedYearsCountToFileContent(file_content); + enabledThermalClustersCountToFileContent(file_content); + enabledBindingConstraintsCountToFileContent(file_content); + unitCommitmentModeToFileContent(file_content); + maxNbYearsInParallelToFileContent(file_content); + solverVersionToFileContent(file_content); + ORToolsUsed(file_content); + ORToolsSolver(file_content); +} + +void StudyInfoCollector::areasCountToFileContent(FileContent& file_content) +{ + file_content.addItemToSection("study", "areas", study_.areas.size()); +} + +void StudyInfoCollector::linksCountToFileContent(FileContent& file_content) +{ + file_content.addItemToSection("study", "links", study_.areas.areaLinkCount()); +} + +void StudyInfoCollector::performedYearsCountToFileContent(FileContent& file_content) +{ + // Computing the number of performed years + unsigned int nbPerformedYears = 0; + for (uint i = 0; i < study_.parameters.nbYears; i++) { - const bool& ortoolsUsed = study_.parameters.ortoolsUsed; - file_content.addItemToSection("study", "ortools used", ortoolsUsed ? "true" : "false"); + if (study_.parameters.yearsFilter[i]) + nbPerformedYears++; } - void StudyInfoCollector::ORToolsSolver(FileContent& file_content) + // Adding an item related to number of performed years to the file content + file_content.addItemToSection("study", "performed years", nbPerformedYears); +} + +void StudyInfoCollector::enabledThermalClustersCountToFileContent(FileContent& file_content) +{ + // Computing the number of enabled thermal clusters + unsigned int nbEnabledThermalClusters = 0; + + auto end = study_.areas.end(); + for (auto i = study_.areas.begin(); i != end; ++i) { - const bool& ortoolsUsed = study_.parameters.ortoolsUsed; - std::string ortoolsSolver = "none"; - if (ortoolsUsed) + Area& area = *(i->second); + auto end = area.thermal.list.end(); + for (auto i = area.thermal.list.begin(); i != end; ++i) { - ortoolsSolver = study_.parameters.ortoolsSolver; + auto& cluster = i->second; + if (cluster->enabled) + nbEnabledThermalClusters++; } - file_content.addItemToSection("study", "ortools solver", ortoolsSolver); } - // Collecting data optimization problem - // ------------------------------------- - void SimulationInfoCollector::toFileContent(FileContent& file_content) - { - file_content.addItemToSection("optimization problem", "variables", opt_info_.nbVariables); - file_content.addItemToSection("optimization problem", "constraints", opt_info_.nbConstraints); - file_content.addItemToSection("optimization problem", "non-zero coefficients", opt_info_.nbNonZeroCoeffs); - } - - // Collecting durations from simulation - // ------------------------------------- - void DurationCollector::toFileContent(FileContent& file_content) - { - for (const auto& element : duration_items_) - { - const std::string& name = element.first; - const auto& durations = element.second; - const int64_t duration_sum = accumulate(durations.begin(), durations.end(), (int64_t)0); - - file_content.addDurationItem(name, (unsigned int)duration_sum, (int)durations.size()); - } - } - - void DurationCollector::addDuration(const std::string& name, int64_t duration) - { - const std::lock_guard lock(mutex_); - duration_items_[name].push_back(duration); - } + // Adding an item related to number of enabled thermal clusters to the file content + file_content.addItemToSection("study", "enabled thermal clusters", nbEnabledThermalClusters); +} + +void StudyInfoCollector::enabledBindingConstraintsCountToFileContent(FileContent& file_content) +{ + unsigned int nbEnabledBC = study_.runtime->bindingConstraintCount; + unsigned int nbEnabledHourlyBC(0), nbEnabledDailyBC(0), nbEnabledWeeklyBC(0); + for (uint i = 0; i < nbEnabledBC; i++) + { + switch (study_.runtime->bindingConstraint[i].type) + { + case BindingConstraint::Type::typeHourly: + nbEnabledHourlyBC++; + break; + case BindingConstraint::Type::typeDaily: + nbEnabledDailyBC++; + break; + case BindingConstraint::Type::typeWeekly: + nbEnabledWeeklyBC++; + break; + default: + break; + } + } + + file_content.addItemToSection("study", "enabled BC", nbEnabledBC); + file_content.addItemToSection("study", "enabled hourly BC", nbEnabledHourlyBC); + file_content.addItemToSection("study", "enabled daily BC", nbEnabledDailyBC); + file_content.addItemToSection("study", "enabled weekly BC", nbEnabledWeeklyBC); +} + +void StudyInfoCollector::unitCommitmentModeToFileContent(FileContent& file_content) +{ + const char* unitCommitment + = UnitCommitmentModeToCString(study_.parameters.unitCommitment.ucMode); + file_content.addItemToSection("study", "unit commitment", unitCommitment); } + +void StudyInfoCollector::maxNbYearsInParallelToFileContent(FileContent& file_content) +{ + file_content.addItemToSection("study", "max parallel years", study_.maxNbYearsInParallel); +} + +void StudyInfoCollector::solverVersionToFileContent(FileContent& file_content) +{ + // Example : 8.3.0 -> 830 + const unsigned int version + = 100 * ANTARES_VERSION_HI + 10 * ANTARES_VERSION_LO + ANTARES_VERSION_BUILD; + + file_content.addItemToSection("study", "antares version", version); +} + +void StudyInfoCollector::ORToolsUsed(FileContent& file_content) +{ + const bool& ortoolsUsed = study_.parameters.ortoolsUsed; + file_content.addItemToSection("study", "ortools used", ortoolsUsed ? "true" : "false"); +} + +void StudyInfoCollector::ORToolsSolver(FileContent& file_content) +{ + const bool& ortoolsUsed = study_.parameters.ortoolsUsed; + std::string ortoolsSolver = "none"; + if (ortoolsUsed) + { + ortoolsSolver = study_.parameters.ortoolsSolver; + } + file_content.addItemToSection("study", "ortools solver", ortoolsSolver); +} + +// Collecting data optimization problem +// ------------------------------------- +void SimulationInfoCollector::toFileContent(FileContent& file_content) +{ + file_content.addItemToSection("optimization problem", "variables", opt_info_.nbVariables); + file_content.addItemToSection("optimization problem", "constraints", opt_info_.nbConstraints); + file_content.addItemToSection( + "optimization problem", "non-zero coefficients", opt_info_.nbNonZeroCoeffs); +} + +// Collecting durations from simulation +// ------------------------------------- +void DurationCollector::toFileContent(FileContent& file_content) +{ + for (const auto& element : duration_items_) + { + const std::string& name = element.first; + const auto& durations = element.second; + const int64_t duration_sum = accumulate(durations.begin(), durations.end(), (int64_t)0); + + file_content.addDurationItem(name, (unsigned int)duration_sum, (int)durations.size()); + } +} + +void DurationCollector::addDuration(const std::string& name, int64_t duration) +{ + const std::lock_guard lock(mutex_); + duration_items_[name].push_back(duration); +} + +} // namespace Benchmarking diff --git a/src/libs/antares/constants.cpp b/src/libs/antares/constants.cpp index edc5f4af81..4d358fcfa6 100644 --- a/src/libs/antares/constants.cpp +++ b/src/libs/antares/constants.cpp @@ -27,8 +27,8 @@ #include "constants.h" -namespace Antares::Constants { - +namespace Antares::Constants +{ const std::array daysPerMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; -} // namespace constants +} // namespace Antares::Constants diff --git a/src/libs/antares/constants.h b/src/libs/antares/constants.h index cdb50b03fa..8f79ab9f06 100644 --- a/src/libs/antares/constants.h +++ b/src/libs/antares/constants.h @@ -42,11 +42,11 @@ /*! Hours per year */ #define HOURS_PER_YEAR 8760 -namespace Antares::Constants { - +namespace Antares::Constants +{ extern const std::array daysPerMonth; -} // namespace constants +} // namespace Antares::Constants /*! Max number of MC years */ constexpr unsigned int MAX_NB_MC_YEARS = 50000; diff --git a/src/libs/antares/logs/cleaner.cpp b/src/libs/antares/logs/cleaner.cpp index be56378e4b..2b2d2c6c46 100644 --- a/src/libs/antares/logs/cleaner.cpp +++ b/src/libs/antares/logs/cleaner.cpp @@ -35,7 +35,6 @@ using namespace Yuni; namespace Antares { - static inline bool IsLeapYear(uint year) { if (0 == year % 4) diff --git a/src/libs/antares/logs/logs.h b/src/libs/antares/logs/logs.h index 2e073f0c57..5a7373ae82 100644 --- a/src/libs/antares/logs/logs.h +++ b/src/libs/antares/logs/logs.h @@ -78,16 +78,16 @@ namespace Antares { //! Handlers for logging using LoggingHandlers = Yuni::Logs::StdCout< // For writing to the standard output - Yuni::Logs::File< // For writing into a log file - Yuni::Logs::Callback<> // Callback - >>; + Yuni::Logs::File< // For writing into a log file + Yuni::Logs::Callback<> // Callback + >>; //! Decorators for logging -using LoggingDecorators = Yuni::Logs::Time< // Date/Time when the entry log is added - Yuni::Logs::ApplicationName< // Name of the current running application - Yuni::Logs::VerbosityLevel< // Verbosity level (info, warning...) - Yuni::Logs::Message<> // The real message - >>>; +using LoggingDecorators = Yuni::Logs::Time< // Date/Time when the entry log is added + Yuni::Logs::ApplicationName< // Name of the current running application + Yuni::Logs::VerbosityLevel< // Verbosity level (info, warning...) + Yuni::Logs::Message<> // The real message + >>>; //! Our log facility extern Yuni::Logs::Logger logs; diff --git a/src/libs/antares/memory/memory.cpp b/src/libs/antares/memory/memory.cpp index 0dbc8c32bd..831924caea 100644 --- a/src/libs/antares/memory/memory.cpp +++ b/src/libs/antares/memory/memory.cpp @@ -113,8 +113,7 @@ bool Memory::initializeTemporaryFolder() if (not pCacheFolder.empty() and not pAllowedToChangeCacheFolder and not IO::Directory::Create(pCacheFolder)) { - logs.warning() << "Impossible to create the cache folder " - << pCacheFolder; + logs.warning() << "Impossible to create the cache folder " << pCacheFolder; pCacheFolder.clear(); } return true; diff --git a/src/libs/antares/memory/memory.h b/src/libs/antares/memory/memory.h index 110ac31474..4f2e60751c 100644 --- a/src/libs/antares/memory/memory.h +++ b/src/libs/antares/memory/memory.h @@ -31,12 +31,11 @@ #include #include - namespace Antares { namespace Data { - class StudyMemoryUsage; +class StudyMemoryUsage; } // namespace Data } // namespace Antares @@ -117,7 +116,6 @@ class Memory final : public Yuni::Policy::ObjectLevelLockable static void Assign(uint count, U* array, const U& value); public: - template static void Allocate(T*& out, size_t size); @@ -156,7 +154,7 @@ class Memory final : public Yuni::Policy::ObjectLevelLockable */ ~Memory() = default; //@} - + bool initializeTemporaryFolder(); //@} diff --git a/src/libs/antares/memory/memory.hxx b/src/libs/antares/memory/memory.hxx index 53102d904d..e70096c6ae 100644 --- a/src/libs/antares/memory/memory.hxx +++ b/src/libs/antares/memory/memory.hxx @@ -35,17 +35,20 @@ inline Yuni::uint64 Memory::processID() const } template -Memory::Array::Array(const Yuni::NullPtr&) -{} +Memory::Array::Array(const Yuni::NullPtr&) +{ +} template Memory::Array::Array(const Memory::Array&) -{} +{ +} template template Memory::Array::Array(const Memory::Array&) -{} +{ +} template inline Memory::Array::Array(size_t size) @@ -105,7 +108,6 @@ inline bool Memory::StrictNull(const T* out) return !out; } - template inline U* Memory::RawPointer(U* array) { diff --git a/src/libs/antares/object/intrusive-reference.h b/src/libs/antares/object/intrusive-reference.h index 2ca4aea133..e8ab854285 100644 --- a/src/libs/antares/object/intrusive-reference.h +++ b/src/libs/antares/object/intrusive-reference.h @@ -60,7 +60,8 @@ class IIntrusiveReference : public TP> //! A default type using PtrSingleThreaded = Yuni::SmartPtr; //! The most suitable smart pointer for T - using Ptr = typename Yuni::Static::If::ResultType; + using Ptr = typename Yuni::Static:: + If::ResultType; }; // class SmartPtr public: diff --git a/src/libs/antares/object/object.h b/src/libs/antares/object/object.h index effa2d6aff..1b296a80a1 100644 --- a/src/libs/antares/object/object.h +++ b/src/libs/antares/object/object.h @@ -127,7 +127,8 @@ class IObject : public Yuni::IIntrusiveSmartPtr protected: //! The most suitable type for a bool - using EnableType = Yuni::Static::If,bool>::ResultType; + using EnableType + = Yuni::Static::If, bool>::ResultType; //! Object Identifier const Ref pOID; diff --git a/src/libs/antares/study/area/list.cpp b/src/libs/antares/study/area/list.cpp index 58322d7af5..10eb039e56 100644 --- a/src/libs/antares/study/area/list.cpp +++ b/src/libs/antares/study/area/list.cpp @@ -1207,7 +1207,7 @@ void AreaList::ensureDataIsInitialized(Parameters& params, bool loadOnlyNeeded) AreaListEnsureDataThermalTimeSeries(this); AreaListEnsureDataRenewableTimeSeries(this); - if(loadOnlyNeeded) + if (loadOnlyNeeded) { // Load if (params.isTSGeneratedByPrepro(timeSeriesLoad)) diff --git a/src/libs/antares/study/area/store-timeseries-numbers.cpp b/src/libs/antares/study/area/store-timeseries-numbers.cpp index aef2a8f2d7..6c22ba36a2 100644 --- a/src/libs/antares/study/area/store-timeseries-numbers.cpp +++ b/src/libs/antares/study/area/store-timeseries-numbers.cpp @@ -61,7 +61,7 @@ static void genericStoreTimeseriesNumbers(Solver::IResultWriter::Ptr writer, std::string buffer; timeseriesNumbers.saveToBuffer(buffer, 0, // precision - true, // print_dimensions + true, // print_dimensions predicate, // predicate true); // save even if all coeffs are zero diff --git a/src/libs/antares/study/fwd.cpp b/src/libs/antares/study/fwd.cpp index eedb999364..17f6cf64b0 100644 --- a/src/libs/antares/study/fwd.cpp +++ b/src/libs/antares/study/fwd.cpp @@ -368,9 +368,10 @@ mpsExportStatus stringToMPSexportStatus(const AnyString& value) CString<24, false> v = value; v.trim(); v.toLower(); - if (v == "both-optims" || v == "true") // Case "true" : for compatibily with older study versions + if (v == "both-optims" + || v == "true") // Case "true" : for compatibily with older study versions return mpsExportStatus::EXPORT_BOTH_OPTIMS; - if (v == "none" || v == "false") // Case "false" : for compatibily with older study versions + if (v == "none" || v == "false") // Case "false" : for compatibily with older study versions return mpsExportStatus::NO_EXPORT; if (v == "optim-1") return mpsExportStatus::EXPORT_FIRST_OPTIM; diff --git a/src/libs/antares/study/layerdata.cpp b/src/libs/antares/study/layerdata.cpp index 28262a08bf..3da179292b 100644 --- a/src/libs/antares/study/layerdata.cpp +++ b/src/libs/antares/study/layerdata.cpp @@ -25,7 +25,6 @@ ** SPDX-License-Identifier: licenceRef-GPL3_WITH_RTE-Exceptions */ - #include #include #include @@ -38,11 +37,10 @@ using namespace Yuni; namespace Antares::Data { - void LayerData::loadLayers(const AnyString& filename) { IniFile ini; - if (std::ifstream(filename.c_str()).good() && ini.open(filename) ) // check if file exists + if (std::ifstream(filename.c_str()).good() && ini.open(filename)) // check if file exists { // The section if (auto* section = ini.find("layers"); section) diff --git a/src/libs/antares/study/layerdata.h b/src/libs/antares/study/layerdata.h index b815925ee6..bd990ab807 100644 --- a/src/libs/antares/study/layerdata.h +++ b/src/libs/antares/study/layerdata.h @@ -40,9 +40,9 @@ class LayerData { public: LayerData(size_t activeLayer, bool showLayer) : - activeLayerID(activeLayer), - showAllLayer(showLayer) - {} + activeLayerID(activeLayer), showAllLayer(showLayer) + { + } //! \name Layers //@{ diff --git a/src/libs/antares/study/memory-usage.cpp b/src/libs/antares/study/memory-usage.cpp index 0d5c77c307..34a7f9b8cb 100644 --- a/src/libs/antares/study/memory-usage.cpp +++ b/src/libs/antares/study/memory-usage.cpp @@ -152,11 +152,11 @@ Yuni::uint64 computeOverheadDiskSpaceForAnyDataLevelComponent() // Reminder : a data level can be an area, a link or a binding constraint Yuni::uint64 diskSpace = 0; - diskSpace += 160 * 1024; // hourly - diskSpace += 6 * 1024; // daily - diskSpace += 6 * 1024; // weekly - diskSpace += 2 * 1024; // monthly - diskSpace += 1024; // annual + diskSpace += 160 * 1024; // hourly + diskSpace += 6 * 1024; // daily + diskSpace += 6 * 1024; // weekly + diskSpace += 2 * 1024; // monthly + diskSpace += 1024; // annual return diskSpace; } diff --git a/src/libs/antares/study/parameters.cpp b/src/libs/antares/study/parameters.cpp index 9bddfc8f79..b0e8bf8301 100644 --- a/src/libs/antares/study/parameters.cpp +++ b/src/libs/antares/study/parameters.cpp @@ -1578,8 +1578,7 @@ void Parameters::prepareForSimulation(const StudyLoadOptions& options) // Indicate ortools solver used if (ortoolsUsed) { - logs.info() << " :: ortools solver " << ortoolsSolver - << " used for problem resolution"; + logs.info() << " :: ortools solver " << ortoolsSolver << " used for problem resolution"; } } diff --git a/src/libs/antares/study/parameters.h b/src/libs/antares/study/parameters.h index bca7c8b853..7590fe3413 100644 --- a/src/libs/antares/study/parameters.h +++ b/src/libs/antares/study/parameters.h @@ -41,7 +41,6 @@ #include - namespace Antares { namespace Data diff --git a/src/libs/antares/study/parts/common/series.hxx b/src/libs/antares/study/parts/common/series.hxx index 66505c3261..2fa2e0908e 100644 --- a/src/libs/antares/study/parts/common/series.hxx +++ b/src/libs/antares/study/parts/common/series.hxx @@ -31,7 +31,6 @@ namespace Antares { namespace Data { - inline Yuni::uint64 DataSeriesMemoryUsage(DataSeriesCommon* t) { return (t) ? t->series.memoryUsage() : 0; diff --git a/src/libs/antares/study/parts/hydro/series.cpp b/src/libs/antares/study/parts/hydro/series.cpp index 2f63caf793..83e0eddba7 100644 --- a/src/libs/antares/study/parts/hydro/series.cpp +++ b/src/libs/antares/study/parts/hydro/series.cpp @@ -303,7 +303,9 @@ uint64 DataSeriesHydro::memoryUsage() const return sizeof(double) + ror.memoryUsage() + storage.memoryUsage(); } -void DataSeriesHydro::AdjustMonth(const Study& study, uint firstDayMonth[13], uint daysPerMonthDecals[12]) +void DataSeriesHydro::AdjustMonth(const Study& study, + uint firstDayMonth[13], + uint daysPerMonthDecals[12]) { for (int oldMonth = 0; oldMonth < 12; oldMonth++) { diff --git a/src/libs/antares/study/parts/hydro/series.h b/src/libs/antares/study/parts/hydro/series.h index 7d1d6e53cf..751f3b1bad 100644 --- a/src/libs/antares/study/parts/hydro/series.h +++ b/src/libs/antares/study/parts/hydro/series.h @@ -127,7 +127,9 @@ class DataSeriesHydro */ uint count; - static void AdjustMonth(const Study& study, uint firstDayMonth[13], uint daysPerMonthDecals[12]); + static void AdjustMonth(const Study& study, + uint firstDayMonth[13], + uint daysPerMonthDecals[12]); /*! ** \brief Monte-Carlo diff --git a/src/libs/antares/study/parts/hydro/series.hxx b/src/libs/antares/study/parts/hydro/series.hxx index fa3ca96fd9..82c2176de6 100644 --- a/src/libs/antares/study/parts/hydro/series.hxx +++ b/src/libs/antares/study/parts/hydro/series.hxx @@ -31,8 +31,7 @@ namespace Antares { namespace Data { - - // gp : whole file to be removed +// gp : whole file to be removed } // namespace Data } // namespace Antares diff --git a/src/libs/antares/study/parts/renewable/cluster_list.cpp b/src/libs/antares/study/parts/renewable/cluster_list.cpp index b0a07b6bb5..9edbe30704 100644 --- a/src/libs/antares/study/parts/renewable/cluster_list.cpp +++ b/src/libs/antares/study/parts/renewable/cluster_list.cpp @@ -189,7 +189,6 @@ bool RenewableClusterList::loadFromFolder(const AnyString& folder, Area* area) << "'"; continue; } - } } diff --git a/src/libs/antares/study/parts/thermal/cluster_list.cpp b/src/libs/antares/study/parts/thermal/cluster_list.cpp index 4f1d699813..ea5ed893ff 100644 --- a/src/libs/antares/study/parts/thermal/cluster_list.cpp +++ b/src/libs/antares/study/parts/thermal/cluster_list.cpp @@ -878,7 +878,8 @@ bool ThermalClusterList::loadPreproFromFolder(Study& study, if (empty()) return true; - const bool globalThermalTSgeneration = study.parameters.timeSeriesToGenerate & timeSeriesThermal; + const bool globalThermalTSgeneration + = study.parameters.timeSeriesToGenerate & timeSeriesThermal; Clob buffer; bool ret = true; diff --git a/src/libs/antares/study/parts/thermal/prepro.hxx b/src/libs/antares/study/parts/thermal/prepro.hxx index 83934d51e8..c0c9802cb4 100644 --- a/src/libs/antares/study/parts/thermal/prepro.hxx +++ b/src/libs/antares/study/parts/thermal/prepro.hxx @@ -31,7 +31,6 @@ namespace Antares { namespace Data { - inline Yuni::uint64 PreproThermal::memoryUsage() const { return sizeof(PreproThermal); diff --git a/src/libs/antares/study/runtime/runtime.cpp b/src/libs/antares/study/runtime/runtime.cpp index 0ea3af7d8c..49196d6d84 100644 --- a/src/libs/antares/study/runtime/runtime.cpp +++ b/src/libs/antares/study/runtime/runtime.cpp @@ -436,11 +436,13 @@ void StudyRuntimeInfos::checkThermalTSGeneration(Study& study) const auto& gd = study.parameters; bool globalThermalTSgeneration = gd.timeSeriesToGenerate & timeSeriesThermal; thermalTSRefresh = globalThermalTSgeneration; - + study.areas.each([this, globalThermalTSgeneration](Data::Area& area) { - area.thermal.list.each([this, globalThermalTSgeneration](const Data::ThermalCluster& cluster) { - thermalTSRefresh = thermalTSRefresh || cluster.doWeGenerateTS(globalThermalTSgeneration); - }); + area.thermal.list.each( + [this, globalThermalTSgeneration](const Data::ThermalCluster& cluster) { + thermalTSRefresh + = thermalTSRefresh || cluster.doWeGenerateTS(globalThermalTSgeneration); + }); }); } diff --git a/src/libs/antares/study/scenario-builder/TSnumberData.cpp b/src/libs/antares/study/scenario-builder/TSnumberData.cpp index 22673a8691..a1538e3f96 100644 --- a/src/libs/antares/study/scenario-builder/TSnumberData.cpp +++ b/src/libs/antares/study/scenario-builder/TSnumberData.cpp @@ -104,7 +104,9 @@ inline bool CheckValidity(uint value, } template<> -inline bool CheckValidity(uint value, const Data::AreaLink& data, uint /* tsGenMax */) +inline bool CheckValidity(uint value, + const Data::AreaLink& data, + uint /* tsGenMax */) { return value < data.directCapacities.width; } @@ -336,7 +338,8 @@ bool thermalTSNumberData::reset(const Study& study) return true; } -void thermalTSNumberData::saveToINIFile(const Study& /* study */, Yuni::IO::File::Stream& file) const +void thermalTSNumberData::saveToINIFile(const Study& /* study */, + Yuni::IO::File::Stream& file) const { // Prefix CString<512, false> prefix; @@ -469,7 +472,8 @@ uint renewableTSNumberData::get_tsGenCount(const Study& study) const return tsGenRenewable ? 1 : 0u; } -void renewableTSNumberData::saveToINIFile(const Study& /* study */, Yuni::IO::File::Stream& file) const +void renewableTSNumberData::saveToINIFile(const Study& /* study */, + Yuni::IO::File::Stream& file) const { // Prefix CString<512, false> prefix; diff --git a/src/libs/antares/study/scenario-builder/rules.cpp b/src/libs/antares/study/scenario-builder/rules.cpp index 551d57a018..8a958face3 100644 --- a/src/libs/antares/study/scenario-builder/rules.cpp +++ b/src/libs/antares/study/scenario-builder/rules.cpp @@ -152,7 +152,8 @@ bool Rules::readThermalCluster(const AreaName::Vector& splitKey, String value, b bool isTheActiveRule = (pName.toLower() == study_.parameters.activeRulesScenario.toLower()); if (!updaterMode and isTheActiveRule) { - std::string clusterId = (area->id).to() + "." + clustername.to(); + std::string clusterId + = (area->id).to() + "." + clustername.to(); disabledClustersOnRuleActive[clusterId].push_back(year + 1); return false; } @@ -188,7 +189,8 @@ bool Rules::readRenewableCluster(const AreaName::Vector& splitKey, String value, bool isTheActiveRule = (pName.toLower() == study_.parameters.activeRulesScenario.toLower()); if (!updaterMode and isTheActiveRule) { - std::string clusterId = (area->id).to() + "." + clustername.to(); + std::string clusterId + = (area->id).to() + "." + clustername.to(); disabledClustersOnRuleActive[clusterId].push_back(year + 1); return false; } @@ -356,20 +358,20 @@ bool Rules::apply() void Rules::sendWarningsForDisabledClusters() { - for (auto it = disabledClustersOnRuleActive.begin(); - it != disabledClustersOnRuleActive.end(); + for (auto it = disabledClustersOnRuleActive.begin(); it != disabledClustersOnRuleActive.end(); it++) { std::vector& scenariiForCurrentCluster = it->second; int nbScenariiForCluster = (int)scenariiForCurrentCluster.size(); std::vector::iterator itv = scenariiForCurrentCluster.begin(); - // Listing the 10 first years for which the current cluster was given a specific TS number + // Listing the 10 first years for which the current cluster was given a specific TS number // in the scenario builder. // Note that this list of years size could be less then 10, but are at least 1. std::string listYears = std::to_string(*itv); itv++; - for (int year_count = 1; itv != scenariiForCurrentCluster.end() && year_count < 10; itv++, year_count++) + for (int year_count = 1; itv != scenariiForCurrentCluster.end() && year_count < 10; + itv++, year_count++) listYears += ", " + std::to_string(*itv); // Adding last scenario to the list diff --git a/src/libs/antares/study/study.cpp b/src/libs/antares/study/study.cpp index 9f13eac4d1..29184733e7 100644 --- a/src/libs/antares/study/study.cpp +++ b/src/libs/antares/study/study.cpp @@ -224,7 +224,6 @@ uint64 Study::memoryUsage() const + (uiinfo ? uiinfo->memoryUsage() : 0); } - std::map Study::getRawNumberCoresPerLevel() { std::map table; diff --git a/src/libs/antares/study/variable-print-info.cpp b/src/libs/antares/study/variable-print-info.cpp index 62e2e9de80..fca83a0543 100644 --- a/src/libs/antares/study/variable-print-info.cpp +++ b/src/libs/antares/study/variable-print-info.cpp @@ -143,8 +143,8 @@ bool AllVariablesPrintInfo::setPrintStatus(std::string varname, bool printStatus /* From the position of the iterator on the print info collection, shifting right until reaching the print info associated to 'varname' argument. Then setting the good print - info object with 'printStatus' argument. If searched variable print info not found, returning - 'false' meaing we have an error. + info object with 'printStatus' argument. If searched variable print info not found, + returning 'false' meaing we have an error. */ std::transform(varname.begin(), varname.end(), varname.begin(), ::toupper); diff --git a/src/libs/antares/study/xcast/xcast.hxx b/src/libs/antares/study/xcast/xcast.hxx index c7908617d0..d3ed96d02e 100644 --- a/src/libs/antares/study/xcast/xcast.hxx +++ b/src/libs/antares/study/xcast/xcast.hxx @@ -33,7 +33,6 @@ namespace Antares { namespace Data { - inline Yuni::uint64 XCast::memoryUsage() const { return sizeof(XCast) + data.memoryUsage() + K.memoryUsage() + translation.memoryUsage() diff --git a/src/solver/constraints-builder/cbuilder.cpp b/src/solver/constraints-builder/cbuilder.cpp index b04190d2d2..439da9f73f 100644 --- a/src/solver/constraints-builder/cbuilder.cpp +++ b/src/solver/constraints-builder/cbuilder.cpp @@ -94,7 +94,7 @@ bool CBuilder::update(bool applyCheckBox) auto linkInfo = *linkInfoIt; Data::AreaLink* link = linkInfo->ptr; - // Try to open link data files (GUI only) + // Try to open link data files (GUI only) if (link->parameters.jit) { YString dataFilename = link->parameters.jit->sourceFilename; diff --git a/src/solver/constraints-builder/create.cpp b/src/solver/constraints-builder/create.cpp index 8e8fb2a3a2..a1353f1bbf 100644 --- a/src/solver/constraints-builder/create.cpp +++ b/src/solver/constraints-builder/create.cpp @@ -82,36 +82,32 @@ bool CBuilder::createConstraints(const std::vector& mesh) /*PN-TODO: Check the formula (page 3)*/ if (currentCycle.opType == Data::BindingConstraint::opEquality) ub += ((*line)->ptr->parameters[columnImpedance][hour] - * (*line)->ptr->parameters[columnLoopFlow][hour] - * includeLoopFlow - + (*line)->ptr->parameters[Data::fhlPShiftMinus][hour] - * includePhaseShift) - * currentCycle.sign[i]; + * (*line)->ptr->parameters[columnLoopFlow][hour] * includeLoopFlow + + (*line)->ptr->parameters[Data::fhlPShiftMinus][hour] + * includePhaseShift) + * currentCycle.sign[i]; else if (currentCycle.opType == Data::BindingConstraint::opBoth && hour + 1 <= calendarEnd && hour + 1 >= calendarStart) { ub += ((*line)->ptr->parameters[columnImpedance][hour] - * (*line)->ptr->parameters[columnLoopFlow][hour] - * includeLoopFlow) + * (*line)->ptr->parameters[columnLoopFlow][hour] * includeLoopFlow) * currentCycle.sign[i] - + std::min(((*line)->ptr->parameters[Data::fhlPShiftMinus][hour] - * includePhaseShift) - * currentCycle.sign[i], - ((*line)->ptr->parameters[Data::fhlPShiftPlus][hour] - * includePhaseShift) - * currentCycle.sign[i]); - + + std::min(((*line)->ptr->parameters[Data::fhlPShiftMinus][hour] + * includePhaseShift) + * currentCycle.sign[i], + ((*line)->ptr->parameters[Data::fhlPShiftPlus][hour] + * includePhaseShift) + * currentCycle.sign[i]); lb += ((*line)->ptr->parameters[columnImpedance][hour] - * (*line)->ptr->parameters[columnLoopFlow][hour] - * includeLoopFlow) + * (*line)->ptr->parameters[columnLoopFlow][hour] * includeLoopFlow) * currentCycle.sign[i] - + std::max(((*line)->ptr->parameters[Data::fhlPShiftMinus][hour] - * includePhaseShift) - * currentCycle.sign[i], - ((*line)->ptr->parameters[Data::fhlPShiftPlus][hour] - * includePhaseShift) - * currentCycle.sign[i]); + + std::max(((*line)->ptr->parameters[Data::fhlPShiftMinus][hour] + * includePhaseShift) + * currentCycle.sign[i], + ((*line)->ptr->parameters[Data::fhlPShiftPlus][hour] + * includePhaseShift) + * currentCycle.sign[i]); } else { diff --git a/src/solver/constraints-builder/grid.hxx b/src/solver/constraints-builder/grid.hxx index 97ac0aa9bf..bfc6785c14 100644 --- a/src/solver/constraints-builder/grid.hxx +++ b/src/solver/constraints-builder/grid.hxx @@ -211,7 +211,7 @@ bool Grid::buildMesh() for (uint i = 0; i < linksToBeAdded.size(); i++) { - logs.info() << "Searching basis (loop " << i+1 << "/" << linksToBeAdded.size() << ")"; + logs.info() << "Searching basis (loop " << i + 1 << "/" << linksToBeAdded.size() << ")"; // build the graph with two copies (+/-) for each node and edge Grid polarisedDuplicate; getDuplicatedGrid(polarisedDuplicate); diff --git a/src/solver/hydro/daily/h2o_j_ajouter_bruit_au_cout.cpp b/src/solver/hydro/daily/h2o_j_ajouter_bruit_au_cout.cpp index bff9ed9655..85c9c7da72 100644 --- a/src/solver/hydro/daily/h2o_j_ajouter_bruit_au_cout.cpp +++ b/src/solver/hydro/daily/h2o_j_ajouter_bruit_au_cout.cpp @@ -22,7 +22,8 @@ void H2O_J_AjouterBruitAuCout(DONNEES_MENSUELLES* donnesMensuelles) { for (int j = 0; j < ProblemeLineairePartieFixe[i]->NombreDeVariables; j++) { - ProblemeLineairePartieFixe[i]->CoutLineaire[j] += noiseGenerator() * Constants::noiseAmplitude; + ProblemeLineairePartieFixe[i]->CoutLineaire[j] + += noiseGenerator() * Constants::noiseAmplitude; } ProblemeLineairePartieFixe[i] diff --git a/src/solver/hydro/daily2/h2o2_j_donnees_optimisation.h b/src/solver/hydro/daily2/h2o2_j_donnees_optimisation.h index 7e0fe3cb54..5059eee93d 100644 --- a/src/solver/hydro/daily2/h2o2_j_donnees_optimisation.h +++ b/src/solver/hydro/daily2/h2o2_j_donnees_optimisation.h @@ -139,7 +139,7 @@ namespace Antares::Constants { constexpr double noiseAmplitude = 1e-3; constexpr unsigned int seed = 0x79683264; // "hyd2" in hexa -} // namespace Constants +} // namespace Antares::Constants class Hydro_problem_costs { diff --git a/src/solver/hydro/management/management.h b/src/solver/hydro/management/management.h index b725f7764c..57a223b6df 100644 --- a/src/solver/hydro/management/management.h +++ b/src/solver/hydro/management/management.h @@ -109,7 +109,6 @@ class HydroManagement final dayYearCount = 366 }; - public: //! Reference to the study Data::Study& study; diff --git a/src/solver/hydro/monthly/h2o_m_ajouter_bruit.cpp b/src/solver/hydro/monthly/h2o_m_ajouter_bruit.cpp index 95788e2e99..9bd90bac18 100644 --- a/src/solver/hydro/monthly/h2o_m_ajouter_bruit.cpp +++ b/src/solver/hydro/monthly/h2o_m_ajouter_bruit.cpp @@ -45,7 +45,8 @@ void H2O_M_AjouterBruitAuCout(DONNEES_ANNUELLES* DonneesAnnuelles) for (Pdt = 0; Pdt < NbPdt; Pdt++) { Var = variable[Pdt]; - CoutLineaireBruite[Var] = CoutLineaire[Var] + noiseGenerator() * Constants::noiseAmplitude; + CoutLineaireBruite[Var] + = CoutLineaire[Var] + noiseGenerator() * Constants::noiseAmplitude; } } Var = CorrespondanceDesVariables->NumeroDeLaVariableViolMaxVolumeMin; diff --git a/src/solver/hydro/monthly/h2o_m_resoudre_le_probleme_lineaire.c b/src/solver/hydro/monthly/h2o_m_resoudre_le_probleme_lineaire.c index 9922cdb373..68f8654dcd 100644 --- a/src/solver/hydro/monthly/h2o_m_resoudre_le_probleme_lineaire.c +++ b/src/solver/hydro/monthly/h2o_m_resoudre_le_probleme_lineaire.c @@ -180,13 +180,15 @@ void H2O_M_ResoudreLeProblemeLineaire(DONNEES_ANNUELLES* DonneesAnnuelles, int N ProblemeHydraulique->CoutDeLaSolution = 0.0; for (Var = 0; Var < Probleme->NombreDeVariables; Var++) { - ProblemeHydraulique->CoutDeLaSolution += ProblemeLineairePartieFixe->CoutLineaire[Var] * Probleme->X[Var]; + ProblemeHydraulique->CoutDeLaSolution + += ProblemeLineairePartieFixe->CoutLineaire[Var] * Probleme->X[Var]; } ProblemeHydraulique->CoutDeLaSolutionBruite = 0.0; for (Var = 0; Var < Probleme->NombreDeVariables; Var++) { - ProblemeHydraulique->CoutDeLaSolutionBruite += ProblemeLineairePartieFixe->CoutLineaireBruite[Var] * Probleme->X[Var]; + ProblemeHydraulique->CoutDeLaSolutionBruite + += ProblemeLineairePartieFixe->CoutLineaireBruite[Var] * Probleme->X[Var]; } DonneesAnnuelles->ResultatsValides = OUI; diff --git a/src/solver/optimisation/opt_appel_solveur_lineaire.cpp b/src/solver/optimisation/opt_appel_solveur_lineaire.cpp index 08652efb79..5261a02851 100644 --- a/src/solver/optimisation/opt_appel_solveur_lineaire.cpp +++ b/src/solver/optimisation/opt_appel_solveur_lineaire.cpp @@ -380,9 +380,10 @@ bool OPT_AppelDuSimplexe(PROBLEME_HEBDO* ProblemeHebdo, return true; } -void OPT_EcrireResultatFonctionObjectiveAuFormatTXT(double optimalSolutionCost, - std::shared_ptr optPeriodStringGenerator, - int optimizationNumber) +void OPT_EcrireResultatFonctionObjectiveAuFormatTXT( + double optimalSolutionCost, + std::shared_ptr optPeriodStringGenerator, + int optimizationNumber) { Yuni::Clob buffer; auto study = Data::Study::Current::Get(); diff --git a/src/solver/optimisation/opt_export_structure.cpp b/src/solver/optimisation/opt_export_structure.cpp index af21799c3a..3079b4281d 100644 --- a/src/solver/optimisation/opt_export_structure.cpp +++ b/src/solver/optimisation/opt_export_structure.cpp @@ -30,7 +30,6 @@ #include "opt_export_structure.h" - //////////////////////////////////////////////////////////////////// // Export de la structure des LPs //////////////////////////////////////////////////////////////////// diff --git a/src/solver/optimisation/opt_fonctions.h b/src/solver/optimisation/opt_fonctions.h index 787a73c6ba..c802fdd88b 100644 --- a/src/solver/optimisation/opt_fonctions.h +++ b/src/solver/optimisation/opt_fonctions.h @@ -64,7 +64,10 @@ bool OPT_PilotageOptimisationQuadratique(PROBLEME_HEBDO*); ** ** \return True si l'operation s'est bien deroulee, false si le probleme n'a pas de solution */ -bool OPT_AppelDuSimplexe(PROBLEME_HEBDO*, int, const int, std::shared_ptr); +bool OPT_AppelDuSimplexe(PROBLEME_HEBDO*, + int, + const int, + std::shared_ptr); void OPT_LiberationProblemesSimplexe(PROBLEME_HEBDO*); bool OPT_OptimisationLineaire(PROBLEME_HEBDO*, uint); void OPT_SauvegarderLesPmaxThermiques(PROBLEME_HEBDO*); @@ -87,7 +90,9 @@ void OPT_DecompteDesVariablesEtDesContraintesDuProblemeAOptimiser(PROBLEME_HEBDO void OPT_AugmenterLaTailleDeLaMatriceDesContraintes(PROBLEME_ANTARES_A_RESOUDRE*); void OPT_LiberationMemoireDuProblemeAOptimiser(PROBLEME_HEBDO*); -void OPT_EcrireResultatFonctionObjectiveAuFormatTXT(double, std::shared_ptr, int); +void OPT_EcrireResultatFonctionObjectiveAuFormatTXT(double, + std::shared_ptr, + int); /*------------------------------*/ diff --git a/src/solver/optimisation/opt_gestion_des_bornes_cas_lineaire.cpp b/src/solver/optimisation/opt_gestion_des_bornes_cas_lineaire.cpp index 3f4cb80250..e3b3a1c146 100644 --- a/src/solver/optimisation/opt_gestion_des_bornes_cas_lineaire.cpp +++ b/src/solver/optimisation/opt_gestion_des_bornes_cas_lineaire.cpp @@ -168,7 +168,7 @@ void setBoundsForUnsuppliedEnergy(PROBLEME_HEBDO* ProblemeHebdo, void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* ProblemeHebdo, const int PremierPdtDeLIntervalle, - const int DernierPdtDeLIntervalle, + const int DernierPdtDeLIntervalle, const int optimizationNumber) { int PdtHebdo; @@ -437,7 +437,8 @@ void OPT_InitialiserLesBornesDesVariablesDuProblemeLineaire(PROBLEME_HEBDO* Prob } } - setBoundsForUnsuppliedEnergy(ProblemeHebdo, PremierPdtDeLIntervalle, DernierPdtDeLIntervalle, optimizationNumber); + setBoundsForUnsuppliedEnergy( + ProblemeHebdo, PremierPdtDeLIntervalle, DernierPdtDeLIntervalle, optimizationNumber); for (Pays = 0; Pays < ProblemeHebdo->NombreDePays; Pays++) { diff --git a/src/solver/optimisation/opt_gestion_des_couts_cas_lineaire.cpp b/src/solver/optimisation/opt_gestion_des_couts_cas_lineaire.cpp index dc78cdc9a8..71f07d25eb 100644 --- a/src/solver/optimisation/opt_gestion_des_couts_cas_lineaire.cpp +++ b/src/solver/optimisation/opt_gestion_des_couts_cas_lineaire.cpp @@ -157,7 +157,6 @@ void OPT_InitialiserLesCoutsLineaire(PROBLEME_HEBDO* ProblemeHebdo, if (Var >= 0 && Var < ProblemeAResoudre->NombreDeVariables) { - ProblemeAResoudre->CoutLineaire[Var] = ProblemeHebdo ->BruitSurCoutHydraulique[Pays][ProblemeHebdo->HeureDansLAnnee + PdtHebdo]; diff --git a/src/solver/optimisation/opt_gestion_second_membre_cas_lineaire.cpp b/src/solver/optimisation/opt_gestion_second_membre_cas_lineaire.cpp index aaaab0195b..6179d0c6de 100644 --- a/src/solver/optimisation/opt_gestion_second_membre_cas_lineaire.cpp +++ b/src/solver/optimisation/opt_gestion_second_membre_cas_lineaire.cpp @@ -190,7 +190,9 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaire(PROBLEME_HEBDO* ProblemeHeb { SecondMembre[Cnt] = MatriceDesContraintesCouplantes ->SecondMembreDeLaContrainteCouplante[PdtHebdo]; - AdresseOuPlacerLaValeurDesCoutsMarginaux[Cnt] = ProblemeHebdo->ResultatsContraintesCouplantes[CntCouplante].variablesDuales + PdtHebdo; + AdresseOuPlacerLaValeurDesCoutsMarginaux[Cnt] + = ProblemeHebdo->ResultatsContraintesCouplantes[CntCouplante].variablesDuales + + PdtHebdo; } } } @@ -223,7 +225,9 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaire(PROBLEME_HEBDO* ProblemeHeb { SecondMembre[Cnt] = MatriceDesContraintesCouplantes->SecondMembreDeLaContrainteCouplante[Jour]; - AdresseOuPlacerLaValeurDesCoutsMarginaux[Cnt] = ProblemeHebdo->ResultatsContraintesCouplantes[CntCouplante].variablesDuales + Jour; + AdresseOuPlacerLaValeurDesCoutsMarginaux[Cnt] + = ProblemeHebdo->ResultatsContraintesCouplantes[CntCouplante].variablesDuales + + Jour; } } } @@ -250,7 +254,9 @@ void OPT_InitialiserLeSecondMembreDuProblemeLineaire(PROBLEME_HEBDO* ProblemeHeb { SecondMembre[Cnt] = MatriceDesContraintesCouplantes ->SecondMembreDeLaContrainteCouplante[Semaine]; - AdresseOuPlacerLaValeurDesCoutsMarginaux[Cnt] = ProblemeHebdo->ResultatsContraintesCouplantes[CntCouplante].variablesDuales + Semaine; + AdresseOuPlacerLaValeurDesCoutsMarginaux[Cnt] + = ProblemeHebdo->ResultatsContraintesCouplantes[CntCouplante].variablesDuales + + Semaine; } } } diff --git a/src/solver/optimisation/opt_optimisation_lineaire.cpp b/src/solver/optimisation/opt_optimisation_lineaire.cpp index 863920e742..b28bfd039e 100644 --- a/src/solver/optimisation/opt_optimisation_lineaire.cpp +++ b/src/solver/optimisation/opt_optimisation_lineaire.cpp @@ -46,7 +46,6 @@ double OPT_ObjectiveFunctionResult(const PROBLEME_HEBDO* Probleme, return Probleme->coutOptimalSolution2[NumeroDeLIntervalle]; } - bool OPT_OptimisationLineaire(PROBLEME_HEBDO* ProblemeHebdo, uint numSpace) { int PdtHebdo; @@ -103,19 +102,24 @@ bool OPT_OptimisationLineaire(PROBLEME_HEBDO* ProblemeHebdo, uint numSpace) // An optimization period represents a sequence as - or --, // depending whether the optimization is daily or weekly. - // These sequences are used when building the names of MPS or criterion files. - auto optPeriodStringGenerator = createOptPeriodAsString(ProblemeHebdo->OptimisationAuPasHebdomadaire, - NumeroDeLIntervalle, - ProblemeHebdo->weekInTheYear, - ProblemeHebdo->year); - - if (!OPT_AppelDuSimplexe(ProblemeHebdo, NumeroDeLIntervalle, optimizationNumber, optPeriodStringGenerator)) + // These sequences are used when building the names of MPS or criterion files. + auto optPeriodStringGenerator + = createOptPeriodAsString(ProblemeHebdo->OptimisationAuPasHebdomadaire, + NumeroDeLIntervalle, + ProblemeHebdo->weekInTheYear, + ProblemeHebdo->year); + + if (!OPT_AppelDuSimplexe( + ProblemeHebdo, NumeroDeLIntervalle, optimizationNumber, optPeriodStringGenerator)) return false; - if (ProblemeHebdo->ExportMPS != Data::mpsExportStatus::NO_EXPORT || ProblemeHebdo->Expansion == OUI_ANTARES) + if (ProblemeHebdo->ExportMPS != Data::mpsExportStatus::NO_EXPORT + || ProblemeHebdo->Expansion == OUI_ANTARES) { - double optimalSolutionCost = OPT_ObjectiveFunctionResult(ProblemeHebdo, NumeroDeLIntervalle, optimizationNumber); - OPT_EcrireResultatFonctionObjectiveAuFormatTXT(optimalSolutionCost, optPeriodStringGenerator, optimizationNumber); + double optimalSolutionCost + = OPT_ObjectiveFunctionResult(ProblemeHebdo, NumeroDeLIntervalle, optimizationNumber); + OPT_EcrireResultatFonctionObjectiveAuFormatTXT( + optimalSolutionCost, optPeriodStringGenerator, optimizationNumber); } } diff --git a/src/solver/optimisation/opt_restaurer_les_donnees.cpp b/src/solver/optimisation/opt_restaurer_les_donnees.cpp index 51e56f9c7b..322265726f 100644 --- a/src/solver/optimisation/opt_restaurer_les_donnees.cpp +++ b/src/solver/optimisation/opt_restaurer_les_donnees.cpp @@ -106,7 +106,8 @@ void OPT_RestaurerLesDonnees(PROBLEME_HEBDO* ProblemeHebdo, const int optimizati } } - if (ProblemeHebdo->YaDeLaReserveJmoins1 == OUI_ANTARES && optimizationNumber == PREMIERE_OPTIMISATION) + if (ProblemeHebdo->YaDeLaReserveJmoins1 == OUI_ANTARES + && optimizationNumber == PREMIERE_OPTIMISATION) { for (Pdt = 0; Pdt < DernierPasDeTemps; Pdt++) { diff --git a/src/solver/simulation/sim_alloc_probleme_hebdo.cpp b/src/solver/simulation/sim_alloc_probleme_hebdo.cpp index 5de893e971..5a2560e33a 100644 --- a/src/solver/simulation/sim_alloc_probleme_hebdo.cpp +++ b/src/solver/simulation/sim_alloc_probleme_hebdo.cpp @@ -692,7 +692,7 @@ void SIM_DesallocationProblemeHebdo(PROBLEME_HEBDO& problem) for (int k = 0; k < 7; k++) { MemFree(problem.CorrespondanceCntNativesCntOptimJournalieres[k] - ->NumeroDeContrainteDesContraintesCouplantes); + ->NumeroDeContrainteDesContraintesCouplantes); MemFree(problem.CorrespondanceCntNativesCntOptimJournalieres[k]); } MemFree(problem.CorrespondanceCntNativesCntOptimJournalieres); diff --git a/src/solver/simulation/sim_allocation_tableaux.cpp b/src/solver/simulation/sim_allocation_tableaux.cpp index 691cdaff73..18426bdd6c 100644 --- a/src/solver/simulation/sim_allocation_tableaux.cpp +++ b/src/solver/simulation/sim_allocation_tableaux.cpp @@ -173,7 +173,6 @@ void SIM_DesallocationTableaux() MemFree(ValeursGenereesParPays[numSpace][i]->HydrauliqueModulableQuotidien); MemFree(ValeursGenereesParPays[numSpace][i]->AleaCoutDeProductionParPalier); - if (area.hydro.reservoirManagement) { MemFree(ValeursGenereesParPays[numSpace][i]->NiveauxReservoirsDebutJours); diff --git a/src/solver/simulation/sim_calcul_economique.cpp b/src/solver/simulation/sim_calcul_economique.cpp index a4882a165b..5849e393d3 100644 --- a/src/solver/simulation/sim_calcul_economique.cpp +++ b/src/solver/simulation/sim_calcul_economique.cpp @@ -404,7 +404,8 @@ void SIM_RenseignementProblemeHebdo(PROBLEME_HEBDO& problem, logs.error() << "internal error. Please submit a full bug report"; break; } - } } + } + } } int weekDayIndex[8]; diff --git a/src/solver/simulation/sim_structure_probleme_economique.h b/src/solver/simulation/sim_structure_probleme_economique.h index 4043a1c680..39062722cb 100644 --- a/src/solver/simulation/sim_structure_probleme_economique.h +++ b/src/solver/simulation/sim_structure_probleme_economique.h @@ -490,7 +490,7 @@ struct PROBLEME_HEBDO { uint weekInTheYear = 0; uint year = 0; - + /* Business problem */ char OptimisationAuPasHebdomadaire; char TypeDeLissageHydraulique; diff --git a/src/solver/simulation/solver.hxx b/src/solver/simulation/solver.hxx index eeed75bae3..62a3566d52 100644 --- a/src/solver/simulation/solver.hxx +++ b/src/solver/simulation/solver.hxx @@ -40,7 +40,6 @@ #include #include "../ts-generator/generator.h" - #include "../hydro/management.h" // Added for use of randomReservoirLevel(...) #include diff --git a/src/solver/ts-generator/xcast/xcast.cpp b/src/solver/ts-generator/xcast/xcast.cpp index 5c40ad8cc8..f8a38d4760 100644 --- a/src/solver/ts-generator/xcast/xcast.cpp +++ b/src/solver/ts-generator/xcast/xcast.cpp @@ -591,9 +591,7 @@ bool XCast::runWithPredicate(PredicateT& predicate, Progression::Task& progressi if (study.parameters.derated) { - study.areas.each([&](Data::Area& area) { - predicate.matrix(area).averageTimeseries(); - }); + study.areas.each([&](Data::Area& area) { predicate.matrix(area).averageTimeseries(); }); } if (study.parameters.timeSeriesToArchive & timeSeriesType) diff --git a/src/solver/utils/filename.cpp b/src/solver/utils/filename.cpp index 96b8c3edab..dc862e9a93 100644 --- a/src/solver/utils/filename.cpp +++ b/src/solver/utils/filename.cpp @@ -6,22 +6,21 @@ // Optimization period factory // ------------------------------------ std::shared_ptr createOptPeriodAsString(bool isOptimizationWeekly, - unsigned int day, - unsigned int week, - unsigned int year) + unsigned int day, + unsigned int week, + unsigned int year) { if (isOptimizationWeekly) return std::make_shared(week, year); else return std::make_shared(day, week, year); - } - -std::string createOptimizationFilename(const std::string& title, - std::shared_ptr optPeriodStringGenerator, - unsigned int optNumber, - const std::string& extension) +std::string createOptimizationFilename( + const std::string& title, + std::shared_ptr optPeriodStringGenerator, + unsigned int optNumber, + const std::string& extension) { std::ostringstream outputFile; outputFile << title.c_str() << "-"; @@ -32,12 +31,15 @@ std::string createOptimizationFilename(const std::string& title, return outputFile.str(); } -std::string createCriterionFilename(std::shared_ptr optPeriodStringGenerator, const unsigned int optNumber) +std::string createCriterionFilename( + std::shared_ptr optPeriodStringGenerator, + const unsigned int optNumber) { return createOptimizationFilename("criterion", optPeriodStringGenerator, optNumber, "txt"); } -std::string createMPSfilename(std::shared_ptr optPeriodStringGenerator, const unsigned int optNumber) +std::string createMPSfilename(std::shared_ptr optPeriodStringGenerator, + const unsigned int optNumber) { return createOptimizationFilename("problem", optPeriodStringGenerator, optNumber, "mps"); } @@ -49,8 +51,7 @@ std::string getFilenameWithExtension(const YString& prefix, uint optNumber) { std::ostringstream outputFile; - outputFile << prefix.c_str() << "-" - << std::to_string(year + 1) << "-" + outputFile << prefix.c_str() << "-" << std::to_string(year + 1) << "-" << std::to_string(week + 1); if (optNumber) diff --git a/src/solver/utils/filename.h b/src/solver/utils/filename.h index 92841e6f81..d32337fe3f 100644 --- a/src/solver/utils/filename.h +++ b/src/solver/utils/filename.h @@ -13,9 +13,12 @@ std::string getFilenameWithExtension(const YString& prefix, uint optNumber); std::shared_ptr createOptPeriodAsString(bool isOptimizationWeekly, - unsigned int day, - unsigned int week, - unsigned int year); + unsigned int day, + unsigned int week, + unsigned int year); -std::string createCriterionFilename(std::shared_ptr optPeriodStringGenerator, const unsigned int optNumber); -std::string createMPSfilename(std::shared_ptr optPeriodStringGenerator, const unsigned int optNumber); +std::string createCriterionFilename( + std::shared_ptr optPeriodStringGenerator, + const unsigned int optNumber); +std::string createMPSfilename(std::shared_ptr optPeriodStringGenerator, + const unsigned int optNumber); diff --git a/src/solver/utils/mps_utils.cpp b/src/solver/utils/mps_utils.cpp index bac34d2475..95a2fd7ae4 100644 --- a/src/solver/utils/mps_utils.cpp +++ b/src/solver/utils/mps_utils.cpp @@ -89,10 +89,9 @@ class ProblemConverter std::vector mVariableType; }; -void OPT_EcrireJeuDeDonneesLineaireAuFormatMPS( - PROBLEME_SIMPLEXE_NOMME* Prob, - Solver::IResultWriter::Ptr writer, - const std::string& filename) +void OPT_EcrireJeuDeDonneesLineaireAuFormatMPS(PROBLEME_SIMPLEXE_NOMME* Prob, + Solver::IResultWriter::Ptr writer, + const std::string& filename) { logs.info() << "Solver MPS File: `" << filename << "'"; @@ -114,13 +113,12 @@ void OPT_EcrireJeuDeDonneesLineaireAuFormatMPS( // -------------------- // Full mps writing // -------------------- -fullMPSwriter::fullMPSwriter(PROBLEME_SIMPLEXE_NOMME* named_splx_problem, - uint optNumber) : - I_MPS_writer(optNumber), - named_splx_problem_(named_splx_problem) -{} +fullMPSwriter::fullMPSwriter(PROBLEME_SIMPLEXE_NOMME* named_splx_problem, uint optNumber) : + I_MPS_writer(optNumber), named_splx_problem_(named_splx_problem) +{ +} -void fullMPSwriter::runIfNeeded(Solver::IResultWriter::Ptr writer, const std::string & filename) +void fullMPSwriter::runIfNeeded(Solver::IResultWriter::Ptr writer, const std::string& filename) { OPT_EcrireJeuDeDonneesLineaireAuFormatMPS(named_splx_problem_, writer, filename); } @@ -128,17 +126,14 @@ void fullMPSwriter::runIfNeeded(Solver::IResultWriter::Ptr writer, const std::st // --------------------------------- // Full mps writing by or-tools // --------------------------------- -fullOrToolsMPSwriter::fullOrToolsMPSwriter(MPSolver* solver, - uint optNumber) : - I_MPS_writer(optNumber), - solver_(solver) +fullOrToolsMPSwriter::fullOrToolsMPSwriter(MPSolver* solver, uint optNumber) : + I_MPS_writer(optNumber), solver_(solver) { } -void fullOrToolsMPSwriter::runIfNeeded(Solver::IResultWriter::Ptr writer, const std::string & filename) +void fullOrToolsMPSwriter::runIfNeeded(Solver::IResultWriter::Ptr writer, + const std::string& filename) { - ORTOOLS_EcrireJeuDeDonneesLineaireAuFormatMPS(solver_, - writer, - filename); + ORTOOLS_EcrireJeuDeDonneesLineaireAuFormatMPS(solver_, writer, filename); } mpsWriterFactory::mpsWriterFactory(PROBLEME_HEBDO* ProblemeHebdo, @@ -195,12 +190,10 @@ std::unique_ptr mpsWriterFactory::createFullmpsWriter() { if (ortools_used_) { - return std::make_unique(solver_, - current_optim_number_); + return std::make_unique(solver_, current_optim_number_); } else { - return std::make_unique(named_splx_problem_, - current_optim_number_); + return std::make_unique(named_splx_problem_, current_optim_number_); } } diff --git a/src/solver/utils/mps_utils.h b/src/solver/utils/mps_utils.h index d1f41929bb..c470030f1b 100644 --- a/src/solver/utils/mps_utils.h +++ b/src/solver/utils/mps_utils.h @@ -24,9 +24,10 @@ class I_MPS_writer { public: explicit I_MPS_writer(uint currentOptimNumber) : current_optim_number_(currentOptimNumber) - {} + { + } I_MPS_writer() = default; - virtual void runIfNeeded(Solver::IResultWriter::Ptr writer, const std::string & filename) = 0; + virtual void runIfNeeded(Solver::IResultWriter::Ptr writer, const std::string& filename) = 0; protected: uint current_optim_number_ = 0; @@ -35,9 +36,8 @@ class I_MPS_writer class fullMPSwriter final : public I_MPS_writer { public: - fullMPSwriter(PROBLEME_SIMPLEXE_NOMME* named_splx_problem, - uint currentOptimNumber); - void runIfNeeded(Solver::IResultWriter::Ptr writer, const std::string & filename) override; + fullMPSwriter(PROBLEME_SIMPLEXE_NOMME* named_splx_problem, uint currentOptimNumber); + void runIfNeeded(Solver::IResultWriter::Ptr writer, const std::string& filename) override; private: PROBLEME_SIMPLEXE_NOMME* named_splx_problem_ = nullptr; @@ -46,9 +46,8 @@ class fullMPSwriter final : public I_MPS_writer class fullOrToolsMPSwriter : public I_MPS_writer { public: - fullOrToolsMPSwriter(MPSolver* solver, - uint currentOptimNumber); - void runIfNeeded(Solver::IResultWriter::Ptr writer, const std::string & filename) override; + fullOrToolsMPSwriter(MPSolver* solver, uint currentOptimNumber); + void runIfNeeded(Solver::IResultWriter::Ptr writer, const std::string& filename) override; private: MPSolver* solver_ = nullptr; @@ -58,7 +57,8 @@ class nullMPSwriter : public I_MPS_writer { public: using I_MPS_writer::I_MPS_writer; - void runIfNeeded(Solver::IResultWriter::Ptr /*writer*/, const std::string& /*filename*/) override + void runIfNeeded(Solver::IResultWriter::Ptr /*writer*/, + const std::string& /*filename*/) override { // Does nothing } diff --git a/src/solver/utils/named_problem.cpp b/src/solver/utils/named_problem.cpp index 0ee64baa50..8411838207 100644 --- a/src/solver/utils/named_problem.cpp +++ b/src/solver/utils/named_problem.cpp @@ -8,10 +8,10 @@ PROBLEME_SIMPLEXE_NOMME::PROBLEME_SIMPLEXE_NOMME(const std::vector& const std::vector& NomDesContraintes, std::vector& StatutDesVariables, std::vector& StatutDesContraintes) : - NomDesVariables(NomDesVariables), - NomDesContraintes(NomDesContraintes), - StatutDesVariables(StatutDesVariables), - StatutDesContraintes(StatutDesContraintes) + NomDesVariables(NomDesVariables), + NomDesContraintes(NomDesContraintes), + StatutDesVariables(StatutDesVariables), + StatutDesContraintes(StatutDesContraintes) { } diff --git a/src/solver/utils/named_problem.h b/src/solver/utils/named_problem.h index 08c5a84bba..59a338b0cb 100644 --- a/src/solver/utils/named_problem.h +++ b/src/solver/utils/named_problem.h @@ -13,7 +13,6 @@ namespace Optimization struct PROBLEME_SIMPLEXE_NOMME : public PROBLEME_SIMPLEXE { private: - public: PROBLEME_SIMPLEXE_NOMME(const std::vector& NomDesVariables, const std::vector& NomDesContraintes, diff --git a/src/solver/utils/opt_period_string_generator.cpp b/src/solver/utils/opt_period_string_generator.cpp index 6cc15fa563..4422abc616 100644 --- a/src/solver/utils/opt_period_string_generator.cpp +++ b/src/solver/utils/opt_period_string_generator.cpp @@ -1,6 +1,5 @@ #include "opt_period_string_generator.h" - // ------------------------------------ // Daily optimization // ------------------------------------ diff --git a/src/solver/utils/opt_period_string_generator.h b/src/solver/utils/opt_period_string_generator.h index 8164be9588..ad8471cfda 100644 --- a/src/solver/utils/opt_period_string_generator.h +++ b/src/solver/utils/opt_period_string_generator.h @@ -1,9 +1,7 @@ #pragma once - #include "../optimisation/opt_period_string_generator_base.h" - /* MPS and criterion generated files wear the same time interval sequence in their names. This time interval sequence is either - (for a weekly optimization), diff --git a/src/solver/utils/ortools_utils.cpp b/src/solver/utils/ortools_utils.cpp index 13fffa17ef..c18ce82db9 100644 --- a/src/solver/utils/ortools_utils.cpp +++ b/src/solver/utils/ortools_utils.cpp @@ -238,7 +238,7 @@ void ORTOOLS_EcrireJeuDeDonneesLineaireAuFormatMPS(MPSolver* solver, { // 0. Logging file name logs.info() << "Solver OR-Tools MPS File: `" << filename << "'"; - + // 1. Determine filename const auto tmpPath = generateTempPath(filename); @@ -298,7 +298,8 @@ MPSolver* ORTOOLS_Simplexe(Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* Probl // Save the final simplex basis for next resolutions if (keepBasis && !Probleme->isMIP() && Probleme->solverSupportsWarmStart) { - solver->GetFinalLpBasisInt(Probleme->StatutDesVariables, Probleme->StatutDesContraintes); + solver->GetFinalLpBasisInt(Probleme->StatutDesVariables, + Probleme->StatutDesContraintes); } } @@ -345,14 +346,11 @@ void ORTOOLS_LibererProbleme(MPSolver* solver) delete solver; } - -const std::map OrtoolsUtils::solverMap = -{ - {"xpress", {"xpress_lp", "xpress"}}, - {"sirius", {"sirius_lp", "sirius"}}, - {"coin", {"clp", "cbc"}}, - {"glpk", {"glpk_lp", "glpk"}} -}; +const std::map OrtoolsUtils::solverMap + = {{"xpress", {"xpress_lp", "xpress"}}, + {"sirius", {"sirius_lp", "sirius"}}, + {"coin", {"clp", "cbc"}}, + {"glpk", {"glpk_lp", "glpk"}}}; std::list getAvailableOrtoolsSolverName() { @@ -370,9 +368,10 @@ std::list getAvailableOrtoolsSolverName() return result; } -MPSolver* MPSolverFactory(const Antares::Optimization::PROBLEME_SIMPLEXE_NOMME *probleme, const std::string & solverName) +MPSolver* MPSolverFactory(const Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* probleme, + const std::string& solverName) { - MPSolver *solver; + MPSolver* solver; try { if (probleme->isMIP()) diff --git a/src/solver/utils/ortools_utils.h b/src/solver/utils/ortools_utils.h index fdfb9172f0..e5d63fe765 100644 --- a/src/solver/utils/ortools_utils.h +++ b/src/solver/utils/ortools_utils.h @@ -21,18 +21,17 @@ void ORTOOLS_EcrireJeuDeDonneesLineaireAuFormatMPS(MPSolver* solver, */ std::list getAvailableOrtoolsSolverName(); - /*! * \brief Create a MPSolver with correct linear or mixed variant * * \return MPSolver */ -MPSolver* MPSolverFactory(const Antares::Optimization::PROBLEME_SIMPLEXE_NOMME *probleme, const std::string & solverName); +MPSolver* MPSolverFactory(const Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* probleme, + const std::string& solverName); std::string generateTempPath(const std::string& filename); void removeTemporaryFile(const std::string& tmpPath); - class OrtoolsUtils { public: @@ -41,7 +40,6 @@ class OrtoolsUtils std::string LPSolverName, MIPSolverName; }; static const std::map solverMap; - }; namespace Antares diff --git a/src/solver/variable/adequacy/all.h b/src/solver/variable/adequacy/all.h index a83bf4fe6e..a0842c35e7 100644 --- a/src/solver/variable/adequacy/all.h +++ b/src/solver/variable/adequacy/all.h @@ -145,13 +145,13 @@ typedef // Prices >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> VariablesPerArea; /*! @@ -224,15 +224,12 @@ typedef // Prices Marge>>>>>>>>>>>>>>>>>>>>>>>>>>>> VariablesPerSetOfAreas; - -typedef - Variable::Economy::BindingConstMarginCost< // Marginal cost for a binding constraint - Container::EndOfList // End of variable list - > +typedef Variable::Economy::BindingConstMarginCost< // Marginal cost for a binding constraint + Container::EndOfList // End of variable list + > VariablesPerBindingConstraints; - typedef Variable::Join< // Variables for each area / links attached to the areas Variable::Areas, diff --git a/src/solver/variable/bc.memory-estimation.inc.hxx b/src/solver/variable/bc.memory-estimation.inc.hxx index 25d71d9ee3..35e2420536 100644 --- a/src/solver/variable/bc.memory-estimation.inc.hxx +++ b/src/solver/variable/bc.memory-estimation.inc.hxx @@ -48,36 +48,35 @@ uint64 BindingConstraints::memoryUsage() const template<> void BindingConstraints::EstimateMemoryUsage(Data::StudyMemoryUsage& u) { - u.study.bindingConstraints.eachEnabled( - [&](const Data::BindingConstraint& constraint) { - if (constraint.operatorType() == Data::BindingConstraint::opEquality) - return; + u.study.bindingConstraints.eachEnabled([&](const Data::BindingConstraint& constraint) { + if (constraint.operatorType() == Data::BindingConstraint::opEquality) + return; - int bc_count = 1; - // If the current binding constraint is double (has operators "<" and ">"), it is counted - // twice - if (constraint.operatorType() == Data::BindingConstraint::opBoth) - bc_count = 2; + int bc_count = 1; + // If the current binding constraint is double (has operators "<" and ">"), it is counted + // twice + if (constraint.operatorType() == Data::BindingConstraint::opBoth) + bc_count = 2; - for (int i = 0; i < bc_count; i++) - { - u.requiredMemoryForOutput += sizeof(NextType) + sizeof(void*) /*overhead vector*/; - u.overheadDiskSpaceForSingleBindConstraint(); + for (int i = 0; i < bc_count; i++) + { + u.requiredMemoryForOutput += sizeof(NextType) + sizeof(void*) /*overhead vector*/; + u.overheadDiskSpaceForSingleBindConstraint(); - // year-by-year - if (!u.gatheringInformationsForInput) - { - if (u.study.parameters.yearByYear && u.mode != Data::stdmAdequacyDraft) - { - for (unsigned int i = 0; i != u.years; ++i) - u.overheadDiskSpaceForSingleBindConstraint(); - } - } - } + // year-by-year + if (!u.gatheringInformationsForInput) + { + if (u.study.parameters.yearByYear && u.mode != Data::stdmAdequacyDraft) + { + for (unsigned int i = 0; i != u.years; ++i) + u.overheadDiskSpaceForSingleBindConstraint(); + } + } + } - // next - NextType::EstimateMemoryUsage(u); - }); + // next + NextType::EstimateMemoryUsage(u); + }); } } // namespace Variable diff --git a/src/solver/variable/bindConstraints.h b/src/solver/variable/bindConstraints.h index 4b1e8dd2c7..7e6039ec25 100644 --- a/src/solver/variable/bindConstraints.h +++ b/src/solver/variable/bindConstraints.h @@ -173,4 +173,3 @@ class BindingConstraints } // namespace Antares #include "bindConstraints.hxx" - diff --git a/src/solver/variable/commons/join.h b/src/solver/variable/commons/join.h index 3984da3825..09532b7018 100644 --- a/src/solver/variable/commons/join.h +++ b/src/solver/variable/commons/join.h @@ -125,7 +125,7 @@ class Join : public Variable::IVariable, Yuni::D enum { count = LeftType::template Statistics::count - + RightType::template Statistics::count + + RightType::template Statistics::count + BindConstType::template Statistics::count, }; }; diff --git a/src/solver/variable/economy/all.h b/src/solver/variable/economy/all.h index e691f7f376..beaab5ef10 100644 --- a/src/solver/variable/economy/all.h +++ b/src/solver/variable/economy/all.h @@ -161,8 +161,8 @@ typedef // Prices >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> VariablesPerArea; @@ -249,14 +249,11 @@ typedef // Prices >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> VariablesPerSetOfAreas; - +typedef BindingConstMarginCost< // Marginal cost for a binding constraint + Container::EndOfList // End of variable list + > -typedef - BindingConstMarginCost< // Marginal cost for a binding constraint - Container::EndOfList // End of variable list - > - - VariablesPerBindingConstraints; + VariablesPerBindingConstraints; typedef Variable::Join< // Variables for each area / links attached to the areas diff --git a/src/solver/variable/storage/intermediate.h b/src/solver/variable/storage/intermediate.h index 2263ae0715..7d3bce56dd 100644 --- a/src/solver/variable/storage/intermediate.h +++ b/src/solver/variable/storage/intermediate.h @@ -93,9 +93,9 @@ class IntermediateValues final void computeStatisticsAdequacyForTheCurrentYear(); // Compute averages for the current year from a particular time division results : - // For instances : + // For instances : // - compute averages daily to yearly, from hourly results - // - compute averages monthly to yearly, from weekly results + // - compute averages monthly to yearly, from weekly results void computeAveragesForCurrentYearFromHourlyResults(); void computeAveragesForCurrentYearFromDailyResults(); void computeAveragesForCurrentYearFromWeeklyResults(); @@ -151,8 +151,13 @@ class IntermediateValues final private: // non copyable - IntermediateValues(const IntermediateValues&) {} - IntermediateValues& operator=(const IntermediateValues&) { return *this; } + IntermediateValues(const IntermediateValues&) + { + } + IntermediateValues& operator=(const IntermediateValues&) + { + return *this; + } template void internalExportAnnualValues(SurveyResults& report, const A& array, bool annual) const; diff --git a/src/solver/variable/surveyresults/reportbuilder.hxx b/src/solver/variable/surveyresults/reportbuilder.hxx index 9ba02dce49..a4059273fa 100644 --- a/src/solver/variable/surveyresults/reportbuilder.hxx +++ b/src/solver/variable/surveyresults/reportbuilder.hxx @@ -418,8 +418,8 @@ private: results.data.output.clear(); results.data.output << results.data.originalOutput << SEP << "links" << SEP << area.id << " - " << results.data.link->with->id; - SurveyReportBuilderFile::Run(list, results, numSpace); - + SurveyReportBuilderFile::Run( + list, results, numSpace); } } } diff --git a/src/solver/variable/surveyresults/surveyresults.cpp b/src/solver/variable/surveyresults/surveyresults.cpp index b64af4d82c..ca759584eb 100644 --- a/src/solver/variable/surveyresults/surveyresults.cpp +++ b/src/solver/variable/surveyresults/surveyresults.cpp @@ -522,8 +522,8 @@ uint initializeMaxVariables(uint maxVars, const Data::StudyRuntimeInfos* runtime */ const uint nbVariablesPerDetailRenewableCluster = 1; // Production - // Max number of columns taken by an inequality binding constraint in a report - // (= output file). Here, this max is 4, and occurs in binding + // Max number of columns taken by an inequality binding constraint in a report + // (= output file). Here, this max is 4, and occurs in binding // constraint synythesis reports. const uint maxNbVariablesPerInequalityBindingConstraint = 4; diff --git a/src/solver/variable/variable.hxx b/src/solver/variable/variable.hxx index e0ec7c9984..4f94113293 100644 --- a/src/solver/variable/variable.hxx +++ b/src/solver/variable/variable.hxx @@ -551,7 +551,8 @@ template inline const double* IVariable::retrieveHourlyResultsForCurrentYear( uint numSpace) const { - using AssignT = RetrieveResultsAssignment::Yes>; + using AssignT + = RetrieveResultsAssignment::Yes>; return (AssignT::Yes) ? nullptr : NextType::template retrieveHourlyResultsForCurrentYear(numSpace); @@ -563,7 +564,8 @@ inline void IVariable::retrieveResultsForArea( typename Storage::ResultsType** result, const Data::Area* area) { - using AssignT = RetrieveResultsAssignment::Yes>; + using AssignT + = RetrieveResultsAssignment::Yes>; AssignT::Do(pResults, result); if (!AssignT::Yes) NextType::template retrieveResultsForArea(result, area); @@ -575,7 +577,8 @@ inline void IVariable::retrieveResultsForThermalCluster( typename Storage::ResultsType** result, const Data::ThermalCluster* cluster) { - using AssignT = RetrieveResultsAssignment::Yes>; + using AssignT + = RetrieveResultsAssignment::Yes>; AssignT::Do(pResults, result); if (!AssignT::Yes) NextType::template retrieveResultsForThermalCluster(result, cluster); @@ -587,7 +590,8 @@ inline void IVariable::retrieveResultsForLink( typename Storage::ResultsType** result, const Data::AreaLink* link) { - using AssignT = RetrieveResultsAssignment::Yes>; + using AssignT + = RetrieveResultsAssignment::Yes>; AssignT::Do(pResults, result); if (!AssignT::Yes) NextType::template retrieveResultsForLink(result, link); diff --git a/src/tools/kirchhoff-cbuilder/kirchhoff-cbuilder.h b/src/tools/kirchhoff-cbuilder/kirchhoff-cbuilder.h index 6a17b7fc92..380f37c074 100644 --- a/src/tools/kirchhoff-cbuilder/kirchhoff-cbuilder.h +++ b/src/tools/kirchhoff-cbuilder/kirchhoff-cbuilder.h @@ -32,6 +32,8 @@ static void NotEnoughMemory(); bool initResources(int argc, char* argv[]); bool initComponents(std::shared_ptr study, const std::string& studyPath); -bool runKirchhoffConstraints(std::shared_ptr study, const std::string& studyPath, const std::string& kirchhoffOptionPath); +bool runKirchhoffConstraints(std::shared_ptr study, + const std::string& studyPath, + const std::string& kirchhoffOptionPath); #endif // __KIRCHHOFF_CBUILDER_H__ diff --git a/src/tools/kirchhoff-cbuilder/main.cpp b/src/tools/kirchhoff-cbuilder/main.cpp index e41b329680..05dde92b34 100644 --- a/src/tools/kirchhoff-cbuilder/main.cpp +++ b/src/tools/kirchhoff-cbuilder/main.cpp @@ -41,7 +41,6 @@ using namespace Yuni; using namespace Antares; - int main(int argc, char* argv[]) { logs.applicationName("k-cbuild"); @@ -78,7 +77,8 @@ int main(int argc, char* argv[]) } bool runKirchhoffConstraints(std::shared_ptr study, - const std::string& studyPath, const std::string& kirchhoffOptionPath) + const std::string& studyPath, + const std::string& kirchhoffOptionPath) { study->areas.ensureDataIsInitialized(study->parameters, false); @@ -108,7 +108,8 @@ bool runKirchhoffConstraints(std::shared_ptr study, return false; } - auto bindingPath = studyPath + Yuni::IO::Separator + "input" + Yuni::IO::Separator + "bindingconstraints"; + auto bindingPath + = studyPath + Yuni::IO::Separator + "input" + Yuni::IO::Separator + "bindingconstraints"; if (!study->bindingConstraints.saveToFolder(bindingPath)) { @@ -140,7 +141,8 @@ bool initResources(int argc, char* argv[]) bool initComponents(std::shared_ptr study, const std::string& studyPath) { - study->header.version = Data::StudyHeader::ReadVersionFromFile(studyPath + Yuni::IO::Separator + "study.antares"); + study->header.version + = Data::StudyHeader::ReadVersionFromFile(studyPath + Yuni::IO::Separator + "study.antares"); study->folder = studyPath; study->folderInput = studyPath + Yuni::IO::Separator + "input"; study->inputExtension = "txt"; @@ -150,14 +152,15 @@ bool initComponents(std::shared_ptr study, const std::string& study Data::StudyLoadOptions options; options.loadOnlyNeeded = false; - if(!study->areas.loadFromFolder(options)) + if (!study->areas.loadFromFolder(options)) { logs.error() << "Areas loading failed"; return false; } logs.info() << "Areas loaded."; - auto bindingPath = studyPath + Yuni::IO::Separator + "input" + Yuni::IO::Separator + "bindingconstraints"; + auto bindingPath + = studyPath + Yuni::IO::Separator + "input" + Yuni::IO::Separator + "bindingconstraints"; if (!study->bindingConstraints.loadFromFolder(*study, options, bindingPath)) { diff --git a/src/tools/yby-aggregator/result.cpp b/src/tools/yby-aggregator/result.cpp index cc425b824c..4d8a249f12 100644 --- a/src/tools/yby-aggregator/result.cpp +++ b/src/tools/yby-aggregator/result.cpp @@ -152,7 +152,6 @@ bool ResultMatrix::saveToCSVFile(const String& filename) const dataBuffer[offset][x], columns[x].rows[offset + y], maxSizePerCell); } } - } } diff --git a/src/ui/simulator/application/main/create.cpp b/src/ui/simulator/application/main/create.cpp index 50d833fb0a..98fb2a45b1 100644 --- a/src/ui/simulator/application/main/create.cpp +++ b/src/ui/simulator/application/main/create.cpp @@ -120,7 +120,6 @@ class CustomStatusBar : public wxStatusBar }; // class StatusBar - static void CreateWindowToolbar(ApplWnd& mainfrm, wxAuiManager& auimanager) { // Our toolbar @@ -666,12 +665,14 @@ void ApplWnd::createNBInterconnections() // links parameters time series auto* parametersGrid = new_check_allocation(); - auto* intercoParam = new_check_allocation(page.first, page.second, parametersGrid); + auto* intercoParam + = new_check_allocation(page.first, page.second, parametersGrid); pageLinksParameters = page.first->add(intercoParam, wxT(" Parameters ")); // links NTC time series auto* ntcGrid = new_check_allocation(); - auto* intercoGrid = new_check_allocation(page.first, page.second, ntcGrid); + auto* intercoGrid + = new_check_allocation(page.first, page.second, ntcGrid); pageLinksNTC = page.first->add(intercoGrid, wxT(" Transmission capacities ")); // Summary diff --git a/src/ui/simulator/application/menus.cpp b/src/ui/simulator/application/menus.cpp index 3e8524f34f..6c98ad183e 100644 --- a/src/ui/simulator/application/menus.cpp +++ b/src/ui/simulator/application/menus.cpp @@ -278,9 +278,9 @@ wxMenuItem* Menu::CreateItem(wxMenu* parent, #endif #ifdef YUNI_OS_WINDOWS - m->SetMarginWidth(bitmap.GetWidth()); + m->SetMarginWidth(bitmap.GetWidth()); #endif - m->SetBitmap(bitmap); + m->SetBitmap(bitmap); parent->Append(m); diff --git a/src/ui/simulator/toolbox/components/map/component.cpp b/src/ui/simulator/toolbox/components/map/component.cpp index 197c5daec1..91607408ba 100644 --- a/src/ui/simulator/toolbox/components/map/component.cpp +++ b/src/ui/simulator/toolbox/components/map/component.cpp @@ -391,9 +391,8 @@ Antares::Component::MapNotebook::Page* Component::addNewLayer(wxString pageName, { size_t numberOffset = 0; - while ( - pNoteBook->find(wxString::FromUTF8("Map ") << pMapLayer->getUid() + numberOffset) - != nullptr) + while (pNoteBook->find(wxString::FromUTF8("Map ") << pMapLayer->getUid() + numberOffset) + != nullptr) numberOffset++; resultPage diff --git a/src/ui/simulator/toolbox/components/map/component.h b/src/ui/simulator/toolbox/components/map/component.h index 6755512a9c..063218a5e6 100644 --- a/src/ui/simulator/toolbox/components/map/component.h +++ b/src/ui/simulator/toolbox/components/map/component.h @@ -279,9 +279,9 @@ class Component final : public Antares::Component::Panel, public Yuni::IEventObs template inline void evtNewArea(wxCommandEvent&) { - if (pMapActiveLayer) - pMapActiveLayer->addNewNode(N); - setFocus(); + if (pMapActiveLayer) + pMapActiveLayer->addNewNode(N); + setFocus(); } void onToggleMouseSelectionArea(void*); diff --git a/src/ui/simulator/windows/connection.cpp b/src/ui/simulator/windows/connection.cpp index ad50c3310c..cd6f75cd90 100644 --- a/src/ui/simulator/windows/connection.cpp +++ b/src/ui/simulator/windows/connection.cpp @@ -93,11 +93,10 @@ void linkNTCgrid::add(wxBoxSizer* sizer, gridIndirect->setOtherGrid(gridDirect); } - Interconnection::Interconnection(wxWindow* parent, Toolbox::InputSelector::Connections* notifier, - linkGrid* link_grid) - : wxScrolledWindow(parent) + linkGrid* link_grid) : + wxScrolledWindow(parent) { auto* mainsizer = new_check_allocation(wxVERTICAL); SetSizer(mainsizer); @@ -126,19 +125,21 @@ Interconnection::Interconnection(wxWindow* parent, captionButton_ = new_check_allocation(pLinkData, sizer_flex_grid); // Hurdle costs button - hurdleCostsUsageButton_ = new_check_allocation(pLinkData, sizer_flex_grid); + hurdleCostsUsageButton_ + = new_check_allocation(pLinkData, sizer_flex_grid); // Link transmission capacities usage button ntcUsageButton_ = new_check_allocation(pLinkData, sizer_flex_grid); // Asset Type button assetTypeButton_ = new_check_allocation(pLinkData, sizer_flex_grid); - + // Loop flow usage button loopFlowUsageButton_ = new_check_allocation(pLinkData, sizer_flex_grid); // Phase Shifter usage button - phaseShifterUsageButton_ = new_check_allocation(pLinkData, sizer_flex_grid); + phaseShifterUsageButton_ + = new_check_allocation(pLinkData, sizer_flex_grid); sizer_vertical->AddSpacer(4); @@ -180,7 +181,8 @@ bool Interconnection::checkLinkView(Data::AreaLink* link) if (not sizer) return false; - if (captionButton_->hasNoButton() || hurdleCostsUsageButton_->hasNoButton() || ntcUsageButton_->hasNoButton()) + if (captionButton_->hasNoButton() || hurdleCostsUsageButton_->hasNoButton() + || ntcUsageButton_->hasNoButton()) { pLink = nullptr; sizer->Hide(pLinkData); @@ -203,7 +205,6 @@ bool Interconnection::checkLinkView(Data::AreaLink* link) return true; } - void Interconnection::updateLinkView(Data::AreaLink* link) { assert(link->from); @@ -217,9 +218,10 @@ void Interconnection::updateLinkView(Data::AreaLink* link) sizer->Show(pLinkData); sizer->Hide(pNoLink); - wxString linkCaption = wxStringFromUTF8(link->from->name) << wxT(" / ") << wxStringFromUTF8(link->with->name); + wxString linkCaption = wxStringFromUTF8(link->from->name) + << wxT(" / ") << wxStringFromUTF8(link->with->name); captionButton_->setCaption(linkCaption); - + captionButton_->update(link); hurdleCostsUsageButton_->update(link); loopFlowUsageButton_->update(link); diff --git a/src/ui/simulator/windows/connection.h b/src/ui/simulator/windows/connection.h index 8ede5c95a3..f80b230f95 100644 --- a/src/ui/simulator/windows/connection.h +++ b/src/ui/simulator/windows/connection.h @@ -49,7 +49,8 @@ class linkGrid virtual void add(wxBoxSizer* sizer, wxWindow* parent, Interconnection* intercoWindow, - Toolbox::InputSelector::Connections* notifier) = 0; + Toolbox::InputSelector::Connections* notifier) + = 0; }; class linkParametersGrid : public linkGrid @@ -74,8 +75,6 @@ class linkNTCgrid : public linkGrid Toolbox::InputSelector::Connections* notifier) override; }; - - class Interconnection : public wxScrolledWindow, public Yuni::IEventObserver { public: @@ -110,7 +109,7 @@ class Interconnection : public wxScrolledWindow, public Yuni::IEventObserver menuLinkButton::onSelectionChanges; +Yuni::Event menuLinkButton::onSelectionChanges; - menuLinkButton::menuLinkButton() - { - onSelectionChanges.connect(this, &menuLinkButton::update); - onPopup_.bind(this, &menuLinkButton::onPopupMenu); - } - - menuLinkButton::~menuLinkButton() - { - currentLink_ = nullptr; - destroyBoundEvents(); - } - - void menuLinkButton::bindButtonToPopupMenu() const - { - getButton()->onPopupMenu(onPopup_); - } - - void menuLinkButton::broadCastChange() const - { - onSelectionChanges(getCurrentLink()); - broadCastChangeOutside(); - } - - void menuLinkButton::broadCastChangeOutside() const - { - MarkTheStudyAsModified(); - OnInspectorRefresh(nullptr); - } - - - // ========================= - // NTC usage button - // ========================= - ntcUsageButton::ntcUsageButton(wxWindow* parent, - wxFlexGridSizer* sizer_flex_grid) - : menuLinkButton() - { - setButton(new_check_allocation(parent, wxT("Transmission capacities"), "images/16x16/light_green.png")); - getButton()->menu(true); - bindButtonToPopupMenu(); - - sizer_flex_grid->AddSpacer(10); - sizer_flex_grid->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - } - - void ntcUsageButton::update(Data::AreaLink* link) - { - setCurrentLink(link); - - switch (link->transmissionCapacities) - { - case Data::LocalTransmissionCapacities::enabled: - getButton()->caption(wxT("Use transmission capacities")); - getButton()->image("images/16x16/light_green.png"); - break; - case Data::LocalTransmissionCapacities::null: - getButton()->caption(wxT("Set transmission capacities to null")); - getButton()->image("images/16x16/light_orange.png"); - break; - case Data::LocalTransmissionCapacities::infinite: - getButton()->caption(wxT("Set transmission capacities to infinite")); - getButton()->image("images/16x16/infinity.png"); - break; - default: - break; - } - } - - void ntcUsageButton::onPopupMenu(Component::Button&, wxMenu& menu, void*) - { - const wxMenuItem* it; - - it = Menu::CreateItem(&menu, - wxID_ANY, - wxT("Use transmission capacities"), - "images/16x16/light_green.png", - wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(ntcUsageButton::onSelectUseNTC), - nullptr, - this); - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("Set to null"), "images/16x16/light_orange.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(ntcUsageButton::onSelectSetToNull), - nullptr, - this); - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("Set to infinite"), "images/16x16/infinity.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(ntcUsageButton::onSelectSetToInfinite), - nullptr, - this); - } - - void ntcUsageButton::onSelectUseNTC(wxCommandEvent&) - { - if (!getCurrentLink()) - return; - getCurrentLink()->transmissionCapacities = Data::LocalTransmissionCapacities::enabled; - broadCastChange(); - } - - void ntcUsageButton::onSelectSetToNull(wxCommandEvent&) - { - if (!getCurrentLink()) - return; - getCurrentLink()->transmissionCapacities = Data::LocalTransmissionCapacities::null; - broadCastChange(); - } - - void ntcUsageButton::onSelectSetToInfinite(wxCommandEvent&) - { - if (!getCurrentLink()) - return; - getCurrentLink()->transmissionCapacities = Data::LocalTransmissionCapacities::infinite; - broadCastChange(); - } - - - // ============================ - // Hurdle costs usage button - // ============================ - hurdleCostsUsageButton::hurdleCostsUsageButton(wxWindow* parent, - wxFlexGridSizer* sizer_flex_grid) - : menuLinkButton() - { - wxStaticText* label = Component::CreateLabel(parent, wxT("Local values"), false, true); +menuLinkButton::menuLinkButton() +{ + onSelectionChanges.connect(this, &menuLinkButton::update); + onPopup_.bind(this, &menuLinkButton::onPopupMenu); +} - setButton(new_check_allocation(parent, wxT("local values"), "images/16x16/light_green.png")); - getButton()->menu(true); - bindButtonToPopupMenu(); +menuLinkButton::~menuLinkButton() +{ + currentLink_ = nullptr; + destroyBoundEvents(); +} - sizer_flex_grid->Add(label, 0, wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); - sizer_flex_grid->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - } +void menuLinkButton::bindButtonToPopupMenu() const +{ + getButton()->onPopupMenu(onPopup_); +} - void hurdleCostsUsageButton::update(Data::AreaLink* link) - { - setCurrentLink(link); +void menuLinkButton::broadCastChange() const +{ + onSelectionChanges(getCurrentLink()); + broadCastChangeOutside(); +} - if (link->useHurdlesCost) - { - getButton()->caption(wxT("Use hurdles costs")); - getButton()->image("images/16x16/light_green.png"); - } - else - { - getButton()->caption(wxT("Ignore hurdles costs")); - getButton()->image("images/16x16/light_orange.png"); - } - } +void menuLinkButton::broadCastChangeOutside() const +{ + MarkTheStudyAsModified(); + OnInspectorRefresh(nullptr); +} + +// ========================= +// NTC usage button +// ========================= +ntcUsageButton::ntcUsageButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid) : + menuLinkButton() +{ + setButton(new_check_allocation( + parent, wxT("Transmission capacities"), "images/16x16/light_green.png")); + getButton()->menu(true); + bindButtonToPopupMenu(); - void hurdleCostsUsageButton::onPopupMenu(Component::Button&, wxMenu& menu, void*) - { - const wxMenuItem* it; - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("Use hurdles costs"), "images/16x16/light_green.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(hurdleCostsUsageButton::onSelectUse), - nullptr, - this); - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("Ignore"), "images/16x16/light_orange.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(hurdleCostsUsageButton::onSelectIgnore), - nullptr, - this); - } + sizer_flex_grid->AddSpacer(10); + sizer_flex_grid->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); +} - void hurdleCostsUsageButton::onSelectUse(wxCommandEvent&) - { - if (!getCurrentLink()) - return; +void ntcUsageButton::update(Data::AreaLink* link) +{ + setCurrentLink(link); + + switch (link->transmissionCapacities) + { + case Data::LocalTransmissionCapacities::enabled: + getButton()->caption(wxT("Use transmission capacities")); + getButton()->image("images/16x16/light_green.png"); + break; + case Data::LocalTransmissionCapacities::null: + getButton()->caption(wxT("Set transmission capacities to null")); + getButton()->image("images/16x16/light_orange.png"); + break; + case Data::LocalTransmissionCapacities::infinite: + getButton()->caption(wxT("Set transmission capacities to infinite")); + getButton()->image("images/16x16/infinity.png"); + break; + default: + break; + } +} + +void ntcUsageButton::onPopupMenu(Component::Button&, wxMenu& menu, void*) +{ + const wxMenuItem* it; + + it = Menu::CreateItem(&menu, + wxID_ANY, + wxT("Use transmission capacities"), + "images/16x16/light_green.png", + wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(ntcUsageButton::onSelectUseNTC), + nullptr, + this); + + it = Menu::CreateItem( + &menu, wxID_ANY, wxT("Set to null"), "images/16x16/light_orange.png", wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(ntcUsageButton::onSelectSetToNull), + nullptr, + this); + + it = Menu::CreateItem( + &menu, wxID_ANY, wxT("Set to infinite"), "images/16x16/infinity.png", wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(ntcUsageButton::onSelectSetToInfinite), + nullptr, + this); +} + +void ntcUsageButton::onSelectUseNTC(wxCommandEvent&) +{ + if (!getCurrentLink()) + return; + getCurrentLink()->transmissionCapacities = Data::LocalTransmissionCapacities::enabled; + broadCastChange(); +} - getCurrentLink()->useHurdlesCost = true; - broadCastChange(); - } +void ntcUsageButton::onSelectSetToNull(wxCommandEvent&) +{ + if (!getCurrentLink()) + return; + getCurrentLink()->transmissionCapacities = Data::LocalTransmissionCapacities::null; + broadCastChange(); +} - void hurdleCostsUsageButton::onSelectIgnore(wxCommandEvent&) - { - if (!getCurrentLink()) - return; +void ntcUsageButton::onSelectSetToInfinite(wxCommandEvent&) +{ + if (!getCurrentLink()) + return; + getCurrentLink()->transmissionCapacities = Data::LocalTransmissionCapacities::infinite; + broadCastChange(); +} + +// ============================ +// Hurdle costs usage button +// ============================ +hurdleCostsUsageButton::hurdleCostsUsageButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid) : + menuLinkButton() +{ + wxStaticText* label = Component::CreateLabel(parent, wxT("Local values"), false, true); - getCurrentLink()->useHurdlesCost = false; - broadCastChange(); - } + setButton(new_check_allocation( + parent, wxT("local values"), "images/16x16/light_green.png")); + getButton()->menu(true); + bindButtonToPopupMenu(); + sizer_flex_grid->Add(label, 0, wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + sizer_flex_grid->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); +} - // ========================= - // Asset type button - // ========================= - assetTypeButton::assetTypeButton(wxWindow* parent, - wxFlexGridSizer* sizer_flex_grid) - : menuLinkButton() - { - setButton(new_check_allocation(parent, wxT("Asset type"), "images/16x16/light_green.png")); - getButton()->menu(true); - bindButtonToPopupMenu(); - - sizer_flex_grid->AddSpacer(10); - sizer_flex_grid->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - } +void hurdleCostsUsageButton::update(Data::AreaLink* link) +{ + setCurrentLink(link); - void assetTypeButton::update(Data::AreaLink* link) + if (link->useHurdlesCost) { - setCurrentLink(link); - - switch (link->assetType) - { - case Data::atAC: - getButton()->caption(wxT("Asset type: AC")); - getButton()->image("images/16x16/light_green.png"); - break; - case Data::atDC: - getButton()->caption(wxT("Asset type: DC")); - getButton()->image("images/16x16/light_orange.png"); - break; - case Data::atGas: - getButton()->caption(wxT("Asset type: Gas")); - getButton()->image("images/16x16/light_orange.png"); - break; - case Data::atVirt: - getButton()->caption(wxT("Asset type: Virtual")); - getButton()->image("images/16x16/light_orange.png"); - break; - case Data::atOther: - getButton()->caption(wxT("Asset type: other")); - getButton()->image("images/16x16/light_orange.png"); - break; - default: - break; - } + getButton()->caption(wxT("Use hurdles costs")); + getButton()->image("images/16x16/light_green.png"); } - - void assetTypeButton::onPopupMenu(Component::Button&, wxMenu& menu, void*) + else { - const wxMenuItem* it; - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("Set to AC"), "images/16x16/light_green.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(assetTypeButton::onSelectAC), - nullptr, - this); - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("Set to DC"), "images/16x16/light_orange.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(assetTypeButton::onSelectDC), - nullptr, - this); - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("Set to Gas"), "images/16x16/light_orange.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(assetTypeButton::onSelectGas), - nullptr, - this); - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("Set to Virt"), "images/16x16/light_orange.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(assetTypeButton::onSelectVirt), - nullptr, - this); - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("Set to other"), "images/16x16/light_orange.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(assetTypeButton::onSelectOther), - nullptr, - this); + getButton()->caption(wxT("Ignore hurdles costs")); + getButton()->image("images/16x16/light_orange.png"); } +} - void assetTypeButton::onSelectAC(wxCommandEvent&) - { - if (!getCurrentLink()) - return; +void hurdleCostsUsageButton::onPopupMenu(Component::Button&, wxMenu& menu, void*) +{ + const wxMenuItem* it; + + it = Menu::CreateItem( + &menu, wxID_ANY, wxT("Use hurdles costs"), "images/16x16/light_green.png", wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(hurdleCostsUsageButton::onSelectUse), + nullptr, + this); + + it = Menu::CreateItem( + &menu, wxID_ANY, wxT("Ignore"), "images/16x16/light_orange.png", wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(hurdleCostsUsageButton::onSelectIgnore), + nullptr, + this); +} + +void hurdleCostsUsageButton::onSelectUse(wxCommandEvent&) +{ + if (!getCurrentLink()) + return; - getCurrentLink()->assetType = Data::atAC; - broadCastChange(); + getCurrentLink()->useHurdlesCost = true; + broadCastChange(); +} - getCurrentLink()->color[0] = 112; - getCurrentLink()->color[1] = 112; - getCurrentLink()->color[2] = 112; - getCurrentLink()->style = Data::stPlain; - getCurrentLink()->linkWidth = 1; - } +void hurdleCostsUsageButton::onSelectIgnore(wxCommandEvent&) +{ + if (!getCurrentLink()) + return; + + getCurrentLink()->useHurdlesCost = false; + broadCastChange(); +} + +// ========================= +// Asset type button +// ========================= +assetTypeButton::assetTypeButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid) : + menuLinkButton() +{ + setButton(new_check_allocation( + parent, wxT("Asset type"), "images/16x16/light_green.png")); + getButton()->menu(true); + bindButtonToPopupMenu(); - void assetTypeButton::onSelectDC(wxCommandEvent&) - { - if (!getCurrentLink()) - return; + sizer_flex_grid->AddSpacer(10); + sizer_flex_grid->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); +} - getCurrentLink()->assetType = Data::atDC; - broadCastChange(); +void assetTypeButton::update(Data::AreaLink* link) +{ + setCurrentLink(link); + + switch (link->assetType) + { + case Data::atAC: + getButton()->caption(wxT("Asset type: AC")); + getButton()->image("images/16x16/light_green.png"); + break; + case Data::atDC: + getButton()->caption(wxT("Asset type: DC")); + getButton()->image("images/16x16/light_orange.png"); + break; + case Data::atGas: + getButton()->caption(wxT("Asset type: Gas")); + getButton()->image("images/16x16/light_orange.png"); + break; + case Data::atVirt: + getButton()->caption(wxT("Asset type: Virtual")); + getButton()->image("images/16x16/light_orange.png"); + break; + case Data::atOther: + getButton()->caption(wxT("Asset type: other")); + getButton()->image("images/16x16/light_orange.png"); + break; + default: + break; + } +} + +void assetTypeButton::onPopupMenu(Component::Button&, wxMenu& menu, void*) +{ + const wxMenuItem* it; + + it = Menu::CreateItem( + &menu, wxID_ANY, wxT("Set to AC"), "images/16x16/light_green.png", wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(assetTypeButton::onSelectAC), + nullptr, + this); + + it = Menu::CreateItem( + &menu, wxID_ANY, wxT("Set to DC"), "images/16x16/light_orange.png", wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(assetTypeButton::onSelectDC), + nullptr, + this); + + it = Menu::CreateItem( + &menu, wxID_ANY, wxT("Set to Gas"), "images/16x16/light_orange.png", wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(assetTypeButton::onSelectGas), + nullptr, + this); + + it = Menu::CreateItem( + &menu, wxID_ANY, wxT("Set to Virt"), "images/16x16/light_orange.png", wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(assetTypeButton::onSelectVirt), + nullptr, + this); + + it = Menu::CreateItem( + &menu, wxID_ANY, wxT("Set to other"), "images/16x16/light_orange.png", wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(assetTypeButton::onSelectOther), + nullptr, + this); +} + +void assetTypeButton::onSelectAC(wxCommandEvent&) +{ + if (!getCurrentLink()) + return; - getCurrentLink()->color[0] = 0; - getCurrentLink()->color[1] = 255; - getCurrentLink()->color[2] = 0; - getCurrentLink()->style = Data::stDash; - getCurrentLink()->linkWidth = 2; - } + getCurrentLink()->assetType = Data::atAC; + broadCastChange(); - void assetTypeButton::onSelectGas(wxCommandEvent&) - { - if (!getCurrentLink()) - return; + getCurrentLink()->color[0] = 112; + getCurrentLink()->color[1] = 112; + getCurrentLink()->color[2] = 112; + getCurrentLink()->style = Data::stPlain; + getCurrentLink()->linkWidth = 1; +} - getCurrentLink()->assetType = Data::atGas; - broadCastChange(); +void assetTypeButton::onSelectDC(wxCommandEvent&) +{ + if (!getCurrentLink()) + return; - getCurrentLink()->color[0] = 0; - getCurrentLink()->color[1] = 128; - getCurrentLink()->color[2] = 255; - getCurrentLink()->style = Data::stPlain; - getCurrentLink()->linkWidth = 3; - } + getCurrentLink()->assetType = Data::atDC; + broadCastChange(); - void assetTypeButton::onSelectVirt(wxCommandEvent&) - { - if (!getCurrentLink()) - return; + getCurrentLink()->color[0] = 0; + getCurrentLink()->color[1] = 255; + getCurrentLink()->color[2] = 0; + getCurrentLink()->style = Data::stDash; + getCurrentLink()->linkWidth = 2; +} - getCurrentLink()->assetType = Data::atVirt; - broadCastChange(); +void assetTypeButton::onSelectGas(wxCommandEvent&) +{ + if (!getCurrentLink()) + return; - getCurrentLink()->color[0] = 255; - getCurrentLink()->color[1] = 0; - getCurrentLink()->color[2] = 128; - getCurrentLink()->style = Data::stDotDash; - getCurrentLink()->linkWidth = 2; - } + getCurrentLink()->assetType = Data::atGas; + broadCastChange(); - void assetTypeButton::onSelectOther(wxCommandEvent&) - { - if (!getCurrentLink()) - return; + getCurrentLink()->color[0] = 0; + getCurrentLink()->color[1] = 128; + getCurrentLink()->color[2] = 255; + getCurrentLink()->style = Data::stPlain; + getCurrentLink()->linkWidth = 3; +} - getCurrentLink()->assetType = Data::atOther; - broadCastChange(); +void assetTypeButton::onSelectVirt(wxCommandEvent&) +{ + if (!getCurrentLink()) + return; - getCurrentLink()->color[0] = 255; - getCurrentLink()->color[1] = 128; - getCurrentLink()->color[2] = 0; - getCurrentLink()->style = Data::stDot; - getCurrentLink()->linkWidth = 2; - } + getCurrentLink()->assetType = Data::atVirt; + broadCastChange(); + getCurrentLink()->color[0] = 255; + getCurrentLink()->color[1] = 0; + getCurrentLink()->color[2] = 128; + getCurrentLink()->style = Data::stDotDash; + getCurrentLink()->linkWidth = 2; +} +void assetTypeButton::onSelectOther(wxCommandEvent&) +{ + if (!getCurrentLink()) + return; + + getCurrentLink()->assetType = Data::atOther; + broadCastChange(); + + getCurrentLink()->color[0] = 255; + getCurrentLink()->color[1] = 128; + getCurrentLink()->color[2] = 0; + getCurrentLink()->style = Data::stDot; + getCurrentLink()->linkWidth = 2; +} + +// ========================= +// Caption button +// ========================= +using namespace Yuni; + +captionButton::captionButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid) : + menuLinkButton(), sizer_flex_grid_(sizer_flex_grid) +{ + // Link caption + setButton(new_check_allocation( + parent, wxT("local values"), "images/16x16/link.png")); + getButton()->menu(true); + getButton()->bold(true); + bindButtonToPopupMenu(); + sizer_flex_grid_->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + + // Alias caption + caption_label_ = Component::CreateLabel(parent, wxT("Caption"), false, true); + alias_button_ = new_check_allocation( + parent, wxT(""), "images/16x16/document.png", this, &captionButton::onButtonEditCaption); + local_horizontal_sizer_ = new wxBoxSizer(wxHORIZONTAL); + caption_text_ = Component::CreateLabel(parent, wxEmptyString); + sizer_flex_grid_->Add(caption_label_, 0, wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + local_horizontal_sizer_->Add(alias_button_, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + local_horizontal_sizer_->AddSpacer(2); + local_horizontal_sizer_->Add(caption_text_, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + sizer_flex_grid_->Add( + local_horizontal_sizer_, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); +} + +void captionButton::onPopupMenu(Component::Button&, wxMenu& menu, void*) +{ + const wxMenuItem* it; + + it = Menu::CreateItem( + &menu, wxID_ANY, wxT("Edit caption"), "images/16x16/document.png", wxEmptyString); + menu.Connect(it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(captionButton::onEditCaption), + nullptr, + this); +} + +void captionButton::onEditCaption(wxCommandEvent&) +{ + onButtonEditCaption(nullptr); +} - // ========================= - // Caption button - // ========================= - using namespace Yuni; +void captionButton::onButtonEditCaption(void*) +{ + if (!getCurrentLink()) + return; - captionButton::captionButton(wxWindow* parent, - wxFlexGridSizer* sizer_flex_grid) - : menuLinkButton(), sizer_flex_grid_(sizer_flex_grid) - { - // Link caption - setButton(new_check_allocation(parent, wxT("local values"), "images/16x16/link.png")); - getButton()->menu(true); - getButton()->bold(true); - bindButtonToPopupMenu(); - sizer_flex_grid_->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - - // Alias caption - caption_label_ = Component::CreateLabel(parent, wxT("Caption"), false, true); - alias_button_ = new_check_allocation(parent, wxT(""), "images/16x16/document.png", - this, - &captionButton::onButtonEditCaption); - local_horizontal_sizer_ = new wxBoxSizer(wxHORIZONTAL); - caption_text_ = Component::CreateLabel(parent, wxEmptyString); - sizer_flex_grid_->Add(caption_label_, 0, wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); - local_horizontal_sizer_->Add(alias_button_, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - local_horizontal_sizer_->AddSpacer(2); - local_horizontal_sizer_->Add(caption_text_, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - sizer_flex_grid_->Add(local_horizontal_sizer_, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - } + wxTextEntryDialog dialog(this, + wxT("Please enter the new link's caption :"), + wxT("Caption"), + wxStringFromUTF8(getCurrentLink()->comments), + wxOK | wxCANCEL); - void captionButton::onPopupMenu(Component::Button&, wxMenu& menu, void*) + if (dialog.ShowModal() == wxID_OK) { - const wxMenuItem* it; - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("Edit caption"), "images/16x16/document.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(captionButton::onEditCaption), - nullptr, - this); + String text; + wxStringToString(dialog.GetValue(), text); + text.trim(); + if (text != getCurrentLink()->comments) + { + getCurrentLink()->comments = text; + broadCastChange(); + } } +} - void captionButton::onEditCaption(wxCommandEvent&) - { - onButtonEditCaption(nullptr); - } +void captionButton::update(Data::AreaLink* link) +{ + setCurrentLink(link); - void captionButton::onButtonEditCaption(void*) + if (link->comments.empty()) { - if (!getCurrentLink()) - return; - - wxTextEntryDialog dialog(this, - wxT("Please enter the new link's caption :"), - wxT("Caption"), - wxStringFromUTF8(getCurrentLink()->comments), - wxOK | wxCANCEL); - - if (dialog.ShowModal() == wxID_OK) - { - String text; - wxStringToString(dialog.GetValue(), text); - text.trim(); - if (text != getCurrentLink()->comments) - { - getCurrentLink()->comments = text; - broadCastChange(); - } - } + sizer_flex_grid_->Hide(caption_label_); + sizer_flex_grid_->Hide(local_horizontal_sizer_); } - - void captionButton::update(Data::AreaLink* link) + else { - setCurrentLink(link); - - if (link->comments.empty()) - { - sizer_flex_grid_->Hide(caption_label_); - sizer_flex_grid_->Hide(local_horizontal_sizer_); - } - else - { - caption_text_->SetLabel(wxStringFromUTF8(link->comments)); - sizer_flex_grid_->Show(caption_label_); - sizer_flex_grid_->Show(local_horizontal_sizer_); - } + caption_text_->SetLabel(wxStringFromUTF8(link->comments)); + sizer_flex_grid_->Show(caption_label_); + sizer_flex_grid_->Show(local_horizontal_sizer_); } +} +// ========================= +// Loop flow usage button +// ========================= +loopFlowUsageButton::loopFlowUsageButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid) +{ + setButton(new_check_allocation( + parent, wxT("loop flow"), "images/16x16/light_green.png")); + sizer_flex_grid->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); +} - // ========================= - // Loop flow usage button - // ========================= - loopFlowUsageButton::loopFlowUsageButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid) +void loopFlowUsageButton::update(Data::AreaLink* link) +{ + if (link->useLoopFlow) { - setButton(new_check_allocation(parent, wxT("loop flow"), "images/16x16/light_green.png")); - sizer_flex_grid->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + getButton()->caption(wxT("Account for loop flows")); + getButton()->image("images/16x16/light_green.png"); } - - void loopFlowUsageButton::update(Data::AreaLink* link) + else { - if (link->useLoopFlow) - { - getButton()->caption(wxT("Account for loop flows")); - getButton()->image("images/16x16/light_green.png"); - } - else - { - getButton()->caption(wxT("Ignore loop flows")); - getButton()->image("images/16x16/light_orange.png"); - } + getButton()->caption(wxT("Ignore loop flows")); + getButton()->image("images/16x16/light_orange.png"); } +} +// ============================ +// Phase shifter usage button +// ============================ +phaseShifterUsageButton::phaseShifterUsageButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid) +{ + setButton(new_check_allocation( + parent, wxT("phase shifter"), "images/16x16/light_green.png")); + sizer_flex_grid->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); +} - // ============================ - // Phase shifter usage button - // ============================ - phaseShifterUsageButton::phaseShifterUsageButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid) +void phaseShifterUsageButton::update(Data::AreaLink* link) +{ + if (link->usePST) { - setButton(new_check_allocation(parent, wxT("phase shifter"), "images/16x16/light_green.png")); - sizer_flex_grid->Add(getButton(), 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + getButton()->caption(wxT("Tune PST")); + getButton()->image("images/16x16/light_green.png"); } - - void phaseShifterUsageButton::update(Data::AreaLink* link) + else { - if (link->usePST) - { - getButton()->caption(wxT("Tune PST")); - getButton()->image("images/16x16/light_green.png"); - } - else - { - getButton()->caption(wxT("Ignore PST ")); - getButton()->image("images/16x16/light_orange.png"); - } + getButton()->caption(wxT("Ignore PST ")); + getButton()->image("images/16x16/light_orange.png"); } +} -} // End namespace Window -} // End namespace Antares +} // End namespace Window +} // End namespace Antares diff --git a/src/ui/simulator/windows/link-property-buttons.h b/src/ui/simulator/windows/link-property-buttons.h index 9707000155..87c167567b 100644 --- a/src/ui/simulator/windows/link-property-buttons.h +++ b/src/ui/simulator/windows/link-property-buttons.h @@ -10,7 +10,6 @@ namespace Antares { namespace Window { - // ========================= // Abstract link button // ========================= @@ -20,14 +19,19 @@ class linkButton : public wxFrame virtual void update(Data::AreaLink* link) = 0; protected: - Component::Button* getButton() const { return button_; } - void setButton(Component::Button* button) { button_ = button; } + Component::Button* getButton() const + { + return button_; + } + void setButton(Component::Button* button) + { + button_ = button; + } private: Component::Button* button_ = nullptr; }; - // ================================== // Abstract menu link button // ================================== @@ -39,11 +43,20 @@ class menuLinkButton : public linkButton, public Yuni::IEventObserver onPopup_; }; - // ========================= // NTC usage button // ========================= class ntcUsageButton : public menuLinkButton { public: - ntcUsageButton(wxWindow* parent, - wxFlexGridSizer* sizer_flex_grid); + ntcUsageButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid); void update(Data::AreaLink* link) override; @@ -74,18 +85,15 @@ class ntcUsageButton : public menuLinkButton void onSelectUseNTC(wxCommandEvent&); void onSelectSetToNull(wxCommandEvent&); void onSelectSetToInfinite(wxCommandEvent&); - }; - // ============================ // Hurdle costs usage button // ============================ class hurdleCostsUsageButton : public menuLinkButton { public: - hurdleCostsUsageButton(wxWindow* parent, - wxFlexGridSizer* sizer_flex_grid); + hurdleCostsUsageButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid); void update(Data::AreaLink* link) override; @@ -94,18 +102,15 @@ class hurdleCostsUsageButton : public menuLinkButton void onSelectUse(wxCommandEvent&); void onSelectIgnore(wxCommandEvent&); - }; - // ========================= // Asset type button // ========================= class assetTypeButton : public menuLinkButton { public: - assetTypeButton(wxWindow* parent, - wxFlexGridSizer* sizer_flex_grid); + assetTypeButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid); void update(Data::AreaLink* link) override; @@ -117,7 +122,6 @@ class assetTypeButton : public menuLinkButton void onSelectGas(wxCommandEvent&); void onSelectVirt(wxCommandEvent&); void onSelectOther(wxCommandEvent&); - }; // ========================= @@ -126,11 +130,13 @@ class assetTypeButton : public menuLinkButton class captionButton : public menuLinkButton { public: - captionButton(wxWindow* parent, - wxFlexGridSizer* sizer_flex_grid); + captionButton(wxWindow* parent, wxFlexGridSizer* sizer_flex_grid); void update(Data::AreaLink* link) override; - void setCaption(const wxString& caption) const { getButton()->caption(caption); } + void setCaption(const wxString& caption) const + { + getButton()->caption(caption); + } private: void onPopupMenu(Component::Button&, wxMenu& menu, void*) override; @@ -146,7 +152,6 @@ class captionButton : public menuLinkButton wxFlexGridSizer* sizer_flex_grid_; }; - // ========================= // Loop flow usage button // ========================= @@ -169,5 +174,5 @@ class phaseShifterUsageButton : public linkButton void update(Data::AreaLink* link) override; }; -} -} \ No newline at end of file +} // namespace Window +} // namespace Antares \ No newline at end of file diff --git a/src/ui/simulator/windows/options/advanced/advanced.cpp b/src/ui/simulator/windows/options/advanced/advanced.cpp index cbc98cbd91..7023a43ba1 100644 --- a/src/ui/simulator/windows/options/advanced/advanced.cpp +++ b/src/ui/simulator/windows/options/advanced/advanced.cpp @@ -904,11 +904,12 @@ void AdvancedParameters::onNumberOfCores(Component::Button&, wxMenu& menu, void* text.clear(); text = wxStringFromUTF8(NumberOfCoresModeToCString(Data::ncHigh)); // High it = Menu::CreateItem(&menu, wxID_ANY, text, "images/16x16/tag.png"); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(AdvancedParameters::onSelectNumberOfCoresLevel), - nullptr, - this); + menu.Connect( + it->GetId(), + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(AdvancedParameters::onSelectNumberOfCoresLevel), + nullptr, + this); text.clear(); text = wxStringFromUTF8(NumberOfCoresModeToCString(Data::ncMax)); // Max diff --git a/src/ui/simulator/windows/options/optimization/optimization.h b/src/ui/simulator/windows/options/optimization/optimization.h index c29ec70aa2..9ddaeea276 100644 --- a/src/ui/simulator/windows/options/optimization/optimization.h +++ b/src/ui/simulator/windows/options/optimization/optimization.h @@ -150,18 +150,17 @@ void Optimization::onSelectExportMPS(wxCommandEvent&) template void Optimization::createMPSexportItemIntoMenu(wxMenu& menu) { - const wxMenuItem* it = Menu::CreateItem( - &menu, - wxID_ANY, - mpsExportStatusToString(MPS_EXPORT_STATUS), - mpsExportIcon(MPS_EXPORT_STATUS), - wxEmptyString); + const wxMenuItem* it = Menu::CreateItem(&menu, + wxID_ANY, + mpsExportStatusToString(MPS_EXPORT_STATUS), + mpsExportIcon(MPS_EXPORT_STATUS), + wxEmptyString); menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(Optimization::onSelectExportMPS), - nullptr, - this); + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(Optimization::onSelectExportMPS), + nullptr, + this); } const char* transmissionCapacityIcon(Data::GlobalTransmissionCapacities capacity); @@ -169,18 +168,17 @@ const char* transmissionCapacityIcon(Data::GlobalTransmissionCapacities capacity template void Optimization::createGlobalTransmissionCapacitiesItemIntoMenu(wxMenu& menu) { - const wxMenuItem* it = Menu::CreateItem( - &menu, - wxID_ANY, - GlobalTransmissionCapacitiesToString_Display(CAPACITY), - transmissionCapacityIcon(CAPACITY), - wxEmptyString); + const wxMenuItem* it = Menu::CreateItem(&menu, + wxID_ANY, + GlobalTransmissionCapacitiesToString_Display(CAPACITY), + transmissionCapacityIcon(CAPACITY), + wxEmptyString); menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(Optimization::onSelectTransmissionCapacity), - nullptr, - this); + wxEVT_COMMAND_MENU_SELECTED, + wxCommandEventHandler(Optimization::onSelectTransmissionCapacity), + nullptr, + this); } } // namespace Options diff --git a/src/ui/simulator/windows/simulation/run.cpp b/src/ui/simulator/windows/simulation/run.cpp index 82b1097dc6..b0de683f4f 100644 --- a/src/ui/simulator/windows/simulation/run.cpp +++ b/src/ui/simulator/windows/simulation/run.cpp @@ -73,11 +73,9 @@ enum timerInterval = 3500 // ms }; -static const wxString featuresNames[featuresCount] - = {wxT(" Default "), wxT(" Parallel ")}; +static const wxString featuresNames[featuresCount] = {wxT(" Default "), wxT(" Parallel ")}; -static const Solver::Feature featuresAlias[featuresCount] - = {Solver::standard, Solver::parallel}; +static const Solver::Feature featuresAlias[featuresCount] = {Solver::standard, Solver::parallel}; static wxString TimeSeriesToWxString(uint m) { From ca4b0aeaca4af607e5964ddd1dc9712a45078992 Mon Sep 17 00:00:00 2001 From: payetvin <113102157+payetvin@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:17:18 +0100 Subject: [PATCH 2/4] [FIX] Clean unused button (#1067) --- .../windows/options/advanced/advanced.cpp | 15 --------------- .../simulator/windows/options/advanced/advanced.h | 1 - 2 files changed, 16 deletions(-) diff --git a/src/ui/simulator/windows/options/advanced/advanced.cpp b/src/ui/simulator/windows/options/advanced/advanced.cpp index 7023a43ba1..331c011ef3 100644 --- a/src/ui/simulator/windows/options/advanced/advanced.cpp +++ b/src/ui/simulator/windows/options/advanced/advanced.cpp @@ -220,19 +220,6 @@ AdvancedParameters::AdvancedParameters(wxWindow* parent) : s->Add(button, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); pBtnSheddingPolicy = button; } - // District marginal prices - { - label = Component::CreateLabel(this, wxT("District marginal prices")); - button = new Component::Button(this, wxT("include"), "images/16x16/tag.png"); - button->SetBackgroundColour(bgColor); - button->menu(true); - // button->onPopupMenu(onPopup); - s->Add(label, 0, wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); - s->Add(button, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - pBtnMultiNodalMarginalPrices = button; - button->enabled(false); - } - // Unit Commitment mode { label = Component::CreateLabel(this, wxT("Unit Commitment Mode")); @@ -411,8 +398,6 @@ void AdvancedParameters::refresh() text = wxStringFromUTF8(SheddingPolicyToCString(study.parameters.shedding.policy)); pBtnSheddingPolicy->caption(text); - pBtnMultiNodalMarginalPrices->caption(wxT("average")); - text = wxStringFromUTF8(UnitCommitmentModeToCString(study.parameters.unitCommitment.ucMode)); pBtnUnitCommitment->caption(text); diff --git a/src/ui/simulator/windows/options/advanced/advanced.h b/src/ui/simulator/windows/options/advanced/advanced.h index 0631cc2a8d..0992b24351 100644 --- a/src/ui/simulator/windows/options/advanced/advanced.h +++ b/src/ui/simulator/windows/options/advanced/advanced.h @@ -123,7 +123,6 @@ class AdvancedParameters final : public wxDialog Component::Button* pBtnHydroHeuristicPolicy; Component::Button* pBtnHydroPricing; Component::Button* pBtnSheddingPolicy; - Component::Button* pBtnMultiNodalMarginalPrices; Component::Button* pBtnUnitCommitment; Component::Button* pBtnRenewableGenModelling; Component::Button* pBtnNumberOfCores; From 570cd826a575009ddd29bcbb7873859bb5836888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= Date: Tue, 10 Jan 2023 17:18:13 +0100 Subject: [PATCH 3/4] Fix solver artifact name (#1080) * Fix solver artifact name * Add antares- prefix --- .github/workflows/centos7.yml | 2 +- .github/workflows/ubuntu.yml | 2 +- .github/workflows/windows-release.yml | 2 +- .github/workflows/windows-vcpkg.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml index 6953433032..3332200cbc 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -98,7 +98,7 @@ jobs: - name: Solver archive creation run: | cd _build - tar czf solver_ubuntu20.04.tar.gz solver/antares-*-solver solver/libsirius_solver.so + tar czf antares-solver_centos7.tar.gz solver/antares-*-solver solver/libsirius_solver.so - name: .tar.gz creation run: | diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 3e23461cfa..4d9379f2ca 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -205,7 +205,7 @@ jobs: - name: Solver archive creation run: | cd _build - tar czf solver_centos7.tar.gz solver/antares-*-solver solver/libsirius_solver.so + tar czf antares-solver_ubuntu20.04.tar.gz solver/antares-*-solver solver/libsirius_solver.so - name: Installer archive upload push uses: actions/upload-artifact@v3 diff --git a/.github/workflows/windows-release.yml b/.github/workflows/windows-release.yml index 8e618ef58c..6d9e6ca29a 100644 --- a/.github/workflows/windows-release.yml +++ b/.github/workflows/windows-release.yml @@ -189,7 +189,7 @@ jobs: shell: bash run: | cd _build - zip -r solver_win.zip solver/Release/antares-*-solver.exe solver/Release/*.dll + zip -r antares-solver_windows.zip solver/Release/antares-*-solver.exe solver/Release/*.dll - name: NSIS Installer creation shell: bash diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index af42878d77..c47c3cc4af 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -183,7 +183,7 @@ jobs: shell: bash run: | cd _build - zip -r solver_win.zip solver/Release/antares-*-solver.exe solver/Release/*.dll + zip -r antares-solver_windows.zip solver/Release/antares-*-solver.exe solver/Release/*.dll - name: NSIS Installer creation shell: bash From 24e8d5b2c5eb643cc5e609a8d6ec5d4c3de8e7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Omn=C3=A8s?= Date: Tue, 10 Jan 2023 17:19:57 +0100 Subject: [PATCH 4/4] Restore warm start for OR-Tools+XPRESS (#1079) --- src/solver/utils/named_problem.h | 1 - src/solver/utils/ortools_utils.cpp | 22 +++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/solver/utils/named_problem.h b/src/solver/utils/named_problem.h index 59a338b0cb..c83fa7d32d 100644 --- a/src/solver/utils/named_problem.h +++ b/src/solver/utils/named_problem.h @@ -26,7 +26,6 @@ struct PROBLEME_SIMPLEXE_NOMME : public PROBLEME_SIMPLEXE bool isMIP() const; bool basisExists() const; - mutable bool solverSupportsWarmStart = false; }; } // namespace Optimization } // namespace Antares diff --git a/src/solver/utils/ortools_utils.cpp b/src/solver/utils/ortools_utils.cpp index c18ce82db9..b6b4552ec1 100644 --- a/src/solver/utils/ortools_utils.cpp +++ b/src/solver/utils/ortools_utils.cpp @@ -116,6 +116,20 @@ static void tuneSolverSpecificOptions(MPSolver* solver) } } +static bool solverSupportsWarmStart(const MPSolver* solver) +{ + if (!solver) + return false; + + switch (solver->ProblemType()) + { + case MPSolver::XPRESS_LINEAR_PROGRAMMING: + return true; + default: + return false; + } +} + namespace Antares { namespace Optimization @@ -286,8 +300,9 @@ MPSolver* ORTOOLS_Simplexe(Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* Probl bool keepBasis) { MPSolverParameters params; + bool warmStart = solverSupportsWarmStart(solver); // Provide an initial simplex basis, if any - if (Probleme->basisExists() && !Probleme->isMIP() && Probleme->solverSupportsWarmStart) + if (warmStart && Probleme->basisExists() && !Probleme->isMIP()) { solver->SetStartingLpBasisInt(Probleme->StatutDesVariables, Probleme->StatutDesContraintes); } @@ -296,7 +311,7 @@ MPSolver* ORTOOLS_Simplexe(Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* Probl { extract_from_MPSolver(solver, Probleme); // Save the final simplex basis for next resolutions - if (keepBasis && !Probleme->isMIP() && Probleme->solverSupportsWarmStart) + if (warmStart && keepBasis && !Probleme->isMIP()) { solver->GetFinalLpBasisInt(Probleme->StatutDesVariables, Probleme->StatutDesContraintes); @@ -388,8 +403,5 @@ MPSolver* MPSolverFactory(const Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* AntaresSolverEmergencyShutdown(); } - if (solverName == "xpress") - probleme->solverSupportsWarmStart = true; - return solver; }