Rudy’s OBTF Rudolf Adamkovič

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


Auxiliary variables: Terms

# Create auxiliary variables for terms.
t = [model.new_int_var(0, d.max(), f"d_{i}") for i in range(n)]

# Constrain the values of the terms.
d_flat = d.flatten().tolist()
for i in range(n):
    model.add_element(s[i], d_flat, t[i])

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