diff --git a/.github/workflows/centos7-system-deps-build.yml b/.github/workflows/centos7-system-deps-build.yml index 89f5789fa5..bd00b30703 100644 --- a/.github/workflows/centos7-system-deps-build.yml +++ b/.github/workflows/centos7-system-deps-build.yml @@ -52,7 +52,7 @@ jobs: source /opt/rh/devtoolset-9/enable #git 2.x must be enabled for Coin compilation with CMake ExternalProject_Add source /opt/rh/rh-git227/enable - cmake -B _build -S src -DCMAKE_BUILD_TYPE=release -DBUILD_TESTING=ON + cmake -B _build -S src -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON - name: Build run: | diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml index b17ea4d99d..c0df6c327c 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -17,6 +17,7 @@ env: GITHUB_TOKEN: ${{ github.token }} IS_RELEASE: ${{ github.event_name == 'release' && github.event.action == 'created' }} IS_PUSH: ${{ github.event_name == 'push' }} + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true jobs: @@ -48,7 +49,7 @@ jobs: - name: Config OR-Tools URL run: | - echo "URL_ORTOOLS=https://github.com/rte-france/or-tools/releases/download/v9.5-rte2.0/ortools_cxx_centos7_static_sirius.zip" >> $GITHUB_ENV + echo "URL_ORTOOLS=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_centos7_static_sirius.zip" >> $GITHUB_ENV - name: Download OR-Tools id: ortools @@ -65,7 +66,7 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DDEPS_INSTALL_DIR=/rte-antares-deps-Release \ - -DCMAKE_BUILD_TYPE=release \ + -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=ON \ -DBUILD_not_system=OFF \ -DCMAKE_PREFIX_PATH=${{ env.ORTOOLSDIR }}/install \ diff --git a/.github/workflows/download-extract-precompiled-libraries-zip/action.yml b/.github/workflows/download-extract-precompiled-libraries-zip/action.yml index d849dec71f..745b76236c 100644 --- a/.github/workflows/download-extract-precompiled-libraries-zip/action.yml +++ b/.github/workflows/download-extract-precompiled-libraries-zip/action.yml @@ -27,6 +27,7 @@ runs: wget https://github.com/AntaresSimulatorTeam/antares-deps/releases/download/v${{inputs.antares-deps-version}}/rte-antares-deps-${{inputs.os}}-${{inputs.buildtype}}.zip unzip rte-antares-deps-${{inputs.os}}-${{inputs.buildtype}}.zip rm -rf rte-antares-deps-${{inputs.os}}-${{inputs.buildtype}}.zip + echo "${GITHUB_WORKSPACE}/rte-antares-deps-Release/bin" >> $GITHUB_PATH - name: Download & extract OR-Tools shell: bash diff --git a/.github/workflows/oracle8.yml b/.github/workflows/oracle8.yml index e2d19a21c2..ed68859c56 100644 --- a/.github/workflows/oracle8.yml +++ b/.github/workflows/oracle8.yml @@ -28,8 +28,8 @@ jobs: - name: Install libraries run: | - dnf install -y epel-release git cmake wget rpm-build - dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-9-toolchain + dnf install -y epel-release git cmake wget rpm-build redhat-lsb-core + dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-9-toolchain zlib-devel - name: Checkout run: | @@ -48,11 +48,10 @@ jobs: run: | source /opt/rh/gcc-toolset-9/enable cmake -B _build -S src \ - -DCMAKE_BUILD_TYPE=release \ + -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=ON \ -DBUILD_UI=OFF \ - - name: Build run: | source /opt/rh/gcc-toolset-9/enable diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 4bc3330255..7f62cc7d08 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -6,7 +6,6 @@ on: - main - develop - release/* - pull_request: jobs: sonarcloud: @@ -22,51 +21,24 @@ jobs: # https://sonarcloud.io/documentation/analysis/scan/sonarscanner/ SONAR_SERVER_URL: "https://sonarcloud.io" ORTOOLS_DIR: ${{ github.workspace }}/or-tools - ORTOOLS_URL: "https://github.com/rte-france/or-tools/releases/download/v9.5-rte2.0/ortools_cxx_ubuntu-20.04_static_sirius.zip" steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Config OR-Tools URL + run: | + echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_ubuntu-20.04_static_sirius.zip" >> $GITHUB_ENV + + - name: Install sonar-scanner and build-wrapper + uses: SonarSource/sonarcloud-github-c-cpp@v2 - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: key: sonarcloud-${{ env.SONAR_SCANNER_VERSION }} - - name: Cache SonarCloud packages and analysis - uses: actions/cache@v3 - id: sonarcloud-cache - with: - path: ~/.sonar - key: ${{ runner.os }}-sonar-${{ env.SONAR_SCANNER_VERSION }} - restore-keys: ${{ runner.os }}-sonar-${{ env.SONAR_SCANNER_VERSION }} - - - name: Download and setup sonar-scanner - shell: bash - env: - SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip - if: steps.sonarcloud-cache.outputs.cache-hit != 'true' - run: | - mkdir -p $HOME/.sonar - curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ - - - name: Download and setup build-wrapper - shell: bash - env: - BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip - if: steps.sonarcloud-cache.outputs.cache-hit != 'true' - run: | - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }} - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ - - - name: Set build-wrapper and sonar-scanner paths - run: | - echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH - echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH - - - name: Install libraries run: | sudo apt-get update @@ -113,7 +85,7 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DDEPS_INSTALL_DIR=./rte-antares-deps-Debug \ -DCODE_COVERAGE=ON \ - -DCMAKE_BUILD_TYPE=debug \ + -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_PREFIX_PATH="../install;${{ env.ORTOOLS_DIR }}/install" \ -DBUILD_TESTING=ON \ -DMZ_CODE_COVERAGE=ON \ diff --git a/.github/workflows/ubuntu-system-deps-build.yml b/.github/workflows/ubuntu-system-deps-build.yml index a5cee04842..f3635e6436 100644 --- a/.github/workflows/ubuntu-system-deps-build.yml +++ b/.github/workflows/ubuntu-system-deps-build.yml @@ -43,7 +43,7 @@ jobs: - name: Configure run: | - cmake -B _build -S src -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=release -DBUILD_TESTING=ON + cmake -B _build -S src -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=/usr/bin/gcc-10 -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON - name: Build run: | diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index fc52b143ca..7301cc32df 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -59,7 +59,7 @@ jobs: - name: Config OR-Tools URL run: | - echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/v9.5-rte2.0/ortools_cxx_ubuntu-20.04_static_sirius.zip" >> $GITHUB_ENV + echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_ubuntu-20.04_static_sirius.zip" >> $GITHUB_ENV - name: Download pre-compiled librairies uses: ./.github/workflows/download-extract-precompiled-libraries-tgz @@ -72,7 +72,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.x + python-version: 3.12 - name: Install dependencies run: | @@ -90,14 +90,14 @@ jobs: -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DDEPS_INSTALL_DIR=${{github.workspace}}/rte-antares-deps-Release \ - -DCMAKE_BUILD_TYPE=release \ + -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=ON \ -DBUILD_not_system=OFF \ -DCMAKE_PREFIX_PATH=${{ env.ORTOOLS_DIR }}/install \ - name: Build run: | - cmake --build _build --config release -j2 + cmake --build _build -j$(nproc) - name: Run unfeasibility-related tests if: ${{ env.IS_PUSH == 'true' }} @@ -118,13 +118,6 @@ jobs: cd _build ctest -C Release --output-on-failure -R kirchhoff - - name: Upload logs for failed tests - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: test-log - path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log - # simtest - name: Read simtest version id: simtest-version @@ -197,6 +190,13 @@ jobs: batch-name: long-tests-3 os: ${{ matrix.test-platform }} + - name: Upload logs for failed tests + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: test-log + path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log + - name: Installer .deb creation run: | cd _build diff --git a/.github/workflows/windows-release.yml b/.github/workflows/windows-release.yml index 1b00b39e4d..e1914da172 100644 --- a/.github/workflows/windows-release.yml +++ b/.github/workflows/windows-release.yml @@ -20,16 +20,24 @@ jobs: # Indicates the location of the vcpkg as a Git submodule of the project repository. VCPKG_ROOT: ${{ github.workspace }}/vcpkg ORTOOLS_DIR: ${{ github.workspace }}/or-tools - ORTOOLS_URL: "https://github.com/rte-france/or-tools/releases/download/v9.5-rte2.0/ortools_cxx_windows-latest_static_sirius.zip" steps: - uses: actions/checkout@v3 + - name: Config OR-Tools URL + run: | + echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_windows-latest_static_sirius.zip" >> $GITHUB_ENV + shell: bash + - name: Pre-requisites shell: cmd run: | choco install wget unzip zip --no-progress + - name : Init VCPKG submodule + run: | + git submodule update --init vcpkg + # Restore both vcpkg and its artifacts from the GitHub cache service. - name: Restore vcpkg and its artifacts. uses: actions/cache@v3 @@ -47,15 +55,14 @@ jobs: key: | ${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }} - - name: Setup Python 3.11 + - name: Setup Python 3.12 uses: actions/setup-python@v4 with: architecture: 'x64' - python-version: '3.11' + python-version: '3.12' - name : Install deps with VCPKG run: | - git submodule update --init vcpkg cd vcpkg ./bootstrap-vcpkg.sh vcpkg install ${{matrix.vcpkgPackages}} --triplet ${{matrix.triplet}} @@ -96,7 +103,7 @@ jobs: -DCMAKE_PREFIX_PATH="${{env.ORTOOLS_DIR}}/install" \ -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \ - -DCMAKE_BUILD_TYPE=release \ + -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=ON \ -DBUILD_not_system=OFF @@ -121,6 +128,46 @@ jobs: shell: bash run: rm -rf ${{ github.workspace }}/src/_build/_deps + - name: .zip creation + shell: bash + run: | + cd _build + cpack -G ZIP + export ZIP_NAME=$(ls *.zip) + echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV + + - name: Solver archive creation + shell: bash + run: | + cd _build + zip -r antares-solver_windows.zip solver/Release/antares-*-solver.exe solver/Release/*.dll + + - name: NSIS Installer creation + shell: bash + run: | + rm -rf src/tests/resources/Antares_Simulator_Tests + rm -rf src/tests/resources/NonRegTests + cd _build + cpack -GNSIS + export NSIS_NAME=$(ls *.exe) + echo "NSIS_NAME=$NSIS_NAME" >> $GITHUB_ENV + + - name: Upload NSIS logs + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: NSISOutput.log + path: _build/_CPack_Packages/win64/NSIS/NSISOutput.log + + - name: Upload release assets + uses: softprops/action-gh-release@v0.1.15 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + _build/${{env.NSIS_NAME}} + _build/${{env.ZIP_NAME}} + _build/solver.zip + # simtest - name: Read simtest version id: simtest-version @@ -163,43 +210,3 @@ jobs: simtest-tag: ${{steps.simtest-version.outputs.prop}} batch-name: long-tests-3 os: ${{ matrix.test-platform }} - - - name: .zip creation - shell: bash - run: | - cd _build - cpack -G ZIP - export ZIP_NAME=$(ls *.zip) - echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV - - - name: Solver archive creation - shell: bash - run: | - cd _build - zip -r antares-solver_windows.zip solver/Release/antares-*-solver.exe solver/Release/*.dll - - - name: NSIS Installer creation - shell: bash - run: | - rm -rf src/tests/resources/Antares_Simulator_Tests - rm -rf src/tests/resources/NonRegTests - cd _build - cpack -GNSIS - export NSIS_NAME=$(ls *.exe) - echo "NSIS_NAME=$NSIS_NAME" >> $GITHUB_ENV - - - name: Upload NSIS logs - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: NSISOutput.log - path: _build/_CPack_Packages/win64/NSIS/NSISOutput.log - - - name: Upload release assets - uses: softprops/action-gh-release@v0.1.15 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - _build/${{env.NSIS_NAME}} - _build/${{env.ZIP_NAME}} - _build/solver.zip diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index f6e291cc04..e130ad9c69 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -29,10 +29,16 @@ jobs: VCPKG_ROOT: ${{ github.workspace }}/vcpkg ORTOOLS_DIR: ${{ github.workspace }}/or-tools ORTOOLS_URL: "https://github.com/rte-france/or-tools/releases/download/v9.5-rte2.0/ortools_cxx_windows-latest_static_sirius.zip" + RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule'}} steps: - uses: actions/checkout@v3 + - name: Config OR-Tools URL + run: | + echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_windows-latest_static_sirius.zip" >> $GITHUB_ENV + shell: bash + - name: Pre-requisites shell: cmd run: | @@ -82,11 +88,11 @@ jobs: ortools-url: ${{env.ORTOOLS_URL}} ortools-dir: ${{env.ORTOOLS_DIR}} - - name: Setup Python 3.11 + - name: Setup Python 3.12 uses: actions/setup-python@v4 with: architecture: 'x64' - python-version: '3.11' + python-version: '3.12' - name: Install pip dependencies if necessary run: pip install -r src/tests/examples/requirements.txt @@ -106,14 +112,14 @@ jobs: -DCMAKE_PREFIX_PATH="${{ env.ORTOOLS_DIR }}/install" \ -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \ - -DCMAKE_BUILD_TYPE=release \ + -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=ON \ -DBUILD_not_system=OFF - name: Build shell: bash run: | - cmake --build _build --config release -j2 + cmake --build _build --config Release -j2 - name: Run unfeasibility-related tests run: | @@ -125,13 +131,6 @@ jobs: cd _build ctest -C ${{ matrix.buildtype }} --output-on-failure -L "unit|end-to-end" -LE ortools - - name: Run kirchhoff-constraint-tests - shell: bash - run: | - tar xvf src/tests/kirchhoff-cbuilder/reference.tar.gz -C src/tests/kirchhoff-cbuilder/ - cd _build - ctest -C Release --output-on-failure -R kirchhoff - - name: Upload build on failure if: ${{ failure() }} uses: actions/upload-artifact@v3 diff --git a/docker/oraclelinux b/docker/oraclelinux new file mode 100644 index 0000000000..e8b568119a --- /dev/null +++ b/docker/oraclelinux @@ -0,0 +1,13 @@ +FROM oraclelinux:8 + +# update repo +RUN dnf update -y && \ + dnf install redhat-lsb-core + +# install python & modules +RUN dnf install -y python3 python3-pip && \ + pip3 install --user pandas numpy pytest + +# Install build tools +RUN dnf install -y epel-release git cmake wget rpm-build && \ + dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-9-toolchain diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4ec68b6328..fb605c1d1a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,31 @@ Antares Changelog ================= +# v8.6.6 (03/2024) +## Bugfixes +Adequacy patch CSR - fix DTG MRG (#1982) +Fix ts numbers for no gen clusters (#1969) +Remove unitcount limit for time series generation (#1960) + +# v8.6.4 (11/2023) +## Bugfixes +* Fix Oracle Linux minizip build + actually run zip unit tests (#1744) +* Fix output variable PROFIT for thermal clusters (#1767) + +# v8.6.3 (10/2023) +## Bugfixes +* Increase file size limit from 80Mo to 80Go when reading file. Fix issue on Windows + +# v8.6.2 (08/2023) +## Bugfixes +* Backport [v8.4.3](#v843-082023) changes + +8.6.1 (06/2023) +-------------------- +## Bugfixes +* Fix major bug related to short-term storage & MRG. PRICE + + 8.6.0 (06/2023) -------------------- ## New features @@ -37,9 +62,12 @@ Antares Changelog ## For developers * Bumped OR-Tools 9.2 -> 9.5. CMake 3.18+ is required for build if building OR-Tools, and XPRESS 9.0 for execution (previously 8.13). - -v8.5.0 (02/2022) -------------------- +# v8.5.1 (08/2023) + +* Backport [v8.4.3](#v843-082023) changes + +# v8.5.0 (02/2022) ## New features * Curtailment Sharing Rule for Adequacy Patch #1062, including a scaling coefficient in hurdle costs #1155. This feature was contributed by RTE-i with support from RTE, ELIA and APG. @@ -56,6 +84,15 @@ v8.5.0 (02/2022) * Update docs to include CSR #1156 * Fix examples studies (invalid v8.3.0 -> v8.5.0) #1136 +# v8.4.3 (08/2023) + +## Features +* Increase file size limit from 80Mo to 80Go when reading file. + +## Bugfix +* Fix "unhandled error" with big studies in zip mode. MPS files were too big and hit file size hard limit + + v8.4.2 (01/2022) -------------------- @@ -66,7 +103,7 @@ v8.4.2 (01/2022) ## GUI * Allow more than 100 thermal clusters #1011 * Remove status bar count. The sum was sometimes wrong #1029 -* Remove unused "District marginal prices" button from Advanced Parameters #1067 +* Remove unused "District marginal prices" button from Advanced Parameters (#1067) ## Bugfix * Fix overwritten MPS files when optimization/simplex-range=day #1041 diff --git a/docs/build/3-Build.md b/docs/build/3-Build.md index a918b63d6b..35db6dc185 100644 --- a/docs/build/3-Build.md +++ b/docs/build/3-Build.md @@ -34,7 +34,7 @@ Here is a list of available CMake configure option : |Option | Description | |:-------|-------| -|`CMAKE_BUILD_TYPE` | Define build type. Available values are `release` and `debug` (case insensitive) | +|`CMAKE_BUILD_TYPE` | Define build type. Available values are `Release` and `Debug` | |`BUILD_UI`|Enable or disable Antares Simulator UI compilation (default `ON`)| |`BUILD_ALL`|Enable build of ALL external libraries (default `OFF`)| |`DEPS_INSTALL_DIR`|Define dependencies libraries install directory| diff --git a/ortools_tag b/ortools_tag index 898fb20318..fdaa0174f8 100644 --- a/ortools_tag +++ b/ortools_tag @@ -1 +1 @@ -v9.5-rte2.0 \ No newline at end of file +v9.8-rte1.0 \ No newline at end of file diff --git a/simtest.json b/simtest.json index 1ea3f238e0..210a50f212 100644 --- a/simtest.json +++ b/simtest.json @@ -1,3 +1,3 @@ { - "version": "v8.6.0c" + "version": "v8.6.7" } diff --git a/sonar-project.properties b/sonar-project.properties index b97b5fd634..ca563ef345 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ sonar.projectName=Antares_Simulator sonar.projectKey=AntaresSimulatorTeam_Antares_Simulator sonar.organization=antaressimulatorteam -sonar.projectVersion=8.6.0 +sonar.projectVersion=8.6.4 # ===================================================== # Properties that will be shared amongst all modules diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f43eec920c..a200843746 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # Version set(ANTARES_VERSION_HI 8) set(ANTARES_VERSION_LO 6) -set(ANTARES_VERSION_REVISION 0) -set(ANTARES_VERSION_YEAR 2023) +set(ANTARES_VERSION_REVISION 9) +set(ANTARES_VERSION_YEAR 2024) project(antares VERSION ${ANTARES_VERSION_HI}.${ANTARES_VERSION_LO}.${ANTARES_VERSION_REVISION}) @@ -64,8 +64,6 @@ execute_process(COMMAND OUTPUT_VARIABLE GIT_SHA1_SHORT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) -string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE) - # Build Configuration set(ANTARES_TARGET "${CMAKE_BUILD_TYPE}") @@ -141,7 +139,7 @@ OMESSAGE("") OMESSAGE("") #Display Build Configuration (debug or release) -if("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "tuning") +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") OMESSAGE("{antares} Build Configuration: RELEASE") else() OMESSAGE("{antares} Build Configuration: DEBUG") @@ -150,7 +148,7 @@ endif() # # Yuni Framework # -if("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "tuning") +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") set(YUNI_TARGET_MODE "release") set(ANTARES_VERSION_TARGET "release") else() @@ -194,7 +192,7 @@ endif() # Add DEPS_INSTALL_DIR with antares-xpansion CMAKE_BUILD_TYPE -if ("${CMAKE_BUILD_TYPE}" STREQUAL "release") +if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") string(REPLACE ${CMAKE_BUILD_TYPE} Release DEPS_INSTALL_DIR_XPANSION @@ -261,7 +259,8 @@ message(STATUS "OR-Tools tag ${ORTOOLS_TAG}") set(BUILD_SAMPLES "OFF" CACHE INTERNAL "") set(BUILD_FLATZINC "OFF" CACHE INTERNAL "") set(BUILD_EXAMPLES "OFF" CACHE INTERNAL "") - set(USE_SCIP "OFF" CACHE INTERNAL "") + set(USE_SCIP "ON" CACHE INTERNAL "") + set(USE_GLPK "ON" CACHE INTERNAL "") # We build OR-Tools as a static lib. Cyclic dependencies are detected # without this flag. set(BUILD_SHARED_LIBS "OFF" CACHE INTERNAL "") @@ -345,11 +344,11 @@ OMESSAGE("") # Informations for NSIS if(WIN32 OR WIN64) if(MSVC) - if("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "tuning") + if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") set(NSIS_TARGET "Release") - else("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "tuning") + else() set(NSIS_TARGET "Debug") - endif("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "tuning") + endif() set(COMPILER_MARK "v") #set(COMPILER_INCLUDE "vs9") else(MSVC) diff --git a/src/cmake/common-settings.cmake b/src/cmake/common-settings.cmake index 86ece44167..81e732eaad 100644 --- a/src/cmake/common-settings.cmake +++ b/src/cmake/common-settings.cmake @@ -22,7 +22,7 @@ macro(EMBED_MANIFEST manifestfile target) if(MSVC AND NOT MSVC9) message(STATUS "{antares} :: adding rule for manifest ${manifestfile}") set(ANTARES_UI_BIN_TARGET "Debug\\") - if("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "tuning") + if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") set(ANTARES_UI_BIN_TARGET "Release\\") endif() @@ -40,7 +40,7 @@ endmacro() # # Ex: cmake . -DCMAKE_BUILD_TYPE=release # -if("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "tuning") +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") # # Build Configuration: Release @@ -59,12 +59,6 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "t if (NOT MSVC) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -std=c99") endif() - - if("${CMAKE_BUILD_TYPE}" STREQUAL "tuning") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -pg --no-inline") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pg --no-inline") - endif("${CMAKE_BUILD_TYPE}" STREQUAL "tuning") - else() # @@ -214,7 +208,7 @@ endmacro() macro(executable_strip TARGET) - if("${CMAKE_BUILD_TYPE}" STREQUAL "release") + if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") if(NOT MSVC) if(WIN32) add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_STRIP} $) @@ -225,7 +219,7 @@ macro(executable_strip TARGET) endif() endmacro() -if("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "tuning") +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") diff --git a/src/cmake/utils.cmake b/src/cmake/utils.cmake index b470a700fc..3e3aeb7e20 100644 --- a/src/cmake/utils.cmake +++ b/src/cmake/utils.cmake @@ -1,10 +1,8 @@ macro(copy_dependency deps target) - if("${CMAKE_BUILD_TYPE}" STREQUAL "release") - + if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") get_target_property( DEP_SHARED_LIB_PATH ${deps} IMPORTED_LOCATION_RELEASE ) else() - get_target_property( DEP_SHARED_LIB_PATH ${deps} IMPORTED_LOCATION_DEBUG ) endif() diff --git a/src/ext/yuni/src/cmake/common-settings.cmake b/src/ext/yuni/src/cmake/common-settings.cmake index 9c8410ad3b..d92357ebde 100644 --- a/src/ext/yuni/src/cmake/common-settings.cmake +++ b/src/ext/yuni/src/cmake/common-settings.cmake @@ -12,7 +12,7 @@ include(CheckCXXCompilerFlag) set_property(GLOBAL PROPERTY USE_FOLDERS true) -if ("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE") +if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") set(YUNI_) else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}") @@ -305,7 +305,7 @@ if(NOT "${YUNI_CXX_FLAGS_OVERRIDE_ADD_RELWITHDEBINFO}" STREQUAL "") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${YUNI_CXX_FLAGS_OVERRIDE_ADD_RELWITHDEBINFO}") endif() -if ("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE") +if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG}") diff --git a/src/ext/yuni/src/cmake/target.cmake b/src/ext/yuni/src/cmake/target.cmake index b0e23cfff0..3f67bfc489 100644 --- a/src/ext/yuni/src/cmake/target.cmake +++ b/src/ext/yuni/src/cmake/target.cmake @@ -24,8 +24,8 @@ if(NO_BUILD_TYPE) endif() endif() -string(COMPARE EQUAL "${CMAKE_BUILD_TYPE}" "debug" BUILD_TYPE_IS_DEBUG) -string(COMPARE EQUAL "${CMAKE_BUILD_TYPE}" "release" BUILD_TYPE_IS_RELEASE) +string(COMPARE EQUAL "${CMAKE_BUILD_TYPE}" "Debug" BUILD_TYPE_IS_DEBUG) +string(COMPARE EQUAL "${CMAKE_BUILD_TYPE}" "Release" BUILD_TYPE_IS_RELEASE) if(NOT BUILD_TYPE_IS_DEBUG AND NOT BUILD_TYPE_IS_RELEASE) set(CMAKE_BUILD_TYPE "debug") endif() diff --git a/src/ext/yuni/src/yuni/io/file/file.h b/src/ext/yuni/src/yuni/io/file/file.h index dcb45a195a..621bd8a3a6 100644 --- a/src/ext/yuni/src/yuni/io/file/file.h +++ b/src/ext/yuni/src/yuni/io/file/file.h @@ -23,11 +23,9 @@ namespace IO namespace File { // constants -enum -{ - //! The maximum allowed size for a file in memory (Default: 80Mo) - sizeHardLimit = 83886080u, // 80Mo = 80 * 1024 * 1024 -}; +//! The maximum allowed size for a file in memory (Default: 80Go) +constexpr unsigned long long sizeHardLimit = 85899345920u; // 80Gb = 80 * 1024 * 1024 * 1024 + /*! ** \brief Test if a node exists and is actually a file diff --git a/src/libs/antares/CMakeLists.txt b/src/libs/antares/CMakeLists.txt index bca3f6ab8a..da96529d94 100644 --- a/src/libs/antares/CMakeLists.txt +++ b/src/libs/antares/CMakeLists.txt @@ -577,6 +577,7 @@ target_include_directories(libantares-core target_link_libraries(libantares-core PUBLIC + ortools::ortools yuni-static-core yuni-static-uuid libantares-core-calendar diff --git a/src/libs/antares/study/parameters/adq-patch-params.cpp b/src/libs/antares/study/parameters/adq-patch-params.cpp index 584ff0f095..c51d554359 100644 --- a/src/libs/antares/study/parameters/adq-patch-params.cpp +++ b/src/libs/antares/study/parameters/adq-patch-params.cpp @@ -176,7 +176,6 @@ bool AdqPatchParams::checkAdqPatchParams(const StudyMode studyMode, checkAdqPatchStudyModeEconomyOnly(studyMode); checkAdqPatchContainsAdqPatchArea(areas); checkAdqPatchIncludeHurdleCost(includeHurdleCostParameters); - checkAdqPatchDisabledLocalMatching(); return true; } @@ -205,11 +204,4 @@ void AdqPatchParams::checkAdqPatchIncludeHurdleCost(const bool includeHurdleCost if (curtailmentSharing.includeHurdleCost && !includeHurdleCostParameters) throw Error::IncompatibleHurdleCostCSR(); } - -void AdqPatchParams::checkAdqPatchDisabledLocalMatching() const -{ - if (!localMatching.enabled && curtailmentSharing.priceTakingOrder == AdqPatchPTO::isDens) - throw Error::AdqPatchDisabledLMR(); -} - -} // Antares::Data::AdequacyPatch +} // namespace Antares::Data::AdequacyPatch diff --git a/src/libs/antares/study/parameters/adq-patch-params.h b/src/libs/antares/study/parameters/adq-patch-params.h index 796e905837..66bfed70cf 100644 --- a/src/libs/antares/study/parameters/adq-patch-params.h +++ b/src/libs/antares/study/parameters/adq-patch-params.h @@ -11,7 +11,6 @@ using namespace Yuni; namespace Antares::Data::AdequacyPatch { - //! A default threshold value for initiate curtailment sharing rule const double defaultThresholdToRunCurtailmentSharing = 0.0; //! A default threshold value for display local matching rule violations @@ -60,7 +59,6 @@ enum class AdqPatchPTO }; // enum AdqPatchPTO - struct LocalMatching { bool enabled = true; @@ -73,12 +71,11 @@ struct LocalMatching //! rule. bool setToZeroOutsideOutsideLinks = true; /*! - ** \brief Reset to default values related to local matching - */ + ** \brief Reset to default values related to local matching + */ void reset(); bool updateFromKeyValue(const String& key, const String& value); void addProperties(IniFile::Section* section) const; - }; class CurtailmentSharing @@ -97,7 +94,9 @@ class CurtailmentSharing //! Check CSR cost function prior & after CSR optimization bool checkCsrCostFunction; - bool updateFromKeyValue(const String& key, const String& value); + bool recomputeDTGMRG = false; + + bool updateFromKeyValue(const Yuni::String& key, const Yuni::String& value); void addProperties(IniFile::Section* section) const; void reset(); @@ -106,10 +105,8 @@ class CurtailmentSharing void resetThresholds(); }; - struct AdqPatchParams { - bool enabled; LocalMatching localMatching; CurtailmentSharing curtailmentSharing; @@ -122,11 +119,9 @@ struct AdqPatchParams const AreaList& areas, const bool includeHurdleCostParameters) const; - void checkAdqPatchStudyModeEconomyOnly(const StudyMode studyMode) const; void checkAdqPatchContainsAdqPatchArea(const Antares::Data::AreaList& areas) const; void checkAdqPatchIncludeHurdleCost(const bool includeHurdleCost) const; - void checkAdqPatchDisabledLocalMatching() const; }; } // namespace Antares::Data::AdequacyPatch diff --git a/src/libs/antares/study/parts/short-term-storage/properties.cpp b/src/libs/antares/study/parts/short-term-storage/properties.cpp index d09b99c65a..0b997a2e77 100644 --- a/src/libs/antares/study/parts/short-term-storage/properties.cpp +++ b/src/libs/antares/study/parts/short-term-storage/properties.cpp @@ -98,9 +98,6 @@ bool Properties::loadKey(const IniFile::Property* p) if (p->key == "name") return p->value.to(this->name); - if (p->key == "storagecycle") - return p->value.to(this->cycleDuration); - if (p->key == "initiallevel") return valueForOptional(this->initialLevel); @@ -149,7 +146,6 @@ bool Properties::saveToFolder(const std::string& folder) const s->add("withdrawalnominalcapacity", this->withdrawalNominalCapacity); s->add("efficiency", this->efficiencyFactor); - s->add("storagecycle", this->cycleDuration); s->add("initialleveloptim", this->initialLevelOptim); diff --git a/src/libs/antares/study/parts/short-term-storage/properties.h b/src/libs/antares/study/parts/short-term-storage/properties.h index 933904a4e7..4d566d0d53 100644 --- a/src/libs/antares/study/parts/short-term-storage/properties.h +++ b/src/libs/antares/study/parts/short-term-storage/properties.h @@ -68,8 +68,6 @@ class Properties bool initialLevelOptim = false; // Efficiency factor between 0 and 1 double efficiencyFactor = 1; - // Cycle duration, 1 <= cycleDuration <= 168 - unsigned int cycleDuration; // Used to sort outputs Group group = Group::Other1; // cluster name diff --git a/src/libs/antares/study/scenario-builder/TSnumberData.cpp b/src/libs/antares/study/scenario-builder/TSnumberData.cpp index 2b35738421..5235d74a3c 100644 --- a/src/libs/antares/study/scenario-builder/TSnumberData.cpp +++ b/src/libs/antares/study/scenario-builder/TSnumberData.cpp @@ -395,8 +395,6 @@ bool thermalTSNumberData::apply(Study& study) // WARNING: We may have some thermal clusters with the `mustrun` option auto clusterCount = (uint)area.thermal.clusterCount(); - const uint tsGenCountThermal = get_tsGenCount(study); - for (uint clusterIndex = 0; clusterIndex != clusterCount; ++clusterIndex) { auto& cluster = *(area.thermal.clusters[clusterIndex]); @@ -404,9 +402,13 @@ bool thermalTSNumberData::apply(Study& study) assert(clusterIndex < pTSNumberRules.width); const auto& col = pTSNumberRules[clusterIndex]; - logprefix.clear() << "Thermal: Area '" << area.name << "', cluster: '" << cluster.name() + uint tsGenCount = cluster.tsGenBehavior == LocalTSGenerationBehavior::forceNoGen ? + cluster.series->timeSeries.width : get_tsGenCount(study); + + logprefix.clear() << "Thermal: area '" << area.name << "', cluster: '" << cluster.name() << "': "; - ret = ApplyToMatrix(errors, logprefix, *cluster.series, col, tsGenCountThermal) && ret; + ret = ApplyToMatrix(errors, logprefix, *cluster.series, col, tsGenCount) && ret; + } return ret; } diff --git a/src/solver/misc/options.cpp b/src/solver/misc/options.cpp index e4d482a999..e1fb15d666 100644 --- a/src/solver/misc/options.cpp +++ b/src/solver/misc/options.cpp @@ -54,20 +54,6 @@ using namespace Yuni; using namespace Antares; using namespace Antares::Data; -static std::string availableOrToolsSolversString() -{ - const std::list availableSolverList = getAvailableOrtoolsSolverName(); - std::string availableSolverListStr; - for (auto it = availableSolverList.begin(); it != availableSolverList.end(); it++) - { - availableSolverListStr += *it + ";"; - } - // Remove last semicolumn - if (!availableSolverListStr.empty()) - availableSolverListStr.pop_back(); - return availableSolverListStr; -} - std::unique_ptr CreateParser(Settings& settings, Antares::Data::StudyLoadOptions& options) { diff --git a/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp b/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp index 9bf0665d4b..d02c6ea7cd 100644 --- a/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp +++ b/src/solver/optimisation/adequacy_patch_csr/adq_patch_post_process_list.cpp @@ -1,57 +1,35 @@ #include "adq_patch_post_process_list.h" #include "../post_process_commands.h" - namespace Antares::Solver::Simulation { - AdqPatchPostProcessList::AdqPatchPostProcessList(const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, uint thread_number, AreaList& areas, SheddingPolicy sheddingPolicy, SimplexOptimization splxOptimization, - Calendar& calendar) - : interfacePostProcessList(problemeHebdo, thread_number) + Calendar& calendar) : + interfacePostProcessList(problemeHebdo, thread_number) { - post_process_list.push_back(std::make_unique( - problemeHebdo_, - thread_number_, - areas)); + post_process_list.push_back( + std::make_unique(problemeHebdo_, thread_number_, areas)); // Here a post process particular to adq patch post_process_list.push_back(std::make_unique( - adqPatchParams, - problemeHebdo_, - areas, - thread_number_)); - post_process_list.push_back(std::make_unique( - problemeHebdo_, - areas, - false, - false)); + adqPatchParams, problemeHebdo_, areas, thread_number_)); + post_process_list.push_back( + std::make_unique(problemeHebdo_, areas, false, false)); post_process_list.push_back(std::make_unique( - problemeHebdo_, - areas, - sheddingPolicy, - splxOptimization, - thread_number)); + problemeHebdo_, areas, sheddingPolicy, splxOptimization, thread_number)); // Here a post process particular to adq patch post_process_list.push_back(std::make_unique( - problemeHebdo_, - areas, - thread_number)); - post_process_list.push_back(std::make_unique( - problemeHebdo_, - areas, - true, - false)); - post_process_list.push_back(std::make_unique( - problemeHebdo_, - areas, - calendar)); - post_process_list.push_back(std::make_unique( - problemeHebdo_, - areas)); + adqPatchParams, problemeHebdo_, areas, thread_number)); + post_process_list.push_back( + std::make_unique(problemeHebdo_, areas, true, false)); + post_process_list.push_back( + std::make_unique(problemeHebdo_, areas, calendar)); + post_process_list.push_back( + std::make_unique(problemeHebdo_, areas)); } -} // namespace Antares::Solver::Simulation \ No newline at end of file +} // namespace Antares::Solver::Simulation 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 17746819a3..f3eaf48b9d 100644 --- a/src/solver/optimisation/opt_gestion_des_couts_cas_lineaire.cpp +++ b/src/solver/optimisation/opt_gestion_des_couts_cas_lineaire.cpp @@ -39,7 +39,10 @@ #include "opt_fonctions.h" #include "../aleatoire/alea_fonctions.h" +extern "C" +{ #include "spx_constantes_externes.h" +} static void shortTermStorageCost( int PremierPdtDeLIntervalle, @@ -50,13 +53,13 @@ static void shortTermStorageCost( double* linearCost) { SIM::SpreadGenerator spreadGenerator; - int pdtJour = 0; for (int pays = 0; pays < NombreDePays; ++pays) { for (const auto& storage : shortTermStorageInput[pays]) { - for (int pdtHebdo = PremierPdtDeLIntervalle; pdtHebdo < DernierPdtDeLIntervalle; - pdtHebdo++) + for (int pdtHebdo = PremierPdtDeLIntervalle, pdtJour = 0; + pdtHebdo < DernierPdtDeLIntervalle; + pdtHebdo++, pdtJour++) { auto VarCurrent = CorrespondanceVarNativesVarOptim[pdtJour]; const int clusterGlobalIndex = storage.clusterGlobalIndex; @@ -82,7 +85,6 @@ static void shortTermStorageCost( linearCost[varWithdrawal] = storage.efficiency * cost; } } - pdtJour++; } } } diff --git a/src/solver/optimisation/opt_structure_probleme_a_resoudre.h b/src/solver/optimisation/opt_structure_probleme_a_resoudre.h index 6a3285c7fd..c289765eb7 100644 --- a/src/solver/optimisation/opt_structure_probleme_a_resoudre.h +++ b/src/solver/optimisation/opt_structure_probleme_a_resoudre.h @@ -30,6 +30,7 @@ #include #include #include "opt_constants.h" +#include "ortools/linear_solver/linear_solver.h" /*--------------------------------------------------------------------------------------*/ @@ -40,7 +41,7 @@ typedef struct } PROBLEMES_SIMPLEXE; /* Le probleme a resoudre */ -typedef struct +struct PROBLEME_ANTARES_A_RESOUDRE { /* La matrice des contraintes */ int NombreDeVariables; @@ -111,10 +112,14 @@ typedef struct std::vector NomDesVariables; std::vector NomDesContraintes; + std::vector VariablesEntieres; // true = int, false = continuous + +private: + using BasisStatus = operations_research::MPSolver::BasisStatus; public: - std::vector StatutDesVariables; - std::vector StatutDesContraintes; + std::vector StatutDesVariables; + std::vector StatutDesContraintes; -} PROBLEME_ANTARES_A_RESOUDRE; +}; #endif /* __SOLVER_OPTIMISATION_STRUCTURE_PROBLEME_A_RESOUDRE_H__ */ diff --git a/src/solver/optimisation/post_process_commands.cpp b/src/solver/optimisation/post_process_commands.cpp index 170de3df36..72334a7255 100644 --- a/src/solver/optimisation/post_process_commands.cpp +++ b/src/solver/optimisation/post_process_commands.cpp @@ -1,3 +1,23 @@ +/* +** Copyright 2007-2024, RTE (https://www.rte-france.com) +** See AUTHORS.txt +** SPDX-License-Identifier: MPL-2.0 +** This file is part of Antares-Simulator, +** Adequacy and Performance assessment for interconnected energy networks. +** +** Antares_Simulator is free software: you can redistribute it and/or modify +** it under the terms of the Mozilla Public Licence 2.0 as published by +** the Mozilla Foundation, either version 2 of the License, or +** (at your option) any later version. +** +** Antares_Simulator is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** Mozilla Public Licence 2.0 for more details. +** +** You should have received a copy of the Mozilla Public Licence 2.0 +** along with Antares_Simulator. If not, see . +*/ #include "post_process_commands.h" #include "../simulation/common-eco-adq.h" @@ -105,10 +125,14 @@ void RemixHydroPostProcessCmd::execute(const optRuntimeData& opt_runtime_data) using namespace Antares::Data::AdequacyPatch; DTGmarginForAdqPatchPostProcessCmd::DTGmarginForAdqPatchPostProcessCmd( + const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, AreaList& areas, unsigned int thread_number) : - basePostProcessCommand(problemeHebdo), area_list_(areas), thread_number_(thread_number) + basePostProcessCommand(problemeHebdo), + adqPatchParams_(adqPatchParams), + area_list_(areas), + thread_number_(thread_number) { } @@ -136,8 +160,11 @@ void DTGmarginForAdqPatchPostProcessCmd::execute(const optRuntimeData&) // calculate DTG MRG CSR and adjust ENS if neccessary if (problemeHebdo_->adequacyPatchRuntimeData->wasCSRTriggeredAtAreaHour(Area, hour)) { - dtgMrgCsr = std::max(0.0, dtgMrg - ens); - ens = std::max(0.0, ens - dtgMrg); + if (adqPatchParams_.curtailmentSharing.recomputeDTGMRG) + { + dtgMrgCsr = std::max(0.0, dtgMrg - ens); + ens = std::max(0.0, ens - dtgMrg); + } // set MRG PRICE to value of unsupplied energy cost, if LOLD=1.0 (ENS>0.5) if (ens > 0.5) mrgCost = -area_list_[Area]->thermal.unsuppliedEnergyCost; @@ -190,8 +217,8 @@ CurtailmentSharingPostProcessCmd::CurtailmentSharingPostProcessCmd(const AdqPatc AreaList& areas, unsigned int thread_number) : basePostProcessCommand(problemeHebdo), + area_list_(areas), adqPatchParams_(adqPatchParams), - area_list_(areas), thread_number_(thread_number) { } @@ -225,30 +252,31 @@ double CurtailmentSharingPostProcessCmd::calculateDensNewAndTotalLmrViolation() { for (uint hour = 0; hour < nbHoursInWeek; hour++) { - const auto [netPositionInit, densNew, totalNodeBalance] - = calculateAreaFlowBalance(problemeHebdo_, - adqPatchParams_.localMatching.setToZeroOutsideInsideLinks, - Area, - hour); + const auto [netPositionInit, densNew, totalNodeBalance] = calculateAreaFlowBalance( + problemeHebdo_, + adqPatchParams_.localMatching.setToZeroOutsideInsideLinks, + Area, + hour); // adjust densNew according to the new specification/request by ELIA /* DENS_new (node A) = max [ 0; ENS_init (node A) + net_position_init (node A) + ? flows (node 1 -> node A) - DTG.MRG(node A)] */ const auto& scratchpad = area_list_[Area]->scratchpad[thread_number_]; double dtgMrg = scratchpad.dispatchableGenerationMargin[hour]; // write down densNew values for all the hours - problemeHebdo_->ResultatsHoraires[Area].ValeursHorairesDENS[hour] - = std::max(0.0, densNew - dtgMrg); - ; + problemeHebdo_->ResultatsHoraires[Area].ValeursHorairesDENS[hour] = std::max( + 0.0, + densNew); // copy spilled Energy values into spilled Energy values after CSR problemeHebdo_->ResultatsHoraires[Area].ValeursHorairesSpilledEnergyAfterCSR[hour] = problemeHebdo_->ResultatsHoraires[Area] .ValeursHorairesDeDefaillanceNegative[hour]; // check LMR violations totalLmrViolation += LmrViolationAreaHour( - problemeHebdo_, - totalNodeBalance, - adqPatchParams_.curtailmentSharing.thresholdDisplayViolations, - Area, hour); + problemeHebdo_, + totalNodeBalance, + adqPatchParams_.curtailmentSharing.thresholdDisplayViolations, + Area, + hour); } } } diff --git a/src/solver/optimisation/post_process_commands.h b/src/solver/optimisation/post_process_commands.h index d04daf02ce..4a58237bb2 100644 --- a/src/solver/optimisation/post_process_commands.h +++ b/src/solver/optimisation/post_process_commands.h @@ -51,14 +51,18 @@ class RemixHydroPostProcessCmd : public basePostProcessCommand class DTGmarginForAdqPatchPostProcessCmd : public basePostProcessCommand { + using AdqPatchParams = Antares::Data::AdequacyPatch::AdqPatchParams; + public: - DTGmarginForAdqPatchPostProcessCmd(PROBLEME_HEBDO* problemeHebdo, + DTGmarginForAdqPatchPostProcessCmd(const AdqPatchParams& adqPatchParams, + PROBLEME_HEBDO* problemeHebdo, AreaList& areas, unsigned int thread_number); void execute(const optRuntimeData& opt_runtime_data) override; private: + const AdqPatchParams& adqPatchParams_; const AreaList& area_list_; unsigned int thread_number_ = 0; }; @@ -91,6 +95,7 @@ class HydroLevelsFinalUpdatePostProcessCmd : public basePostProcessCommand class CurtailmentSharingPostProcessCmd : public basePostProcessCommand { using AdqPatchParams = Antares::Data::AdequacyPatch::AdqPatchParams; + public: CurtailmentSharingPostProcessCmd(const AdqPatchParams& adqPatchParams, PROBLEME_HEBDO* problemeHebdo, diff --git a/src/solver/ts-generator/thermal.cpp b/src/solver/ts-generator/thermal.cpp index b0f069ea73..5ee965c913 100644 --- a/src/solver/ts-generator/thermal.cpp +++ b/src/solver/ts-generator/thermal.cpp @@ -94,7 +94,6 @@ class GeneratorTempData final private: uint nbHoursPerYear; - const uint daysPerYear; MersenneTwister& rndgenerator; @@ -125,9 +124,8 @@ class GeneratorTempData final double bp[366]; - double FPOW[366][102]; - - double PPOW[366][102]; + std::vector> FPOW; + std::vector> PPOW; String pTempFilename; @@ -141,7 +139,6 @@ GeneratorTempData::GeneratorTempData(Data::Study& study, IResultWriter::Ptr writer) : study(study), nbHoursPerYear(study.runtime->nbHoursPerYear), - daysPerYear(study.runtime->nbDaysPerYear), rndgenerator(study.runtime->random[Data::seedTsGenThermal]), pProgression(progr), pWriter(writer) @@ -153,6 +150,9 @@ GeneratorTempData::GeneratorTempData(Data::Study& study, nbThermalTimeseries = parameters.nbTimeSeriesThermal; derated = parameters.derated; + + FPOW.resize(DAYS_PER_YEAR); + PPOW.resize(DAYS_PER_YEAR); } void GeneratorTempData::writeResultsToDisk(const Data::Area& area, @@ -191,7 +191,7 @@ void GeneratorTempData::prepareIndispoFromLaw(Data::ThermalLaw law, { case Data::thermalLawUniform: { - for (uint d = 0; d < daysPerYear; ++d) + for (uint d = 0; d < DAYS_PER_YEAR; ++d) { double D = (double)duration[d]; double xtemp = volatility * (D - 1.); @@ -202,7 +202,7 @@ void GeneratorTempData::prepareIndispoFromLaw(Data::ThermalLaw law, } case Data::thermalLawGeometric: { - for (uint d = 0; d < daysPerYear; ++d) + for (uint d = 0; d < DAYS_PER_YEAR; ++d) { double D = (double)duration[d]; double xtemp = volatility * volatility * D * (D - 1.); @@ -312,8 +312,11 @@ void GeneratorTempData::operator()(Data::Area& area, Data::ThermalCluster& clust int FOD_reel = 0; int POD_reel = 0; - for (uint d = 0; d < daysPerYear; ++d) + for (uint d = 0; d < DAYS_PER_YEAR; ++d) { + FPOW[d].resize(cluster.unitCount + 1); + PPOW[d].resize(cluster.unitCount + 1); + PODOfTheDay = (int)POD[d]; FODOfTheDay = (int)FOD[d]; @@ -385,9 +388,8 @@ void GeneratorTempData::operator()(Data::Area& area, Data::ThermalCluster& clust if (tsIndex > 1) dstSeries = &cluster.series->timeSeries[tsIndex - 2]; - for (uint dayInTheYear = 0; dayInTheYear < daysPerYear; ++dayInTheYear) + for (uint dayInTheYear = 0; dayInTheYear < DAYS_PER_YEAR; ++dayInTheYear) { - assert(AUN <= 100 and "Thermal Prepro: AUN is out of bounds (>=100)"); assert(dayInTheYear < 366); assert(not(lf[dayInTheYear] < 0.)); assert(not(lp[dayInTheYear] < 0.)); diff --git a/src/solver/utils/CMakeLists.txt b/src/solver/utils/CMakeLists.txt index 5d4bfd160a..18988981d6 100644 --- a/src/solver/utils/CMakeLists.txt +++ b/src/solver/utils/CMakeLists.txt @@ -3,7 +3,7 @@ set(SRC ortools_utils.cpp filename.h filename.cpp - named_problem.h + include/antares/solver/utils/named_problem.h named_problem.cpp mps_utils.h mps_utils.cpp @@ -26,3 +26,8 @@ target_link_libraries(utils sirius_solver libantares-core ) + +target_include_directories(utils + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include +) diff --git a/src/solver/utils/include/antares/solver/utils/named_problem.h b/src/solver/utils/include/antares/solver/utils/named_problem.h new file mode 100644 index 0000000000..ab9a712198 --- /dev/null +++ b/src/solver/utils/include/antares/solver/utils/named_problem.h @@ -0,0 +1,37 @@ +#pragma once + +#include "spx_definition_arguments.h" +#include "spx_fonctions.h" + +#include +#include +#include +#include +#include "ortools/linear_solver/linear_solver.h" + +namespace Antares +{ +namespace Optimization +{ +struct PROBLEME_SIMPLEXE_NOMME : public PROBLEME_SIMPLEXE +{ +private: + using BasisStatus = operations_research::MPSolver::BasisStatus; +public: + PROBLEME_SIMPLEXE_NOMME(std::vector& NomDesVariables, + std::vector& NomDesContraintes, + std::vector& StatutDesVariables, + std::vector& StatutDesContraintes); + + std::vector& NomDesVariables; + std::vector& NomDesContraintes; + + std::vector& StatutDesVariables; + std::vector& StatutDesContraintes; + + bool isMIP() const; + bool basisExists() const; + +}; +} // namespace Optimization +} // namespace Antares diff --git a/src/solver/utils/mps_utils.h b/src/solver/utils/mps_utils.h index 05dc58876e..d254241820 100644 --- a/src/solver/utils/mps_utils.h +++ b/src/solver/utils/mps_utils.h @@ -8,7 +8,7 @@ extern "C" #include "srs_api.h" } -#include "named_problem.h" +#include "include/antares/solver/utils/named_problem.h" #include "ortools_utils.h" using namespace Antares; diff --git a/src/solver/utils/named_problem.cpp b/src/solver/utils/named_problem.cpp index 8411838207..90ad846543 100644 --- a/src/solver/utils/named_problem.cpp +++ b/src/solver/utils/named_problem.cpp @@ -1,13 +1,15 @@ -#include "named_problem.h" +#include "antares/solver/utils/named_problem.h" namespace Antares { namespace Optimization { -PROBLEME_SIMPLEXE_NOMME::PROBLEME_SIMPLEXE_NOMME(const std::vector& NomDesVariables, - const std::vector& NomDesContraintes, - std::vector& StatutDesVariables, - std::vector& StatutDesContraintes) : +using BasisStatus = operations_research::MPSolver::BasisStatus; + +PROBLEME_SIMPLEXE_NOMME::PROBLEME_SIMPLEXE_NOMME(std::vector& NomDesVariables, + std::vector& NomDesContraintes, + std::vector& StatutDesVariables, + std::vector& StatutDesContraintes) : NomDesVariables(NomDesVariables), NomDesContraintes(NomDesContraintes), StatutDesVariables(StatutDesVariables), diff --git a/src/solver/utils/named_problem.h b/src/solver/utils/named_problem.h deleted file mode 100644 index c83fa7d32d..0000000000 --- a/src/solver/utils/named_problem.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "spx_definition_arguments.h" -#include "spx_fonctions.h" - -#include -#include - -namespace Antares -{ -namespace Optimization -{ -struct PROBLEME_SIMPLEXE_NOMME : public PROBLEME_SIMPLEXE -{ -private: -public: - PROBLEME_SIMPLEXE_NOMME(const std::vector& NomDesVariables, - const std::vector& NomDesContraintes, - std::vector& StatutDesVariables, - std::vector& StatutDesContraintes); - - const std::vector& NomDesVariables; - const std::vector& NomDesContraintes; - std::vector& StatutDesVariables; - std::vector& StatutDesContraintes; - - bool isMIP() const; - bool basisExists() const; -}; -} // namespace Optimization -} // namespace Antares diff --git a/src/solver/utils/ortools_utils.cpp b/src/solver/utils/ortools_utils.cpp index da63a8d28d..ff6b04caae 100644 --- a/src/solver/utils/ortools_utils.cpp +++ b/src/solver/utils/ortools_utils.cpp @@ -299,6 +299,17 @@ MPSolver* ORTOOLS_ConvertIfNeeded(const Antares::Optimization::PROBLEME_SIMPLEXE } } +template +static void transferBasis(std::vector& destination, + const SourceT& source) +{ + destination.resize(source.size()); + for (size_t idx = 0; idx < source.size(); idx++) + { + destination[idx] = source[idx]->basis_status(); + } +} + MPSolver* ORTOOLS_Simplexe(Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* Probleme, MPSolver* solver, bool keepBasis) @@ -309,7 +320,8 @@ MPSolver* ORTOOLS_Simplexe(Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* Probl // Provide an initial simplex basis, if any if (warmStart && Probleme->basisExists()) { - solver->SetStartingLpBasisInt(Probleme->StatutDesVariables, Probleme->StatutDesContraintes); + solver->SetStartingLpBasis(Probleme->StatutDesVariables, + Probleme->StatutDesContraintes); } if (solveAndManageStatus(solver, Probleme->ExistenceDUneSolution, params)) @@ -318,8 +330,8 @@ MPSolver* ORTOOLS_Simplexe(Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* Probl // Save the final simplex basis for next resolutions if (warmStart && keepBasis) { - solver->GetFinalLpBasisInt(Probleme->StatutDesVariables, - Probleme->StatutDesContraintes); + transferBasis(Probleme->StatutDesVariables, solver->variables()); + transferBasis(Probleme->StatutDesContraintes, solver->constraints()); } } @@ -370,7 +382,8 @@ const std::map OrtoolsUtils::solv = {{"xpress", {"xpress_lp", "xpress"}}, {"sirius", {"sirius_lp", "sirius"}}, {"coin", {"clp", "cbc"}}, - {"glpk", {"glpk_lp", "glpk"}}}; + {"glpk", {"glpk_lp", "glpk"}}, + {"scip", {"scip", "scip"}}}; std::list getAvailableOrtoolsSolverName() { @@ -388,6 +401,19 @@ std::list getAvailableOrtoolsSolverName() return result; } +std::string availableOrToolsSolversString() +{ + const std::list availableSolverList = getAvailableOrtoolsSolverName(); + std::ostringstream solvers; + for (const std::string& avail: availableSolverList) + { + bool last = &avail == &availableSolverList.back(); + std::string sep = last ? "." : ", "; + solvers << avail << sep; + } + return solvers.str(); +} + MPSolver* MPSolverFactory(const Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* probleme, const std::string& solverName) { diff --git a/src/solver/utils/ortools_utils.h b/src/solver/utils/ortools_utils.h index e5d63fe765..e08a52f0ca 100644 --- a/src/solver/utils/ortools_utils.h +++ b/src/solver/utils/ortools_utils.h @@ -21,6 +21,13 @@ void ORTOOLS_EcrireJeuDeDonneesLineaireAuFormatMPS(MPSolver* solver, */ std::list getAvailableOrtoolsSolverName(); +/*! + * \brief Return a single string containing all solvers available, separated by a ", " and ending + * with a ".". + * + */ +std::string availableOrToolsSolversString(); + /*! * \brief Create a MPSolver with correct linear or mixed variant * diff --git a/src/solver/utils/ortools_wrapper.h b/src/solver/utils/ortools_wrapper.h index 2a776c9c18..0ee0923387 100644 --- a/src/solver/utils/ortools_wrapper.h +++ b/src/solver/utils/ortools_wrapper.h @@ -1,8 +1,7 @@ #ifndef __ORTOOLS_WRAPPER__ #define __ORTOOLS_WRAPPER__ -#include "named_problem.h" - +#include "include/antares/solver/utils/named_problem.h" using namespace operations_research; MPSolver* ORTOOLS_Simplexe(Antares::Optimization::PROBLEME_SIMPLEXE_NOMME* Probleme, diff --git a/src/solver/variable/economy/profitByPlant.h b/src/solver/variable/economy/profitByPlant.h index 265f8afc14..e977716f5a 100644 --- a/src/solver/variable/economy/profitByPlant.h +++ b/src/solver/variable/economy/profitByPlant.h @@ -303,9 +303,10 @@ class ProfitByPlant : public Variable::IVariable, NextT, VC auto* cluster = state.area->thermal.clusters[clusterIndex]; double hourlyClusterProduction = thermal[area->index].thermalClustersProductions[clusterIndex]; + // Thermal cluster profit pValuesForTheCurrentYear[numSpace][cluster->areaWideIndex].hour[hourInTheYear] - = (hourlyClusterProduction - cluster->PthetaInf[hourInTheYear]) + = std::max((hourlyClusterProduction - cluster->PthetaInf[hourInTheYear]), 0.) * (-areaMarginalCosts[hourInTheWeek] - cluster->marginalCost * cluster->modulation[Data::thermalModulationCost][hourInTheYear]); diff --git a/src/solver/writer/zip_writer.cpp b/src/solver/writer/zip_writer.cpp index d2f33364a6..b2bd427fb1 100644 --- a/src/solver/writer/zip_writer.cpp +++ b/src/solver/writer/zip_writer.cpp @@ -133,6 +133,9 @@ void ZipWriter::addEntryFromFile(const std::string& entryPath, const std::string case errReadFailed: logs.error() << "Read failed '" << filePath << "'"; break; + case errMemoryLimit: + logs.error() << "Size limit hit for file '" << filePath << "'"; + break; default: logs.error() << "Unhandled error"; break; diff --git a/src/tests/src/libs/antares/CMakeLists.txt b/src/tests/src/libs/antares/CMakeLists.txt index 26d8efb690..0f465cf76a 100644 --- a/src/tests/src/libs/antares/CMakeLists.txt +++ b/src/tests/src/libs/antares/CMakeLists.txt @@ -88,5 +88,4 @@ target_link_libraries(tests-matrix-load set_target_properties(tests-matrix-load PROPERTIES FOLDER Unit-tests) add_test(NAME load-matrix COMMAND tests-matrix-load) - set_property(TEST load-matrix PROPERTY LABELS unit) diff --git a/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp b/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp index 9268bab171..c9fd0f06b0 100644 --- a/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp +++ b/src/tests/src/libs/antares/study/scenario-builder/test-sc-builder-file-read-line.cpp @@ -385,5 +385,4 @@ BOOST_AUTO_TEST_CASE(on_link_area2_area3_and_on_year_19__ntc_TS_number_6_is_chos BOOST_CHECK(my_rule.apply()); BOOST_CHECK_EQUAL(link_23->timeseriesNumbers[0][yearNumber.to()], tsNumber.to() - 1); } - BOOST_AUTO_TEST_SUITE_END() diff --git a/src/tests/src/libs/antares/writer/CMakeLists.txt b/src/tests/src/libs/antares/writer/CMakeLists.txt new file mode 100644 index 0000000000..818e83f18d --- /dev/null +++ b/src/tests/src/libs/antares/writer/CMakeLists.txt @@ -0,0 +1,15 @@ +add_executable(test-writer) + +target_sources(test-writer PRIVATE test_zip_writer.cpp) + +target_link_libraries(test-writer + PRIVATE + Boost::unit_test_framework + Antares::result_writer + test_utils_unit + MINIZIP::minizip +) + +add_test(NAME writer COMMAND test-writer) + +set_tests_properties(writer PROPERTIES LABELS unit) diff --git a/src/tests/src/solver/optimisation/adequacy_patch.cpp b/src/tests/src/solver/optimisation/adequacy_patch.cpp index 6ae3c2867c..44a0935ab1 100644 --- a/src/tests/src/solver/optimisation/adequacy_patch.cpp +++ b/src/tests/src/solver/optimisation/adequacy_patch.cpp @@ -502,7 +502,6 @@ BOOST_AUTO_TEST_CASE(check_valid_adq_param) auto p = createParams(); BOOST_CHECK_NO_THROW(p.checkAdqPatchStudyModeEconomyOnly(Antares::Data::stdmEconomy)); BOOST_CHECK_NO_THROW(p.checkAdqPatchIncludeHurdleCost(true)); - BOOST_CHECK_NO_THROW(p.checkAdqPatchDisabledLocalMatching()); } BOOST_AUTO_TEST_CASE(check_adq_param_wrong_mode) @@ -517,10 +516,3 @@ BOOST_AUTO_TEST_CASE(check_adq_param_wrong_hurdle_cost) auto p = createParams(); BOOST_CHECK_THROW(p.checkAdqPatchIncludeHurdleCost(false), Error::IncompatibleHurdleCostCSR); } - -BOOST_AUTO_TEST_CASE(check_adq_param_wrong_lmr_disabled) -{ - auto p = createParams(); - p.localMatching.enabled = false; - BOOST_CHECK_THROW(p.checkAdqPatchDisabledLocalMatching(), Error::AdqPatchDisabledLMR); -} diff --git a/src/tools/batchrun/CMakeLists.txt b/src/tools/batchrun/CMakeLists.txt index a4ba01d80b..2457da817f 100644 --- a/src/tools/batchrun/CMakeLists.txt +++ b/src/tools/batchrun/CMakeLists.txt @@ -39,6 +39,7 @@ set(BATCHRUN_LIBS libantares-core libantares-core-calendar yuni-static-core + utils ${CMAKE_THREADS_LIBS_INIT} ) diff --git a/src/tools/batchrun/main.cpp b/src/tools/batchrun/main.cpp index 34635bfe07..f8f34f2abd 100644 --- a/src/tools/batchrun/main.cpp +++ b/src/tools/batchrun/main.cpp @@ -32,12 +32,15 @@ #include #include #include +#include #include #include #include #include "../../ui/common/winmain.hxx" #include #include +#include "../solver/utils/ortools_utils.h" + #ifdef YUNI_OS_WINDOWS #include #endif @@ -84,7 +87,8 @@ int main(int argc, char* argv[]) Antares::Resources::Initialize(argc, argv, true); // options - String optInput; + std::string optInput; + std::string ortoolsSolver; bool optNoTSImport = false; bool optIgnoreAllConstraints = false; bool optForceExpansion = false; @@ -95,6 +99,7 @@ int main(int argc, char* argv[]) bool optNoOutput = false; bool optParallel = false; bool optVerbose = false; + bool ortoolsUsed = false; Nullable optYears; Nullable optSolver; Nullable optName; @@ -143,6 +148,19 @@ int main(int argc, char* argv[]) ' ', "force-parallel", "Override the max number of years computed simultaneously"); + + // add option for ortools use + // --use-ortools + options.addFlag(ortoolsUsed, ' ', "use-ortools", "Use ortools library to launch solver"); + + //--ortools-solver + options.add(ortoolsSolver, + ' ', + "ortools-solver", + "Ortools solver used for simulation (only available with use-ortools " + "option)\nAvailable solver list : " + + availableOrToolsSolversString()); + options.remainingArguments(optInput); // Version options.addParagraph("\nMisc."); @@ -176,163 +194,179 @@ int main(int argc, char* argv[]) logs.error() << "contradictory options: --economy and --adequacy"; return EXIT_FAILURE; } - } - - // Source Folder - logs.debug() << "Folder : `" << optInput << '`'; - String solver; - if (optSolver.empty()) - { - Solver::FindLocation(solver); - if (solver.empty()) + if (ortoolsUsed) { - logs.fatal() << "The solver has not been found"; - return EXIT_FAILURE; - } - } - else - { - String tmp; - IO::MakeAbsolute(tmp, *optSolver); - IO::Normalize(solver, tmp); - if (not IO::File::Exists(solver)) - { - logs.fatal() << "The solver has not been found. specify --solver=" << solver; - return EXIT_FAILURE; + const auto availableSolvers = getAvailableOrtoolsSolverName(); + if (auto it + = std::find(availableSolvers.begin(), availableSolvers.end(), ortoolsSolver); + it == availableSolvers.end()) + { + logs.error() << "Please specify a solver using --ortools-solver. Available solvers " + << availableOrToolsSolversString() << ""; + return EXIT_FAILURE; + } } - } - logs.info() << " Solver: '" << solver << "'"; - logs.info(); - logs.info(); - logs.info() << "Searching for studies..."; - logs.info(); - MyStudyFinder finder; - finder.lookup(optInput); - finder.wait(); + // Source Folder + logs.debug() << "Folder : `" << optInput << '`'; - if (not finder.list.empty()) - { - if (finder.list.size() > 1) - logs.info() << "Found " << finder.list.size() << " studyies"; + String solver; + if (optSolver.empty()) + { + Solver::FindLocation(solver); + if (solver.empty()) + { + logs.fatal() << "The solver has not been found"; + return EXIT_FAILURE; + } + } else - logs.info() << "Found 1 study"; - logs.info() << "Starting..."; - - if (!(!optName)) { - String name; - name = *optName; - name.replace("\"", "\\\""); - *optName = name; + String tmp; + IO::MakeAbsolute(tmp, *optSolver); + IO::Normalize(solver, tmp); + if (not IO::File::Exists(solver)) + { + logs.fatal() << "The solver has not been found. specify --solver=" << solver; + return EXIT_FAILURE; + } } - // The folder that contains the solver - String dirname; - IO::ExtractFilePath(dirname, solver); + logs.info() << " Solver: '" << solver << "'"; + logs.info(); + logs.info(); + logs.info() << "Searching for studies..."; + logs.info(); + MyStudyFinder finder; + finder.lookup(optInput); + finder.wait(); - String cmd; - - uint studyIndx = 0; - foreach (auto& studypath, finder.list) + if (not finder.list.empty()) { - ++studyIndx; - - logs.info(); - if (optVerbose) - logs.info(); - - logs.checkpoint() << "Running simulation: `" << studypath << "` (" << studyIndx << '/' - << (uint)finder.list.size() << ')'; - if (optVerbose) - logs.debug(); - - cmd.clear(); - if (not System::windows) - cmd << "nice "; + if (finder.list.size() > 1) + logs.info() << "Found " << finder.list.size() << " studyies"; else - cmd << "call "; // why is it required for working ??? - cmd << "\"" << solver << "\""; - if (optForce) - cmd << " --force"; - if (optForceExpansion) - cmd << " --economy"; - if (optForceEconomy) - cmd << " --economy"; - if (optForceAdequacy) - cmd << " --adequacy"; + logs.info() << "Found 1 study"; + logs.info() << "Starting..."; + if (!(!optName)) - cmd << " --name=\"" << *optName << "\""; - if (!(!optYears)) - cmd << " --year=" << *optYears; - if (optNoOutput) - cmd << " --no-output"; - if (optYearByYear) - cmd << " --year-by-year"; - if (optNoTSImport) - cmd << " --no-ts-import"; - if (optIgnoreAllConstraints) - cmd << " --no-constraints"; - if (optParallel) - cmd << " --parallel"; - if (!(!optForceParallel)) - cmd << " --force-parallel=" << *optForceParallel; - cmd << " \"" << studypath << "\""; - if (!optVerbose) - cmd << sendToNull(); - - // Changing the current working directory - IO::Directory::Current::Set(dirname); - // Executing the converter - if (optVerbose) - logs.info() << "Executing " << cmd; + { + String name; + name = *optName; + name.replace("\"", "\\\""); + *optName = name; + } - // Execute the command - int cmd_return_code = system(cmd.c_str()); + // The folder that contains the solver + String dirname; + IO::ExtractFilePath(dirname, solver); - if (cmd_return_code != 0) - logs.error() << "An error occured."; - else - logs.info() << "Success."; + String cmd; - if (cmd_return_code == -1) + uint studyIndx = 0; + foreach (auto& studypath, finder.list) { -#ifdef YUNI_OS_WINDOWS - switch (errno) + ++studyIndx; + + logs.info(); + if (optVerbose) + logs.info(); + + logs.checkpoint() << "Running simulation: `" << studypath << "` (" << studyIndx + << '/' << (uint)finder.list.size() << ')'; + if (optVerbose) + logs.debug(); + + cmd.clear(); + if (not System::windows) + cmd << "nice "; + else + cmd << "call "; // why is it required for working ??? + cmd << "\"" << solver << "\""; + if (optForce) + cmd << " --force"; + if (optForceExpansion) + cmd << " --economy"; + if (optForceEconomy) + cmd << " --economy"; + if (optForceAdequacy) + cmd << " --adequacy"; + if (!(!optName)) + cmd << " --name=\"" << *optName << "\""; + if (!(!optYears)) + cmd << " --year=" << *optYears; + if (optNoOutput) + cmd << " --no-output"; + if (optYearByYear) + cmd << " --year-by-year"; + if (optNoTSImport) + cmd << " --no-ts-import"; + if (optIgnoreAllConstraints) + cmd << " --no-constraints"; + if (optParallel) + cmd << " --parallel"; + if (optForceParallel) + cmd << " --force-parallel=" << *optForceParallel; + if (ortoolsUsed) + cmd << " --use-ortools --ortools-solver=" << ortoolsSolver; + + cmd << " \"" << studypath << "\""; + if (!optVerbose) + cmd << sendToNull(); + + // Changing the current working directory + IO::Directory::Current::Set(dirname); + // Executing the converter + if (optVerbose) + logs.info() << "Executing " << cmd; + + // Execute the command + int cmd_return_code = system(cmd.c_str()); + + if (cmd_return_code != 0) + logs.error() << "An error occured."; + else + logs.info() << "Success."; + + if (cmd_return_code == -1) { - case E2BIG: - logs.error() << "Argument list (which is system dependent) is too big"; - break; - case ENOENT: - logs.error() << "Command interpreter cannot be found"; - break; - case ENOEXEC: - logs.error() - << "Command-interpreter file has invalid format and is not executable"; - break; - case ENOMEM: - logs.error() << "Not enough memory is available to execute command"; - break; - } +#ifdef YUNI_OS_WINDOWS + switch (errno) + { + case E2BIG: + logs.error() << "Argument list (which is system dependent) is too big"; + break; + case ENOENT: + logs.error() << "Command interpreter cannot be found"; + break; + case ENOEXEC: + logs.error() + << "Command-interpreter file has invalid format and is not executable"; + break; + case ENOMEM: + logs.error() << "Not enough memory is available to execute command"; + break; + } #endif + } } - } - logs.info() << "Done."; + logs.info() << "Done."; - // Time interval - if (optVerbose) + // Time interval + if (optVerbose) + { + logs.debug(); + logs.debug(); + } + } + else { - logs.debug(); - logs.debug(); + logs.fatal() << "No study has been found."; + return 4; } - } - else - { - logs.fatal() << "No study has been found."; - return 4; - } - return 0; + return 0; + } } diff --git a/src/ui/common/component/spotlight/listbox-panel.cpp b/src/ui/common/component/spotlight/listbox-panel.cpp index 969d9672a3..fa1a958839 100644 --- a/src/ui/common/component/spotlight/listbox-panel.cpp +++ b/src/ui/common/component/spotlight/listbox-panel.cpp @@ -222,7 +222,7 @@ void ListboxPanel::onDraw(wxPaintEvent&) { auto& item = *(items[i]); auto& group = item.group(); - if (!(!group) && group != pLastGroupName) + if (!(!group) && YString(group) != pLastGroupName) pLastGroupName = group; } continue; @@ -234,7 +234,7 @@ void ListboxPanel::onDraw(wxPaintEvent&) // Draw of the group name if the flag is enabled if ((0 != (pFlags & Spotlight::optGroups))) { - if (!(!group) && group != pLastGroupName) + if (!(!group) && YString(group) != pLastGroupName) { // Drawing the new group bounds.x = 0; diff --git a/src/ui/simulator/application/main/main.cpp b/src/ui/simulator/application/main/main.cpp index d61c92a350..f066b05ec8 100644 --- a/src/ui/simulator/application/main/main.cpp +++ b/src/ui/simulator/application/main/main.cpp @@ -807,7 +807,7 @@ void ApplWnd::title(const wxString& s) wxString t; if (StudyHasBeenModified()) t << wxT("* "); - t << (s.IsEmpty() ? wxT("") : s) << wxT(" - Antares Simulator") + t << (s.IsEmpty() ? wxString(wxT("")) : s) << wxT(" - Antares Simulator") #ifndef NDEBUG << wxT(" - DEVELOPER PREVIEW") #endif diff --git a/src/ui/simulator/toolbox/components/datagrid/renderer/area/renewable.areasummary.cpp b/src/ui/simulator/toolbox/components/datagrid/renderer/area/renewable.areasummary.cpp index 59ff293c0c..3bbe42393c 100644 --- a/src/ui/simulator/toolbox/components/datagrid/renderer/area/renewable.areasummary.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/renderer/area/renewable.areasummary.cpp @@ -121,7 +121,9 @@ bool RenewableClusterSummarySingleArea::cellValue(int x, int y, const String& v) { case 0: { - if (cluster->group() != v) + std::string group = cluster->group().c_str(); + std::string v_string; + if (group != v_string) { cluster->setGroup(v); return true; diff --git a/src/ui/simulator/toolbox/components/datagrid/renderer/area/thermal.areasummary.cpp b/src/ui/simulator/toolbox/components/datagrid/renderer/area/thermal.areasummary.cpp index c49cf595a0..85b77e19e3 100644 --- a/src/ui/simulator/toolbox/components/datagrid/renderer/area/thermal.areasummary.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/renderer/area/thermal.areasummary.cpp @@ -177,7 +177,9 @@ bool ThermalClusterSummarySingleArea::cellValue(int x, int y, const String& v) { case 0: { - if (cluster->group() != v) + std::string group = cluster->group().c_str(); + std::string v_string; + if (group != v_string) { cluster->setGroup(v); return true; diff --git a/src/ui/simulator/toolbox/components/datagrid/renderer/layers.cpp b/src/ui/simulator/toolbox/components/datagrid/renderer/layers.cpp index e5d30d6164..2072c2cb73 100644 --- a/src/ui/simulator/toolbox/components/datagrid/renderer/layers.cpp +++ b/src/ui/simulator/toolbox/components/datagrid/renderer/layers.cpp @@ -227,13 +227,13 @@ wxString LayersUI::cellValue(int x, int y) const return layerPosition != layerListEnd ? wxString::Format(wxT("%d"), pArea->ui->layerX[layerIterator->first]) - : wxT("-"); + : wxString(wxT("-")); case 2: return layerPosition != layerListEnd ? wxString::Format(wxT("%d"), pArea->ui->layerY[layerIterator->first]) - : wxT("-"); + : wxString(wxT("-")); } } return wxEmptyString; diff --git a/src/ui/simulator/windows/bindingconstraint/edit.cpp b/src/ui/simulator/windows/bindingconstraint/edit.cpp index a974506ef0..c04acc751a 100644 --- a/src/ui/simulator/windows/bindingconstraint/edit.cpp +++ b/src/ui/simulator/windows/bindingconstraint/edit.cpp @@ -272,7 +272,7 @@ void BindingConstraintInfoEditor::onSave(void*) if (pConstraint) { - if (not newname.empty() and pConstraint->name() != newname) + if (not newname.empty() and pConstraint->name() != Data::ConstraintName(newname)) { if (not study.bindingConstraints.rename(pConstraint, newname)) { diff --git a/src/ui/simulator/windows/correlation/datasources.hxx b/src/ui/simulator/windows/correlation/datasources.hxx index 070a5573ad..1e0d15d4a7 100644 --- a/src/ui/simulator/windows/correlation/datasources.hxx +++ b/src/ui/simulator/windows/correlation/datasources.hxx @@ -182,7 +182,7 @@ public: { int lastLevel = 0; int j = 0; - Yuni::CString<15, false> old; + Yuni::CString<12, false> old; wxColour color; wxColour colorIdentity; const Data::Area::Vector::const_iterator end = pArray.end(); diff --git a/src/ui/simulator/windows/hydro/dailypower.cpp b/src/ui/simulator/windows/hydro/dailypower.cpp index 8a99499e05..61b2fb8297 100644 --- a/src/ui/simulator/windows/hydro/dailypower.cpp +++ b/src/ui/simulator/windows/hydro/dailypower.cpp @@ -73,14 +73,6 @@ void Dailypower::createComponents() wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); pSupport->SetSizer(sizer); - const wxSize ourDefaultSize(55, wxDefaultSize.GetHeight()); - - enum - { - right = wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, - left = wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, - }; - wxBoxSizer* sizerHigh = new wxBoxSizer(wxHORIZONTAL); sizer->Add(sizerHigh, 2, wxALL | wxEXPAND | wxFIXED_MINSIZE); diff --git a/src/ui/simulator/windows/hydro/management.cpp b/src/ui/simulator/windows/hydro/management.cpp index c76bfc6d05..666fd9b01d 100644 --- a/src/ui/simulator/windows/hydro/management.cpp +++ b/src/ui/simulator/windows/hydro/management.cpp @@ -26,15 +26,14 @@ */ #include "management.h" -#include +#include +#include + #include "../../toolbox/components/datagrid/renderer/area/hydroprepro.h" #include "../../toolbox/components/datagrid/renderer/area/inflowpattern.h" -#include "../../toolbox/components/datagrid/renderer/area/hydromonthlypower.h" -#include "../../toolbox/components/button.h" #include "../../toolbox/validator.h" #include "../../toolbox/create.h" #include "../../application/menus.h" -#include using namespace Yuni; @@ -69,11 +68,8 @@ void Management::createComponents() const wxSize ourDefaultSize(55, wxDefaultSize.GetHeight()); - enum - { - right = wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, - left = wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, - }; + const auto right = (wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + const auto left = (wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); auto* pGrid = new wxFlexGridSizer(6, 0, 8); sizer->Add(pGrid, 0, wxALL, 15); diff --git a/vcpkg b/vcpkg index 15a0ab7a3e..e3ad383ceb 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 15a0ab7a3e62e62c29bc677589e8974fe401a436 +Subproject commit e3ad383ceb886677eb181e16adeeb4d4a2c2d4c4