Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ jobs:
run: |
uv run pytest
uv run ninja coverage-xml -C build
- uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
plugins: pycoverage
files: build/meson-logs/coverage.xml
- if: matrix.compiler == 'gcc'
name: Install Valgrind
run: |
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/CodSpeed.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: CodSpeed

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
[![PyPI version](https://img.shields.io/pypi/v/PyVRP?style=flat-square&label=PyPI)](https://pypi.org/project/pyvrp/)
[![CI](https://img.shields.io/github/actions/workflow/status/PyVRP/PyVRP/.github%2Fworkflows%2FCI.yml?branch=main&style=flat-square&logo=github&label=CI)](https://github.com/PyVRP/PyVRP/actions/workflows/CI.yml)
[![DOC](https://img.shields.io/github/actions/workflow/status/PyVRP/PyVRP/.github%2Fworkflows%2FDOC.yml?branch=main&style=flat-square&logo=github&label=DOC)](https://pyvrp.org/)
[![codecov](https://img.shields.io/codecov/c/github/PyVRP/PyVRP?style=flat-square&logo=codecov&label=Codecov)](https://codecov.io/gh/PyVRP/PyVRP)
[![DOI:10.1287/ijoc.2023.0055](https://img.shields.io/badge/DOI-ijoc.2023.0055-green?style=flat-square&color=blue)](https://doi.org/10.1287/ijoc.2023.0055)

> [!NOTE]
> This is a special fork of PyVRP v0.13.3 for the [SMIO-Hexaly Location Routing Challenge 2026][10].
> See that repository's README for more details about the challenge and problem setting.
> This fork extends PyVRP with depot capacities and fixed depot opening costs, so solutions are charged for opening a depot (i.e., there is at least one route that starts at this depot) and penalised when the total load assigned to a depot exceeds its capacity.

PyVRP is an open-source, state-of-the-art vehicle routing problem (VRP) solver developed by [RoutingLab](https://routinglab.tech).
It currently supports VRPs with:
- Pickups and deliveries between depots and clients (capacitated VRP, VRP with simultaneous pickup and delivery, VRP with backhaul);
Expand Down Expand Up @@ -100,3 +104,5 @@ A preprint of this paper is available on [arXiv][9].
[8]: https://pyvrp.org/examples/using_pyvrp_components.html

[9]: https://arxiv.org/abs/2403.13795

[10]: https://github.com/AppliedRouting/Location-Routing-Challenge
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ requires-python = ">=3.11"
dependencies = [
"numpy>=1.15.2; python_version < '3.12'",
"numpy>=1.26.0; python_version >= '3.12'",
"matplotlib>=2.2.0",
"matplotlib>=2.2.0,<3.11.0",
"vrplib>=1.4.0",
"tqdm>=4.64.1",
]
Expand Down Expand Up @@ -65,7 +65,6 @@ dev = [
"pytest-codspeed>=2.2.1",
"pytest-xdist>=3.6.1",
"pytest-sugar>=1.0.0",
"codecov",
]

docs = [
Expand Down
4 changes: 4 additions & 0 deletions pyvrp/Model.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ def add_depot(
tw_early: int = 0,
tw_late: int = np.iinfo(np.int64).max,
service_duration: int = 0,
capacity: int | list[int] = [],
fixed_cost: int = 0,
*,
name: str = "",
) -> Depot:
Expand All @@ -297,6 +299,8 @@ def add_depot(
tw_early=tw_early,
tw_late=tw_late,
service_duration=service_duration,
capacity=[capacity] if isinstance(capacity, int) else capacity,
fixed_cost=fixed_cost,
name=name,
)

Expand Down
5 changes: 5 additions & 0 deletions pyvrp/_pyvrp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ class Depot:
tw_early: int
tw_late: int
service_duration: int
capacity: list[int]
fixed_cost: int
name: str
def __init__(
self,
Expand All @@ -102,6 +104,8 @@ class Depot:
tw_early: int = 0,
tw_late: int = ...,
service_duration: int = 0,
capacity: list[int] = [],
fixed_cost: int = 0,
*,
name: str = "",
) -> None: ...
Expand Down Expand Up @@ -345,6 +349,7 @@ class Solution:
def excess_load(self) -> list[int]: ...
def excess_distance(self) -> int: ...
def fixed_vehicle_cost(self) -> int: ...
def fixed_depot_cost(self) -> int: ...
def time_warp(self) -> int: ...
def prizes(self) -> int: ...
def uncollected_prizes(self) -> int: ...
Expand Down
9 changes: 9 additions & 0 deletions pyvrp/cpp/CostEvaluator.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include "CostEvaluator.h"

#include <stdexcept>
#include <utility>

using pyvrp::CostEvaluator;
using pyvrp::DepotContext;

CostEvaluator::CostEvaluator(std::vector<double> loadPenalties,
double twPenalty,
Expand All @@ -21,3 +23,10 @@ CostEvaluator::CostEvaluator(std::vector<double> loadPenalties,
if (distPenalty_ < 0)
throw std::invalid_argument("dist_penalty must be >= 0.");
}

CostEvaluator CostEvaluator::withDepotContext(DepotContext context) const
{
auto copy = *this;
copy.depotCtx_ = context;
return copy;
}
Loading
Loading