From 84e20b6ddd9066d541765b814f1a9d15edf27e56 Mon Sep 17 00:00:00 2001 From: Mikael Zayenz Lagerkvist Date: Fri, 30 Oct 2026 09:57:28 +0100 Subject: [PATCH] Use a table for TSPTW travel times The matrix element posted one index over all n*n customer pairs per position, and its propagator rebuilds its support lists in every clone. A* and CABS clone and propagate every child near the root, so this dominated their runtime. Use one shared TupleSet over (x[i-1], x[i], c[i]) instead, and note the per-node cost and unkeyed dominance in the heuristic guidance documentation. --- examples/tsptw.cpp | 9 ++++++++- gecode/search.hh | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/examples/tsptw.cpp b/examples/tsptw.cpp index 88391c3154..1692ab28ec 100644 --- a/examples/tsptw.cpp +++ b/examples/tsptw.cpp @@ -178,8 +178,15 @@ class TSPTW : public IntMinimizeScript { rel(*this, pos[j-1] < pos[k-1]); element(*this, from, x[0], c[0]); rel(*this, t[0] == max(element(ready,x[0]), c[0])); + // Travel time between consecutive customers + TupleSet legs(3); + for (int j=1; j