cptp¶
Capacitated profitable tour problem
cptp solves the Capacitated Profitable Tour Problem, its s–t path variant and instances with several capacity rows by branch-and-cut on HiGHS, following Jepsen et al. (2014). It is a C++ library with a command-line solver and Python bindings, and accompanies the preprint arXiv:2607.04497.
The optimal tour of E-n76-k7_a (Roberti Set 3) from the depot (the square):
of 75 customers, sized by profit, it visits the 11 worth their travel cost
within the vehicle’s capacity.¶
The optimal tour of E-n76-k7_a (Roberti Set 3) from the depot (the square):
of 75 customers, sized by profit, it visits the 11 worth their travel cost
within the vehicle’s capacity.¶
Problem¶
Choose which customers to visit, and in what order, to minimise travel cost minus collected profit within the vehicle’s capacity; the tour starts and ends at depot 0.
x_e: edgeeused (a depot edge twice: out to one customer and back);y_i: nodeivisited.c_e: edge cost;p_i: node profit;d^k_i: demand ofion capacity rowk;Q_k: its capacity;δ(S): the edges with one end inS.The classical CPTP has m = 1. The s–t path variant gives source and target degree 1 and uses no edge twice.
Method¶
Formulation. The model above goes to HiGHS without its connectivity constraints, which are separated as cuts.
Cuts in HiGHS’s callbacks, as in Jepsen et al.: subtour elimination (Gomory–Hu trees), comb, and per capacity row rounded capacity, multistar/GLM and rounded GLM. Also shortest-path inequalities after García (2009), with our own Held–Karp bound. Comb, rounded GLM and shortest-path inequalities are off by default.
Bounds. A capacity-aware labeling bounds paths from the source and to the target; edges and nodes that cannot beat the incumbent are eliminated.
Propagation in the tree: sweep, chain and reduced-cost fixing.
Primal heuristics: construction and iterated local search before the solve, and an LP-guided search on reduced graphs in the tree.
Hyperplane branching (optional): integer columns z = a·y that HiGHS branches on.
Details, and the capacity rows each step uses: Method.
Results¶
m |
Branch-and-cut, 1 thread |
Branch-and-cut, 8 threads |
PathWyse |
PathWyse |
|---|---|---|---|---|
1 |
9, 27.0 s |
9, 17.0 s |
9, 4.4 s |
9, 3.0 s |
2 |
9, 25.9 s |
10, 18.4 s |
9, 8.6 s |
10, 6.4 s |
5 |
9, 28.4 s |
10, 20.8 s |
9, 18.0 s |
8, 29.1 s |
10 |
9, 28.7 s |
9, 20.3 s |
7, 38.6 s |
5, 56.5 s |
Setup: instances solved of 10 (SPPRCLIB and Roberti Set 3 bases with m capacity rows) within 600 s, and the shifted geometric mean time (shift 1 s); AMD Ryzen 9 3950X; the labeling solver PathWyse 1.1.0 on two threads.
Claim: the branch-and-cut’s time hardly moves with m; labeling, faster at m = 1 and 2, slows down with each row and is behind at m = 10.
Caveat: v0.1.0, v0.2.0 and the preprint’s first version may report a suboptimal tour or s–t path as optimal (known issues).
Usage¶
pip install git+https://github.com/spoorendonk/cptp # Python package and cptp command
Command line¶
In a clone, with ./build/cptp-solve built as in the quick reference:
$ ./build/cptp-solve tests/data/tiny4.txt --time_limit 30 --output_flag false
Instance: tiny4 (4 nodes, 6 edges, tour from depot 0)
Tour: 0 -> 1 -> 2 -> 0
Objective: -11 Bound: -11 Gap: 0% Time: <seconds>s Nodes: 1
...
$ ./build/cptp-solve tests/data/tiny4.txt --source 0 --target 3 --output_flag false
...
Path: 0 -> 1 -> 3
Objective: -13 Bound: -13 Gap: 0% Time: <seconds>s Nodes: 1
--source and --target turn a tour into an s–t path.
Python¶
import numpy as np
import cptp
# 4 nodes, depot 0, undirected edges
edges = np.array([[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3]])
costs = np.array([10.0, 8.0, 12.0, 6.0, 7.0, 5.0])
profits = np.array([0.0, 20.0, 15.0, 10.0])
demands = np.array([0.0, 3.0, 4.0, 2.0])
result = cptp.solve(4, edges, costs, profits, demands, capacity=7.0)
print(result.objective, result.tour.tolist()) # -11.0 [0, 1, 2, 0]
More: quick reference (builds, instance formats), options, C++ reference; working on cptp: DEVELOPMENT.md.
Citing¶
Cite the paper for the method and the archived release for the code:
@misc{spoorendonk2026cptp,
title = {An open, reproducible branch-and-cut for the capacitated profitable tour problem: a component study},
author = {Spoorendonk, Simon},
year = {2026},
eprint = {2607.04497},
archivePrefix= {arXiv},
primaryClass = {math.OC},
url = {https://arxiv.org/abs/2607.04497}
}
@software{spoorendonk2026cptpsoftware,
title = {cptp: a branch-and-cut solver for the Capacitated Profitable Tour Problem},
author = {Spoorendonk, Simon},
year = {2026},
version = {0.3.0},
doi = {10.5281/zenodo.20844234},
url = {https://doi.org/10.5281/zenodo.20844234}
}
The concept DOI resolves to the latest release; its Zenodo page lists each version’s own DOI.
GitHub’s Cite this repository reads
CITATION.cff.
License¶
MIT. See LICENSE.