Skip to content

Commit

Permalink
toplevel_list to unravel list of constraints in model init
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimosts committed Jul 5, 2023
1 parent dbeaab0 commit 587f3de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cpmpy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from .expressions.utils import is_any_list
from .solvers.utils import SolverLookup
from .solvers.solver_interface import SolverInterface, SolverStatus, ExitStatus
from .transformations.normalize import toplevel_list

import pickle

Expand Down Expand Up @@ -67,6 +68,7 @@ def __init__(self, *args, minimize=None, maximize=None):
# use `__add__()` for typecheck
if is_any_list(args):
# add (and type-check) one by one
args = toplevel_list(args)
for a in args:
self += a
else:
Expand Down

0 comments on commit 587f3de

Please sign in to comment.