diff --git a/.github/workflows/vroom.yml b/.github/workflows/vroom.yml index 9320407f1..1e53625bb 100644 --- a/.github/workflows/vroom.yml +++ b/.github/workflows/vroom.yml @@ -16,11 +16,11 @@ jobs: vroom: strategy: matrix: - cxx: ['g++-12', 'clang++-15'] - runs-on: ubuntu-22.04 + cxx: [g++-14, clang++-18] + runs-on: ubuntu-24.04 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true - name: Install dependencies diff --git a/.github/workflows/vroom_libosrm.yml b/.github/workflows/vroom_libosrm.yml index 2f735068d..0789fcc71 100644 --- a/.github/workflows/vroom_libosrm.yml +++ b/.github/workflows/vroom_libosrm.yml @@ -14,16 +14,21 @@ on: - '.github/workflows/vroom_libosrm.yml' - '**libosrm_wrapper**' env: - osrm-tag: v5.27.1 + osrm-ref: d259848456c8c84df0422f7389ef034e63e6462d jobs: libosrm: strategy: matrix: - cxx: ['g++-12', 'clang++-15'] - runs-on: ubuntu-22.04 + cxx: [g++-13, clang++-17] + include: + - cxx: g++-13 + cc: gcc-13 + - cxx: clang++-17 + cc: clang-17 + runs-on: ubuntu-24.04 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true - name: Install dependencies @@ -32,16 +37,16 @@ jobs: sudo apt-get install libasio-dev libglpk-dev - name: Cache OSRM id: cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ github.workspace }}/osrm-backend - key: osrm-${{ env.osrm-tag }}-${{ matrix.cxx }} + key: osrm-${{ env.osrm-ref }}-${{ matrix.cxx }} - name: Checkout OSRM repository if: steps.cache.outputs.cache-hit != 'true' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: Project-OSRM/osrm-backend - ref: ${{ env.osrm-tag }} + ref: ${{ env.osrm-ref }} path: osrm-backend - name: Install OSRM dependencies run: sudo apt-get install build-essential git cmake pkg-config libbz2-dev libstxxl-dev libstxxl1v5 libxml2-dev libzip-dev libboost-all-dev lua5.2 liblua5.2-dev libtbb-dev libluabind-dev libluabind0.9.1d1 @@ -51,8 +56,8 @@ jobs: run: | mkdir build cd build - cmake .. -DCMAKE_BUILD_TYPE=Release - cmake --build . + cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wno-array-bounds" -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DCMAKE_C_COMPILER=${{ matrix.cc }} + cmake --build . -j `nproc` working-directory: osrm-backend - name: Install OSRM run: sudo cmake --build . --target install diff --git a/CHANGELOG.md b/CHANGELOG.md index ceedfb155..43755049f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,28 @@ ### Changed +#### Internals + +- Refactor `Matrix` template class (#1089) + +#### CI + +- Update GitHub Actions (#1094) +- Speed up OSRM build (#1096) +- Update Ubuntu image to 24.04 (#1080) +- `vroom` workflow uses g++-14 and clang++-18 (#1080) +- `vroom + libosrm` workflow uses g++-13 and clang++-17 (#1080) + ### Fixed +#### Internals + +- Iterator type required by `TWRoute::replace` function (#1103) + +#### CI + +- Wrong compiler used for clang-based OSRM builds (#1098) + ## [v1.14.0] - 2024-01-16 ### Added diff --git a/src/structures/generic/matrix.cpp b/src/structures/generic/matrix.cpp deleted file mode 100644 index 5b1f21ce0..000000000 --- a/src/structures/generic/matrix.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - -This file is part of VROOM. - -Copyright (c) 2015-2024, Julien Coupey. -All rights reserved (see LICENSE). - -*/ - -#include "structures/generic/matrix.h" - -namespace vroom { - -template Matrix::Matrix(std::size_t n) : n(n) { - data.resize(n * n); -} - -template -Matrix::Matrix(std::size_t n, T value) : n(n), data(n * n, value) { -} - -template Matrix::Matrix() : Matrix(0) { -} - -template -Matrix Matrix::get_sub_matrix(const std::vector& indices) const { - Matrix sub_matrix(indices.size()); - for (std::size_t i = 0; i < indices.size(); ++i) { - for (std::size_t j = 0; j < indices.size(); ++j) { - sub_matrix[i][j] = (*this)[indices[i]][indices[j]]; - } - } - return sub_matrix; -} - -template class Matrix; - -} // namespace vroom diff --git a/src/structures/generic/matrix.h b/src/structures/generic/matrix.h index 196907942..488024c5f 100644 --- a/src/structures/generic/matrix.h +++ b/src/structures/generic/matrix.h @@ -10,7 +10,7 @@ All rights reserved (see LICENSE). */ -#include +#include #include "structures/typedefs.h" @@ -22,13 +22,24 @@ template class Matrix { std::vector data; public: - Matrix(); + Matrix() : Matrix(0) { + } - explicit Matrix(std::size_t n); + explicit Matrix(std::size_t n) : Matrix(n, 0) { + } - Matrix(std::size_t n, T value); + Matrix(std::size_t n, T value) : n(n), data(n * n, value) { + } - Matrix get_sub_matrix(const std::vector& indices) const; + Matrix get_sub_matrix(const std::vector& indices) const { + Matrix sub_matrix(indices.size()); + for (std::size_t i = 0; i < indices.size(); ++i) { + for (std::size_t j = 0; j < indices.size(); ++j) { + sub_matrix[i][j] = (*this)[indices[i]][indices[j]]; + } + } + return sub_matrix; + } T* operator[](std::size_t i) { return data.data() + (i * n); @@ -44,7 +55,7 @@ template class Matrix { #if USE_PYTHON_BINDINGS T* get_data() { return data.data(); - }; + } #endif }; diff --git a/src/structures/vroom/tw_route.cpp b/src/structures/vroom/tw_route.cpp index ee65160f9..6cd15a276 100644 --- a/src/structures/vroom/tw_route.cpp +++ b/src/structures/vroom/tw_route.cpp @@ -1004,7 +1004,7 @@ bool TWRoute::is_valid_addition_for_tw(const Input& input, return current.earliest + next.travel <= next.latest; } -template +template void TWRoute::replace(const Input& input, const Amount& delivery, const Iter first_job, diff --git a/src/structures/vroom/tw_route.h b/src/structures/vroom/tw_route.h index 2e57571eb..234bc63e2 100644 --- a/src/structures/vroom/tw_route.h +++ b/src/structures/vroom/tw_route.h @@ -217,7 +217,7 @@ class TWRoute : public RawRoute { // first_rank and before last_rank *in place of* the current jobs // that may be there. "delivery" is the amount delivered in single // jobs for inclusion range. - template + template void replace(const Input& input, const Amount& delivery, const Iter first_job,