Skip to content

Commit

Permalink
tests:pb actually test what happens with too large bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
tias committed Nov 29, 2023
1 parent 586fddf commit 74803bb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_pysat_wsum.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ def test_encode_pb_expressions(self):
for expression in expressions:
Model(expression).solve("pysat")

def test_encode_pb_oob(self):
# test out of bounds (meaningless) thresholds
expressions = [
sum(self.bv*[2,2,2]) <= 10, # true
sum(self.bv*[2,2,2]) <= 6, # true
sum(self.bv*[2,2,2]) >= 10, # false
sum(self.bv*[2,2,2]) >= 6, # undecided
sum(self.bv*[2,-2,2]) <= 10, # true
sum(self.bv*[2,-2,2]) <= 4, # true
sum(self.bv*[2,-2,2]) >= 10, # false
sum(self.bv*[2,-2,2]) >= 4, # undecided
]

## check all types of linear constraints are handled
for expression in expressions:
Model(expression).solve("pysat")

if __name__ == '__main__':
unittest.main()

0 comments on commit 74803bb

Please sign in to comment.