I am trying to understand travelling salesman problem, the Dantzig, Fulkerson, Johnson(1954) formulation. In the general formulation given below I am having trouble to implement subtour elimination in a practical problem.
$Min $$\sum\sum c_{ij}x_{ij}$
$s.t.\sum x_{ij}=1, j=1,...,n$
$\sum x_{ij}=1, i=1,...,n$
$\sum\sum x_{ij}\leq|S|-1, \forall i,j,i\neq j$
So I have a simple symmetric problem as the following: \begin{bmatrix} 0 & 3 & 1 & 2 & 4\\ 3 & 0 & 3 & 6 & 7\\ 1 & 3 & 0 & 7 & 4\\ 2 & 6 & 7 & 0 & 1\\ 4 & 7 & 4 & 1 & 0 \end{bmatrix}
I have formulated as the following:
$Min 3x_{12}+x_{13}+2x_{14}+4x_{15}+....+4x_{35}+x_{45}$
$s.t. x_{11}+x_{21}+...+x_{51}=1$
...
$x_{15}+x_{25}+...+x_{55}=1$
$x_{11}+x_{12}+...+x_{15}=1$
...
$x_{51}+x_{52}+...+x_{55}=1$
I have written until here without any problem. But for the last constraint, I couldn't understand how to write it down. How do I add the subtour elimination constraint in the formulation? The following one, to be specific: $\sum\sum x_{ij}\leq|S|-1, \forall i,j,i\neq j$
Techniques for Subtour Elimination in TSP: Theory and Implementation in Python
on the medium. Would you see that? $\endgroup$