1

I am using choco to solve a CSP , and one of my constraints is that the sum of all my 5 variables is less than 10 . for a sum of two variables we can use the function arithm

model.arithm(x1,"+",x2,"<",10).post();

but this method can't accept more variables so is there a way add this constraint ?

Phonolog
  • 6,321
  • 3
  • 36
  • 64

1 Answers1

2

Would the sum constraint not work for you?

model.sum(new IntVar[]{x1, x2, x3, x4, x5}, "<", 10).post()
T. Albers
  • 46
  • 3