Rudy’s OBTF Rudolf Adamkovič

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


Constraints: Departures

Each city is departed from exactly once.

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

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