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
$\begingroup$
$\endgroup$
1
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$– IssoufCommented Sep 25, 2023 at 19:02
$\begingroup$
$\endgroup$
2
C1 = model.addConstrs(<<expr>>, name = 'C1'+str(i))
-
$\begingroup$ the question is about the CP-SAT api, not the Gurobi one. $\endgroup$ Commented Sep 25, 2023 at 19:00
-
$\begingroup$ I think that this formulation is for GUROBI $\endgroup$– IssoufCommented Sep 25, 2023 at 19:03