I have the following problem.
number_of_machines
is controlled by other constraints. I need to set line variable to specific value based on "range" constraint.
number_of_machines = model.NewIntVar(0, 100, '')
model.Add(line == 1).OnlyEnforceIf(number_of_machines > 5 and number_of_machines <= 10)
model.Add(line == 6).OnlyEnforceIf(number_of_machines >= 11 and number_of_machines <= 20)
model.Add(line == 2).OnlyEnforceIf(number_of_machines >= 21 and number_of_machines <= 50)
model.Add(line == 8).OnlyEnforceIf(number_of_machines >= 51 and number_of_machines <= 100)
for "AND" I'm getting the error: NotImplementedError: Evaluating a LinearExpr instance as a Boolean is not implemented. And for linear expression I'm getting another error: 'BoundedLinearExpression' object has no attribute 'Index'
Could you help me with how I should set such conditions in the CP-SAT model?
UPDATED: fixed directions of comparisons (as noticed in the answer)