Rudy’s OBTF Rudolf Adamkovič

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


Objective

Minimize the tour length.

\begin{align*} y = \sum_{i = 1}^{n - 1} d_{x_i, x_{i + 1}} + d_{x_n, x_1} \end{align*}

N.B.

  • Indexing d with x[i] must be done with add_element.
  • Indexing d with add_element requires flattening of d.
# Set the objective function.
model.minimize(sum(t))

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