Skip to content

Commit

Permalink
asserts in nooverlap init
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimosts committed May 27, 2024
1 parent d8be7f4 commit 270a42e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cpmpy/expressions/globalconstraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,15 @@ def value(self):
class NoOverlap(GlobalConstraint):

def __init__(self, start, dur, end):
assert is_any_list(start), "start should be a list"
assert is_any_list(dur), "duration should be a list"
assert is_any_list(end), "end should be a list"

start = flatlist(start)
dur = flatlist(dur)
end = flatlist(end)
assert len(start) == len(dur) == len(end), "Start, duration and end should have equal length in NoOverlap constraint"

super().__init__("no_overlap", [start, dur, end])

def decompose(self):
Expand Down

0 comments on commit 270a42e

Please sign in to comment.