Skip to content

Commit

Permalink
test table constraint first argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wout4 committed Oct 19, 2023
1 parent 2c380db commit f8c1411
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cpmpy/expressions/globalconstraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ class Table(GlobalConstraint):
"""The values of the variables in 'array' correspond to a row in 'table'
"""
def __init__(self, array, table):
array = flatlist(array)
if not all(isinstance(x, Expression) for x in array):
raise TypeError("the first argument of a Table constraint should only contain variables/expressions")
super().__init__("table", [array, table])

def decompose(self):
Expand Down

0 comments on commit f8c1411

Please sign in to comment.