Skip to content

Commit

Permalink
Merge branch 'VROOM-Project:master' into refactor/use-format
Browse files Browse the repository at this point in the history
  • Loading branch information
SebMilardo authored May 22, 2024
2 parents 763cee9 + f853330 commit 9e19715
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 59 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/vroom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 15 additions & 10 deletions .github/workflows/vroom_libosrm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 0 additions & 38 deletions src/structures/generic/matrix.cpp

This file was deleted.

23 changes: 17 additions & 6 deletions src/structures/generic/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All rights reserved (see LICENSE).
*/

#include <initializer_list>
#include <vector>

#include "structures/typedefs.h"

Expand All @@ -22,13 +22,24 @@ template <class T> class Matrix {
std::vector<T> 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<T> get_sub_matrix(const std::vector<Index>& indices) const;
Matrix<T> get_sub_matrix(const std::vector<Index>& indices) const {
Matrix<T> 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);
Expand All @@ -44,7 +55,7 @@ template <class T> class Matrix {
#if USE_PYTHON_BINDINGS
T* get_data() {
return data.data();
};
}
#endif
};

Expand Down
2 changes: 1 addition & 1 deletion src/structures/vroom/tw_route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ bool TWRoute::is_valid_addition_for_tw(const Input& input,
return current.earliest + next.travel <= next.latest;
}

template <std::forward_iterator Iter>
template <std::random_access_iterator Iter>
void TWRoute::replace(const Input& input,
const Amount& delivery,
const Iter first_job,
Expand Down
2 changes: 1 addition & 1 deletion src/structures/vroom/tw_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <std::forward_iterator Iter>
template <std::random_access_iterator Iter>
void replace(const Input& input,
const Amount& delivery,
const Iter first_job,
Expand Down

0 comments on commit 9e19715

Please sign in to comment.