Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion constraint/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,12 @@ def __call__(self, variables: Sequence, domains: dict, assignments: dict, forwar
if temp_sum > target_value:
domain.hideValue(value)
else:
# sum_value already includes min(domain) as a placeholder for this
# unassigned variable; subtract it before adding the candidate value
# to avoid double-counting.
var_placeholder = min(domain)
for value in domain[:]:
temp_sum = sum_value + value
temp_sum = sum_value - var_placeholder + value
if temp_sum > target_value:
domain.hideValue(value)
if not domain:
Expand Down
Loading