diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml index 6496089877..330df8e719 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -41,7 +41,7 @@ jobs: run: | git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b ${{ env.REF }} . - - name: Install gcc 11 + - name: Install gcc 10 run: | # update mirrors, official centos7 is deprecated sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo &&\ diff --git a/.github/workflows/install-cmake-328/action.yml b/.github/workflows/install-cmake-328/action.yml index be6e0c3f97..1cf045dbee 100644 --- a/.github/workflows/install-cmake-328/action.yml +++ b/.github/workflows/install-cmake-328/action.yml @@ -7,7 +7,7 @@ runs: - name: Build cmake shell: bash run: | - source /opt/rh/devtoolset-11/enable + source /opt/rh/devtoolset-10/enable || true # Ignore error if devtoolset-10 is not available yum -y install openssl-devel wget https://github.com/Kitware/CMake/releases/download/v3.28.2/cmake-3.28.2.tar.gz tar -xvf cmake-3.28.2.tar.gz diff --git a/.github/workflows/new_release.yml b/.github/workflows/new_release.yml index 6cf6da390a..1f3c31f0c3 100644 --- a/.github/workflows/new_release.yml +++ b/.github/workflows/new_release.yml @@ -80,3 +80,4 @@ jobs: uses: ./.github/workflows/build-userguide.yml with: run-tests: ${{ inputs.run-tests }} + target_branch: ${{ inputs.target_branch }} diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 426e06e4df..8282db6925 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -120,8 +120,6 @@ jobs: cd src/api_client_example cmake -B _build -S . \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ - -DVCPKG_TARGET_TRIPLET=${{ env.triplet }} \ -DCMAKE_C_COMPILER=/usr/bin/gcc-10 \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \ @@ -172,6 +170,7 @@ jobs: run: | cd _build ctest -C Release --output-on-failure -L "unit|end-to-end" + - name: Upload logs for failed tests if: ${{ failure() }} @@ -179,23 +178,40 @@ jobs: with: name: test-log path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log + + - name: Run tests about infinity on BCs RHS + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-v830 + os: ${{ env.os }} + + - name: Run MILP with CBC + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-milp + variant: "milp-cbc" + os: ${{ env.os }} - - name: Run tests on adequacy patch - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: adequacy-patch-CSR - os: ${{ env.os }} - - - name: Run parallel tests - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-parallel - os: ${{ env.os }} - variant: "parallel" + - name: Run tests on adequacy patch + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: adequacy-patch-CSR + os: ${{ env.os }} + + - name: Run parallel tests + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-parallel + os: ${{ env.os }} + variant: "parallel" - name: Run tests introduced in 8.6.0 if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 5ec8be1ed5..37d47eaadf 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -173,7 +173,6 @@ jobs: cd _build ctest -C Release --output-on-failure -L "unit|end-to-end" -LE ortools -<<<<<<< HEAD - name: Upload build on failure if: ${{ failure() }} uses: actions/upload-artifact@v4 @@ -188,15 +187,14 @@ jobs: simtest-tag: ${{ env.SIMTEST }} batch-name: adequacy-patch-CSR os: ${{ env.os }} -======= - - name: Run tests about infinity on BCs RHS - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-v830 - os: ${{ env.test-platform }} ->>>>>>> 8dbf5c11e (Adequacy patch CSR - revamp output variables [ANT-1932] (#2421)) + + - name: Run tests about infinity on BCs RHS + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-v830 + os: ${{ env.test-platform }} - name: Run tests about infinity on BCs RHS if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6f29b39178..d7eec127b1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,9 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # Version -set(ANTARES_VERSION_HI 8) -set(ANTARES_VERSION_LO 8) -set(ANTARES_VERSION_REVISION 11) +set(ANTARES_VERSION_HI 9) +set(ANTARES_VERSION_LO 2) +set(ANTARES_VERSION_REVISION 0) # Beta release set(ANTARES_BETA 0) diff --git a/src/libs/antares/exception/LoadingError.cpp b/src/libs/antares/exception/LoadingError.cpp index cea447153e..08f5799fd7 100644 --- a/src/libs/antares/exception/LoadingError.cpp +++ b/src/libs/antares/exception/LoadingError.cpp @@ -96,9 +96,8 @@ InvalidSolverSpecificParameters::InvalidSolverSpecificParameters(const std::stri { } -InvalidStudy::InvalidStudy(const Yuni::String& study): - LoadingError(std::string("The folder `") + study.c_str() - + "` does not seem to be a valid study") +InvalidStudy::InvalidStudy(const std::string& study) : + LoadingError(std::string("The folder `") + study + "` does not seem to be a valid study") { } diff --git a/src/solver/misc/options.cpp b/src/solver/misc/options.cpp index 331541b9f3..b228d00ddf 100644 --- a/src/solver/misc/options.cpp +++ b/src/solver/misc/options.cpp @@ -75,13 +75,6 @@ std::unique_ptr CreateParser(Settings& settings, StudyLoad "force-parallel", "Override the max number of years computed simultaneously"); - // add option for ortools use - // --use-ortools - parser->addFlag(options.optOptions.ortoolsUsed, - ' ', - "use-ortools", - "Use ortools library to launch solver"); - //--ortools-solver parser->add(options.optOptions.ortoolsSolver, ' ', diff --git a/src/solver/optimisation/adequacy_patch_csr/adq_patch_curtailment_sharing.cpp b/src/solver/optimisation/adequacy_patch_csr/adq_patch_curtailment_sharing.cpp index b480108379..c5c2f2c124 100644 --- a/src/solver/optimisation/adequacy_patch_csr/adq_patch_curtailment_sharing.cpp +++ b/src/solver/optimisation/adequacy_patch_csr/adq_patch_curtailment_sharing.cpp @@ -25,7 +25,7 @@ #include "antares/solver/optimisation/adequacy_patch_csr/count_constraints_variables.h" #include "antares/solver/optimisation/adequacy_patch_csr/csr_quadratic_problem.h" -#include "antares/solver/optimisation/opt_fonctions.h" +#include "solve_problem.h" #include "antares/solver/simulation/adequacy_patch_runtime_data.h" using namespace Yuni; diff --git a/src/solver/optimisation/adequacy_patch_csr/construct_problem_constraints_RHS.cpp b/src/solver/optimisation/adequacy_patch_csr/construct_problem_constraints_RHS.cpp index ce20a9d0a8..6efbde35b4 100644 --- a/src/solver/optimisation/adequacy_patch_csr/construct_problem_constraints_RHS.cpp +++ b/src/solver/optimisation/adequacy_patch_csr/construct_problem_constraints_RHS.cpp @@ -61,11 +61,11 @@ void HourlyCSRProblem::setRHSnodeBalanceValue() if (problemeHebdo_->adequacyPatchRuntimeData->areaMode[Area] == Data::AdequacyPatch::physicalAreaInsideAdqPatch) { - std::map::iterator it = numberOfConstraintCsrAreaBalance_.find(Area); - if (it != numberOfConstraintCsrAreaBalance_.end()) + std::map::iterator it = numberOfConstraintCsrAreaBalance.find(Area); + if (it != numberOfConstraintCsrAreaBalance.end()) { int Cnt = it->second; - problemeAResoudre_.SecondMembre[Cnt] = rhsAreaBalanceValues_[Area]; + problemeAResoudre_.SecondMembre[Cnt] = rhsAreaBalanceValues[Area]; logs.debug() << Cnt << ": Area Balance: RHS[" << Cnt << "] = " << problemeAResoudre_.SecondMembre[Cnt] << " (Area = " << Area << ")"; diff --git a/src/solver/optimisation/adequacy_patch_csr/solve_problem.h b/src/solver/optimisation/adequacy_patch_csr/solve_problem.h index abd4ad62c6..772253ef3a 100644 --- a/src/solver/optimisation/adequacy_patch_csr/solve_problem.h +++ b/src/solver/optimisation/adequacy_patch_csr/solve_problem.h @@ -3,8 +3,8 @@ #include "antares/study/parameters/adq-patch-params.h" -#include "../opt_structure_probleme_a_resoudre.h" -#include "hourly_csr_problem.h" +#include "antares/solver/optimisation/opt_structure_probleme_a_resoudre.h" +#include "antares/solver/optimisation/adequacy_patch_csr/hourly_csr_problem.h" using namespace Antares::Data::AdequacyPatch; diff --git a/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/hourly_csr_problem.h b/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/hourly_csr_problem.h index a250ec9640..25af5b1b2a 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/hourly_csr_problem.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/adequacy_patch_csr/hourly_csr_problem.h @@ -127,6 +127,7 @@ class HourlyCSRProblem public: // TODO [gp] : try to make these members private double belowThisThresholdSetToZero; + std::map numberOfConstraintCsrAreaBalance; std::set ensVariablesInsideAdqPatch; // place inside only ENS inside adq-patch std::set varToBeSetToZeroIfBelowThreshold; // place inside only ENS and Spillage variable int triggeredHour; @@ -145,38 +146,6 @@ class HourlyCSRProblem std::map rhsAreaBalanceValues; - struct LinkVariable - { - LinkVariable(): - directVar(-1), - indirectVar(-1) - { - } - - LinkVariable(int direct, int indirect): - directVar(direct), - indirectVar(indirect) - { - } - - inline bool check() const - { - if (directVar < 0) - { - Antares::logs.warning() << "directVar < 0 detected, this should not happen"; - } - if (indirectVar < 0) - { - Antares::logs.warning() << "indirectVar < 0 detected, this should not happen"; - } - - return (directVar >= 0) && (indirectVar >= 0); - } - - int directVar; - int indirectVar; - }; - // links between two areas inside the adq-patch domain std::map linkInsideAdqPatch; }; diff --git a/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h b/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h index c02faf8399..521225cde7 100644 --- a/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h +++ b/src/solver/optimisation/include/antares/solver/optimisation/post_process_commands.h @@ -69,19 +69,6 @@ class RemixHydroPostProcessCmd: public basePostProcessCommand SimplexOptimization splx_optimization_; }; -class DTGmarginForAdqPatchPostProcessCmd: public basePostProcessCommand -{ -public: - UpdateMrgPriceAfterCSRcmd(PROBLEME_HEBDO* problemeHebdo, - AreaList& areas, - unsigned int thread_number); - void execute(const optRuntimeData&) override; - -private: - const AreaList& area_list_; - unsigned int thread_number_ = 0; -}; - class UpdateMrgPriceAfterCSRcmd: public basePostProcessCommand { public: diff --git a/src/solver/variable/CMakeLists.txt b/src/solver/variable/CMakeLists.txt index 95af02ac57..ed7c017f5b 100644 --- a/src/solver/variable/CMakeLists.txt +++ b/src/solver/variable/CMakeLists.txt @@ -78,6 +78,8 @@ set(SRC_VARIABLE_ECONOMY include/antares/solver/variable/economy/links.h # Variables for Economy + include/antares/solver/variable/economy/max-mrg-utils.h + max-mrg-utils.cpp include/antares/solver/variable/economy/max-mrg.h include/antares/solver/variable/economy/price.h include/antares/solver/variable/economy/balance.h @@ -126,7 +128,7 @@ set(SRC_VARIABLE_ECONOMY include/antares/solver/variable/economy/links/congestionFeeAbs.h include/antares/solver/variable/economy/links/marginalCost.h include/antares/solver/variable/economy/links/congestionProbability.h - include/antares/solver/variable/economy/overallCostCsr.h + include/antares/solver/variable/economy/overallCostCsr.h # Binding constraints include/antares/solver/variable/economy/bindingConstraints/bindingConstraintsMarginalCost.h diff --git a/src/solver/variable/include/antares/solver/variable/economy/max-mrg-utils.h b/src/solver/variable/include/antares/solver/variable/economy/max-mrg-utils.h index 59ba35defc..2386836074 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/max-mrg-utils.h +++ b/src/solver/variable/include/antares/solver/variable/economy/max-mrg-utils.h @@ -1,6 +1,7 @@ #pragma once #include "../state.h" +#include namespace Antares::Solver::Variable::Economy { @@ -10,9 +11,10 @@ struct MaxMRGinput double* spillage = nullptr; double* dens = nullptr; double* hydroGeneration = nullptr; - double* hydroMaxPower = nullptr; + Antares::Data::TimeSeries* maxHourlyGenPower = nullptr; double* dtgMargin = nullptr; unsigned int hourInYear = 0; + unsigned int year = 0; Date::Calendar* calendar = nullptr; std::string areaName; }; diff --git a/src/solver/variable/max-mrg-utils.cpp b/src/solver/variable/max-mrg-utils.cpp index 0951346734..5b43f99cea 100644 --- a/src/solver/variable/max-mrg-utils.cpp +++ b/src/solver/variable/max-mrg-utils.cpp @@ -27,11 +27,10 @@ #include +#include #include #include -#include "max-mrg.h" - using namespace Yuni; const unsigned int nbHoursInWeek = 168; @@ -45,9 +44,10 @@ MaxMrgDataFactory::MaxMrgDataFactory(const State& state, unsigned int numSpace): weeklyResults_(state.problemeHebdo->ResultatsHoraires[state.area->index]) { maxMRGinput_.hydroGeneration = weeklyResults_.TurbinageHoraire.data(); - maxMRGinput_.hydroMaxPower = state_.area->hydro.maxPower[Data::PartHydro::genMaxP]; + maxMRGinput_.maxHourlyGenPower = &state_.area->hydro.series->maxHourlyGenPower; maxMRGinput_.dtgMargin = state_.area->scratchpad[numSpace].dispatchableGenerationMargin; maxMRGinput_.hourInYear = state.hourInTheYear; + maxMRGinput_.year = state.problemeHebdo->year; maxMRGinput_.calendar = &state.study.calendar; maxMRGinput_.areaName = state_.area->name.c_str(); } @@ -135,9 +135,10 @@ void computeMaxMRG(double* maxMrgOut, const MaxMRGinput& in) assert(h < HOURS_PER_YEAR && "calendar overflow"); if (niveau > OI[h]) { - uint dayYear = in.calendar->hours[h + in.hourInYear].dayYear; - maxMrgOut[h] = Math::Min(niveau, - OI[h] + in.hydroMaxPower[dayYear] - in.hydroGeneration[h]); + maxMrgOut[h] = Math::Min( + niveau, + OI[h] + in.maxHourlyGenPower->getCoefficient(in.year, h + in.hourInYear) + - in.hydroGeneration[h]); SM += maxMrgOut[h] - OI[h]; } else