-
Notifications
You must be signed in to change notification settings - Fork 3
Description
name: Problem
about: Propose a new problem type
title: "[Model] RuralPostman"
labels: model
assignees: ''
Motivation
RURAL POSTMAN (P103) from Garey & Johnson, A2 ND27. A fundamental NP-complete arc-routing problem that generalizes the Chinese Postman Problem (polynomial when all edges are required) and is closely related to the Traveling Salesman Problem. It models the practical scenario of a delivery agent who must traverse a specified subset of roads in a network while minimizing total travel distance. The problem is a target of the following reduction:
- R48: HAMILTONIAN CIRCUIT → RURAL POSTMAN (ND27, Lenstra and Rinnooy Kan, 1976)
Definition
Name: RuralPostman
Canonical name: RURAL POSTMAN (also: Rural Postman Problem, RPP)
Reference: Garey & Johnson, Computers and Intractability, A2 ND27
Mathematical definition:
INSTANCE: Graph G = (V,E), length l(e) ∈ ℤ⁺₀ (non-negative integers) for each e ∈ E, subset E' ⊆ E, bound B ∈ ℤ⁺ (positive integer).
QUESTION: Is there a circuit in G that includes each edge in E' and that has total length no more than B?
Variables
- Count: |E| variables (one per edge in E), encoding the traversal count for each edge.
- Per-variable domain: For required edges (e ∈ E'): {1, 2, ..., K} where K is an upper bound on traversal count. For non-required edges (e ∈ E \ E'): {0, 1, ..., K}. In practice, K can be bounded by 2|E| since no optimal circuit needs to traverse any edge more than 2|E| times.
- Meaning: Variable x_e represents the number of times edge e is traversed in the circuit. A valid assignment satisfies: (1) x_e ≥ 1 for all e ∈ E', (2) the edges with x_e > 0 form a connected Eulerian multigraph (every vertex has even degree), and (3) the total cost Σ_e x_e · l(e) ≤ B.
Schema (data type)
Type name: RuralPostman
Variants: graph topology (graph type parameter G), weight type parameter W
| Field | Type | Description |
|---|---|---|
graph |
G |
The undirected graph G = (V, E) |
edge_lengths |
Vec<W> |
Length l(e) for each edge e ∈ E (indexed by edge index, non-negative) |
required_edges |
Vec<usize> |
Edge indices of the subset E' ⊆ E of required edges |
bound |
i32 |
Upper bound B on total circuit length |
Getter methods: num_vertices(), num_edges(), num_required_edges() (used in declare_variants! complexity strings and #[reduction(overhead)] expressions).
Notes:
- This is a satisfaction (decision) problem:
Metric = bool, implementingSatisfactionProblem. - When E' = E, the problem reduces to the Chinese Postman Problem (polynomial-time solvable via T-join / matching).
- When E' = ∅ and required vertices are specified instead, the problem reduces to the Traveling Salesman Problem.
- Remains NP-complete with unit edge lengths (l(e) = 1 for all e).
- The directed variant is also NP-complete (GJ comment).
Complexity
- Best known exact algorithm: Dynamic programming over subsets of required edges: O(n² · 2^r) where n = |V| is the number of vertices and r = |E'| is the number of required edges. This is an adaptation of the Held-Karp algorithm (Held and Karp, 1962) to the required-edge setting: the DP state tracks (current vertex, subset of required edges covered so far), with transitions via precomputed all-pairs shortest paths between required-edge endpoints (computed in O(n³) via Floyd-Warshall). The DP iterates over 2^r subsets with O(n) transitions per state. When r = |E| (Chinese Postman), the problem is polynomial. For general r, the problem is strongly NP-hard.
declare_variants!complexity string:"num_vertices ^ 2 * 2 ^ num_required_edges"(Held-Karp adaptation)- NP-completeness: NP-complete (Lenstra and Rinnooy Kan, 1976; originally in "On general routing problems").
- Approximation: The RPP admits a 3/2-approximation using a Christofides-type heuristic for metric instances (Frederickson, 1979).
- References:
- M. Held and R. M. Karp (1962). "A dynamic programming approach to sequencing problems." Journal of SIAM 10(1):196–210.
- J. K. Lenstra and A. H. G. Rinnooy Kan (1976). "On general routing problems." Networks 6:273–280.
- G. N. Frederickson (1979). "Approximation algorithms for some postman problems." Journal of the ACM 26(3):538–554.
- A. Corberán and G. Laporte (eds.) (2015). Arc Routing: Problems, Methods, and Applications. SIAM MOS-SIAM Series on Optimization.
Extra Remark
Full book text:
INSTANCE: Graph G = (V,E), length l(e) ∈ Z_0^+ (non-negative integers) for each e ∈ E, subset E' ⊆ E, bound B ∈ Z^+ (positive integer).
QUESTION: Is there a circuit in G that includes each edge in E' and that has total length no more than B?
Reference: [Lenstra and Rinnooy Kan, 1976]. Transformation from HAMILTONIAN CIRCUIT.
Comment: Remains NP-complete even if l(e) = 1 for all e ∈ E, as does the corresponding problem for directed graphs.
How to solve
- It can be solved by (existing) bruteforce — enumerate all possible closed walks covering the required edges and check feasibility + total length.
- It can be solved by reducing to integer programming — standard ILP formulation with integer edge-traversal variables and Eulerian constraints.
- Other: DP over subsets of required edges in O(n² · 2^r) time (Held-Karp adaptation); branch-and-cut algorithms (Corberán et al., 2003); 3/2-approximation for metric instances (Frederickson, 1979).
Example Instance
Instance 1 (has feasible circuit):
Graph G with 6 vertices {0, 1, 2, 3, 4, 5} and 8 edges:
- Edges with lengths: {0,1}:1, {1,2}:1, {2,3}:1, {3,4}:1, {4,5}:1, {5,0}:1, {0,3}:2, {1,4}:2
- Required edges E' = {{0,1}, {2,3}, {4,5}} (3 required edges)
- B = 6
- Feasible circuit: 0 →{0,1}:1→ 1 →{1,2}:1→ 2 →{2,3}:1→ 3 →{3,4}:1→ 4 →{4,5}:1→ 5 →{5,0}:1→ 0
- Total length: 6 × 1 = 6 = B ✓
- All 3 required edges traversed ✓
- Answer: YES
- Exhaustive enumeration: search space 3⁸ = 6,561. Exactly 1 feasible circuit (the hexagon cycle). (Used in
find_all_satisfyingtest)
Instance 2 (no feasible circuit with given bound):
Graph G with 6 vertices {0, 1, 2, 3, 4, 5} and 7 edges:
- Edges with lengths: {0,1}:1, {1,2}:1, {2,3}:1, {3,0}:1, {3,4}:3, {4,5}:1, {5,3}:3
- Required edges E' = {{0,1}, {4,5}} (2 required edges)
- B = 4
- To traverse both {0,1} and {4,5}, the circuit must travel from the {0,1,2,3} component to vertex 4 and back. The shortest path from any endpoint of {0,1} to vertex 4 goes through vertex 3 via edge {3,4} of length 3. Minimum circuit cost: 1 (for {0,1}) + path to 4 (length ≥ 3) + 1 (for {4,5}) + path back (length ≥ 3) = 8 > 4 = B.
- Answer: NO
- Exhaustive enumeration: search space 3⁷ = 2,187. 0 feasible circuits. (Used in
find_all_satisfyingempty test)
Instance 3 (Chinese Postman special case, E' = E):
Graph G with 4 vertices {0, 1, 2, 3} and 4 edges (cycle C_4):
- Edges with lengths: {0,1}:1, {1,2}:1, {2,3}:1, {3,0}:1
- Required edges E' = {{0,1}, {1,2}, {2,3}, {3,0}} (all edges required)
- B = 4
- Circuit: 0 → 1 → 2 → 3 → 0, total length 4 = B ✓
- This is the Chinese Postman special case: an Eulerian circuit exists since all vertices have even degree.
- Answer: YES
Metadata
Metadata
Assignees
Labels
Type
Projects
Status