Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 choco 来解决 CSP ,我的限制之一是我所有 5 个变量的总和小于 10 。对于两个变量的总和,我们可以使用函数 arithm
model.arithm(x1,"+",x2,"<",10).post();
但是这种方法不能接受更多的变量,所以有没有办法添加这个约束?
总和约束对您不起作用吗?
model.sum(new IntVar[]{x1, x2, x3, x4, x5}, "<", 10).post()