Rudy’s OBTF Rudolf Adamkovič

Home / Computer science / Traveling salesman problem (TSP) / Computation: Python, SAT, MTZ


Constraints: Arrivals

Each city is arrived in exactly once.

\begin{equation*} \forall i \in \{1, \ldots n\} - \{j\} \quad \sum_{j = 1}^{n} x_{ij} = 1 \end{equation*}
for i in range(n):
    model.add(sum(x[i][j] for j in range(n) if i != j) == 1)

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.