Repository navigation
🧩 Constraint Solving POTD:Problem of the Day: Traveling Purchaser Problem (TPP) #73759
Closed
Replies: 1 comment
|
This discussion has been marked as outdated by Constraint Solving — Problem of the Day. A newer discussion is available at Discussion #74121. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Constraint Solving Problem of the Day: The Traveling Purchaser Problem (TPP)
Problem Statement
The Traveling Purchaser Problem extends the classic Traveling Salesman Problem by combining routing with purchasing decisions.
Informal Description:
A purchaser needs to buy
mdifferent commodities fromnsuppliers. Each supplier is located at a different city, stocks a specific subset of commodities at varying prices, and has a non-zero profit margin. The purchaser starts at a depot, must visit a subset of cities to obtain all required items, and return home while minimizing the total cost—the sum of travel cost (distance × transportation rate) plus commodity purchase costs.Concrete Instance:
Travel distances (symmetric, in km):
Transportation cost: €1.50 per km.
Input/Output:
Why It Matters
Procurement & Supply Chain: Companies procuring multiple parts from different vendors across geographic regions face this exact problem. For example, automotive suppliers assembling components from factories in different regions must decide which factories to visit and where to source each part.
Retail & Distribution: Online grocery or pharmacy platforms optimize delivery routes while choosing purchase sources dynamically based on inventory availability and pricing—especially during supply constraints.
Military Logistics: Field units requiring multiple supply types must route through supply depots efficiently, selecting the cheapest available source at each location they visit.
Modeling Approaches
Approach 1: Mixed-Integer Linear Programming (MIP)
Variables:
x_ij ∈ {0,1}: binary variable indicating edge (i,j) in the toury_ijc ∈ {0,1}: binary variable indicating commodity c is bought from supplier j when arriving from city iu_i ∈ R+: continuous variable for tour position (used in subtour elimination)Constraints:
Tour structure: Each city visited exactly once (if at all)
Σ_j x_ij = 1for all i ≠ depot (incoming edges)Σ_i x_ij = 1for all j ≠ depot (outgoing edges)All commodities purchased: Each commodity bought from exactly one supplier
Σ_j Σ_i y_ijc = 1for all commodities cBuy only from visited cities: Can only purchase from city j if we travel to it
y_ijc ≤ x_ijfor all i, j, cSubtour elimination (Miller-Tucker-Zemlin):
u_i - u_j + n·x_ij ≤ n-1for all i,j (prevents cycles not including depot)Objective:
Trade-offs: Strong propagation and relaxation bounds; scales to ~100 cities but requires sophisticated branch-and-cut solvers (Cplex, Gurobi). Formulation is symmetric and can exploit LP relaxation.
Approach 2: Constraint Programming (CP)
Variables:
route[1..k]: sequence of visited cities (k ≤ n)source[c]: which city supplies commodity ccost_distance: total distance traveledcost_purchase: total purchase costKey Constraints:
alldifferent(route): no city visited twicesource[c] ∈ route: each commodity's source must be a visited cityavailable(source[c], c): city source[c] stocks commodity ccost_distance = circuit(route, distance_matrix): TSP-like constraint on tour costcost_purchase = Σ_c price[source[c]][c]: sum of individual purchasesObjective:
Trade-offs: More expressive (built-in
circuitglobal constraint for TSP structure); easier to layer business logic (inventory constraints, budget caps). Search-based, so can combine with local search metaheuristics. Scales well with fewer cities (10–50) but weaker relaxation bounds than MIP.Approach 3: Hybrid CP + Local Search
Idea: Use CP to find a feasible solution quickly (greedy tour + assignment), then refine via neighborhood search.
Neighborhoods:
Trade-offs: Fast, practical, anytime algorithm. Can find good solutions in seconds. Less complete than exact methods but scales to large instances.
Example Model (MiniZinc)
Key Techniques
1. Combining TSP Structure with Assignment
The TPP decomposes naturally: first solve a routing decision (which cities to visit), then solve an assignment problem (buy each commodity from the cheapest available supplier among visited cities). Many solvers use Benders decomposition to iteratively refine the tour and assignment.
2. Global Constraints & Propagation
circuitorsubtour_elimination: Ensures the route forms a valid cycleelementconstraint: Links route position to available inventory3. Symmetry Breaking
route[1] < route[2] < ... < route[k]to break rotational and reflective symmetries4. Lower Bound via Relaxation
Challenge Corner
Question 1: Variable elimination. In the MIP formulation above, could you eliminate the variables
y_ijcentirely and instead express the constraint directly in terms ofx_ij? How would you handle the assignment of commodities to cities?Question 2: Dynamic pricing. Suppose the price of each commodity depends on the quantity purchased (bulk discount). How would you extend the CP model to capture this? Would the MIP still be solvable efficiently?
Question 3: Capacity constraints. Add a per-vehicle weight or volume limit: each city visited adds its required commodities' weight, and the total must fit. Which modeling approach (MIP, CP, hybrid) would you prefer? Why?
References
Ramírez-Rosales, R., et al. "Traveling Purchaser Problem: A Tutorial." Computers & Operations Research, 2019.
Gendreau, M., & Potvin, J.-Y. (Eds.). Handbook of Metaheuristics (3rd ed.). Springer, 2019. Chapter on routing variants.
Rossi, F., van Beek, P., & Walsh, T. (Eds.). Handbook of Constraint Programming. Elsevier, 2006.
Glover, F., & Kochenberger, G. (Eds.). Handbook of Metaheuristics (2nd ed.). Springer, 2010.
Next Problem: Keep an eye out for a configuration or satisfiability problem next! Did this problem spark an idea for a variant you'd like to explore?
All reactions