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])