Good morning ! I would like to implement this constraint using CP-SAT (see image below).
x_i,j is a boolean variable, a and b are given. The problem is that I don't know how to implement the indicator function in a constraint. I tried with int() function but it cannot be applied with a BoundedLinearExpression. Here is my code:
for i in range(20): for j in range(30): x[(i,j)] = model.NewBoolVar('variable%ii%ij' % (i,j)) model.Add(a <= sum( int( sum(x[(i,j)] for j in range(30)) >= 5 ) for i in range(20) ) <= b)
Any idea on how to solve it ?