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..7a29b6c5b3 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -48,7 +48,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 +65,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 62c9fd2534..b89e2788b6 100644 --- a/.github/workflows/oracle8.yml +++ b/.github/workflows/oracle8.yml @@ -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 60f1a716cf..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,61 +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 - - - name: Installer .deb creation - run: | - cd _build - cpack -G DEB - - - name: .tar.gz creation - run: | - cd _build - cpack -G TGZ - - - name: Solver archive creation - run: | - cd _build - cmake --install . --prefix install - pushd . - cd install/bin - tar czf ../../antares-solver_ubuntu20.04.tar.gz antares-*-solver libsirius_solver.so - popd - rm -rf install - - - name: Installer archive upload push - uses: actions/upload-artifact@v3 - with: - path: _build/*.tar.gz - - - name: Installer deb upload push - uses: actions/upload-artifact@v3 - with: - path: _build/*.deb - - publish_assets: - name: Publish assets - needs: build - runs-on: ${{needs.build.outputs.os}} - steps: - - name: Download all artifacts - if: ${{ env.IS_RELEASE == 'true' }} - uses: actions/download-artifact@v3 - - - - name: Publish assets - if: ${{ env.IS_RELEASE == 'true' }} - uses: alexellis/upload-assets@0.4.0 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - asset_paths: '["*/*.tar.gz", "*/*.deb"]' - # simtest - name: Read simtest version id: simtest-version @@ -245,3 +190,57 @@ 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 + cpack -G DEB + + - name: .tar.gz creation + run: | + cd _build + cpack -G TGZ + + - name: Solver archive creation + run: | + cd _build + cmake --install . --prefix install + pushd . + cd install/bin + tar czf ../../antares-solver_ubuntu20.04.tar.gz antares-*-solver libsirius_solver.so + popd + rm -rf install + + - name: Installer archive upload push + uses: actions/upload-artifact@v3 + with: + path: _build/*.tar.gz + + - name: Installer deb upload push + uses: actions/upload-artifact@v3 + with: + path: _build/*.deb + + publish_assets: + name: Publish assets + needs: build + runs-on: ${{needs.build.outputs.os}} + steps: + - name: Download all artifacts + if: ${{ env.IS_RELEASE == 'true' }} + uses: actions/download-artifact@v3 + + + - name: Publish assets + if: ${{ env.IS_RELEASE == 'true' }} + uses: alexellis/upload-assets@0.4.0 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + asset_paths: '["*/*.tar.gz", "*/*.deb"]' diff --git a/.github/workflows/windows-release.yml b/.github/workflows/windows-release.yml index 8fe5251942..0bcff13b52 100644 --- a/.github/workflows/windows-release.yml +++ b/.github/workflows/windows-release.yml @@ -20,11 +20,15 @@ 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: | @@ -96,7 +100,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 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/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..ac29e63391 100644 --- a/simtest.json +++ b/simtest.json @@ -1,3 +1,3 @@ { - "version": "v8.6.0c" + "version": "v8.6.4" } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cce87eb308..da9c639cc6 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 4) -set(ANTARES_VERSION_YEAR 2023) +set(ANTARES_VERSION_REVISION 5) +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/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/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/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..7503fe3d5c 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() { 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/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);