Skip to content

sum over single boolvar #654

@tias

Description

@tias

Triggered by #653

>>> import cpmpy as cp
>>> b = cp.boolvar()
>>> cp.Model(sum(b) == 1).solve()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: '_BoolVarImpl' object is not iterable

cause is in cpmpy/expressions/python_builtins.py: 32a23d85c (wout4 2024-07-18 20:36:53 +0200 153) iterable = tuple(iterable[0]) # Fix generator polling

That line is weird...

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions