The source code and dockerfile for the GSW2024 AI Lab.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

24 lines
848 B

4 weeks ago
  1. import pycarl
  2. from pycarl.formula import Relation
  3. from configurations import PackageSelector
  4. class TestConstraint(PackageSelector):
  5. def test_init_bool(self, package):
  6. constraint = package.formula.Constraint(True)
  7. assert constraint.relation == Relation.EQ
  8. assert constraint.lhs == 0
  9. def test_init_var(self, package):
  10. pycarl.clear_pools()
  11. var = pycarl.Variable("x")
  12. bound = package.Rational(3)
  13. constraint = package.formula.Constraint(var, Relation.GREATER, bound)
  14. assert constraint.relation == Relation.LESS
  15. def test_init_pol(self, package):
  16. pycarl.clear_pools()
  17. var = pycarl.Variable("x")
  18. pol = var * var + package.Integer(2)
  19. constraint = package.formula.Constraint(pol, Relation.LEQ)
  20. assert constraint.relation == Relation.LESS