Exercises TSP in logistics
Problem 1
Consider the problem of a paint manufacturing company, Rainbow, that produces batches of white (W), yellow (Y), black (B), and red (R) paint. The production facilities must be cleaned between batches of different colors. The goal is to determine the sequence of colors that minimizes the total cleaning time.
Nodes
W = White
Y = Yellow
B = Black
R = Red
Total number of cities n=4.
Distance Matrix dij - Cleaning Times in minutes: ('q' is assigned to prohibit xii)
From / To
White (1)
Yellow (2)
Black (3)
Red (4)
White (1)
q
10
17
15
Yellow (2)
20
q
19
18
Black (3)
50
44
q
22
Red (4)
45
40
20
q
Decision Variables: xij=1 if paint j follows paint i, and 0 otherwise.
For example,
x12=1 if after White, cleaning is done for Yellow.
Objective Function: Minimize total cleaning time:
Min Z=10x12+17x13+15x14+20x21+19x23+18x24+50x31+44x32+22x34+45x41+40x42+20x43
Entry/Exit Constraints (n = 4 colors):
Each color is entered exactly once:
x21+x31+x41=1 (to White)
x12+x32+x42=1 (to Yellow)
x13+x23+x43=1 (to Black)
x14+x24+x34=1 (to Red)
Each city is exited exactly once:
x12+x13+x14=1 (from White)
x21+x23+x24=1 (from Yellow)
x31+x32+x34=1 (from Black)
x41+x42+x43=1 (from Red)
Subtour Elimination Constraints (with n=4):
For n=4, the general constraint is
ui−uj+4⋅xij≤3
These constraints apply for i,j∈2,3,4 (nodes Yellow, Black, Red), with i=j excluding the origin city (City 1, White) from the variables ui and uj The possible pairs (i,j) are: (2,3), (2,4), (3,2), (3,4), (4,2), (4,3).
Some examples of these constraints would be:
For i=2 (Yellow), j=3 (Black): u2−u3+4⋅x23≤3
For i=2 (Yellow), j=4 (Red): u2−u4+4⋅x24≤3
For i=3 (Black), j=2 (Yellow): u3−u2+4⋅x32≤3
For i=3 (Black), j=4 (Red): u3−u4+4⋅x34≤3
For i=4 (Red), j=2 (Yellow): u4−u2+4⋅x42≤3
For i=4 (Red), j=3 (Black): u4−u3+4⋅x43≤3
These constraints ensure that no cycles are formed between a subset of the Yellow, Black, and Red cities.
Binary Variables:
xij∈0,1∀i,j.
The variables u_i are typically non-negative integers, with a possible range 1≤ui≤n.
For small problems like this 4-node example, all possible optimal routes can be enumerated. In this case, the number of tours is (n-1)! = (4-1)! = 3! = 6 tours.
Evaluating these six, the optimal solution is the W-Y-B-R-W (White-Yellow-Black-Red-White) tour with a total cleaning time of 10 + 19 + 22 + 45 = 96 minutes.
Problem 2 CEDI
Donwload the file here
Última actualización
¿Te fue útil?