I have used remove_constraint method of docplex before but for a specific model it keep giving me the following assertion error that I have no idea how to fix:
"assert len(cpx_terms) == len(mdl_terms)
AssertionError"
Here is a snippet of my code:
# Obj 2
Obj2_ptr = MODEL.add_constraint(Y[1] ==
T*sum(sum(ins.M_r[r]*ins.FF_r[r]*D_rij[(r,i,j)] for (i,j) in ins.AA_r[r]) for r in ins.RR))
# Obj 1
a = MODEL.add_constraint(Y[0] == ins.C_inv*(sum(Y_i[i] for i in ins.NN)
+ sum(Z_i[i]-sum(X_ij[(w,i)] for w in ins.NN if (w,i) in ins.AA) for i in ins.NN_s) )
+ ins.C_con*ins.l*sum(X_ij[i] for i in ins.AA) )
MODEL.remove_constraint(Obj2_ptr)
you can find the runnable code in the attachment.
------------------------------
Vahid Mahmoodian
------------------------------
#DecisionOptimization