I try to implement cp model with OR-tools CP-SAT solver. Please, is it possible to name constraints for being able to manage conflict later like for variables:
t_var[i] = model.NewBoolVar(f"affect_{i}")
2 Answers
Setter:
ct = model.Add(x == 2).WithName("my_ct")
Getter:
ct_name = ct.Name()
-
$\begingroup$ Thanks, it is good, 'model.Add(z_var[edge_iter] for adge_iter in ens_edges if edge_iter[0] == v).WithName(f"ct_{v}")' $\endgroup$– IssoufSep 25 at 19:02
C1 = model.addConstrs(<<expr>>, name = 'C1'+str(i))
-
$\begingroup$ the question is about the CP-SAT api, not the Gurobi one. $\endgroup$ Sep 25 at 19:00
-