Laurent
I agree with your performance view ... but there are some points:
a) In another moment, other specific constraints should be built, and some I want to know, this "how to do it....."
b) In addition, it is frustrating for a beginner (like me) tries something such simple as:
....................................................
n = 7 # number of nodes ( n x n matrix)
the_model = cp_model.CpModel()
tour = [ the_model.NewIntVar(0, (n-1), 'tour' )
for i in range(n)
]
the_model.AddCircuit( tour )
....................................................
runs it and an answer like:
....................................................
File "study_circuit.py", line 28, in model_CIRCUIT
the_model.AddCircuit( tour )
File "/home/ccs/.local/lib/python3.8/site-packages/ortools/sat/python/cp_model.py", line 855, in AddCircuit
cp_model_helper.AssertIsInt32(arc[0])
TypeError: 'IntVar' object is not subscriptable
....................................................
A bad feeling with this answer for a beginner ...
In another CP languages with this constraint is direct, for instance:
....................................
> L =[X1,X2], circuit(L).
L = [2,1]
...................................
Really, maybe it is fault also .... but the constraint done by-hand by Hakan works as expected.
Maybe in the manual of OR-TOOLS are missing some small examples to use these constraints.
Anyway, thanks very much
cc