X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/blobdiff_plain/156db05a9a4c4e6d71a431fcc6343b973ca1d5ab..afb3c2bc9f798096c571ff02d2eb2327544d7160:/pypol/linear.py diff --git a/pypol/linear.py b/pypol/linear.py index 8fdece9..c34402a 100644 --- a/pypol/linear.py +++ b/pypol/linear.py @@ -355,8 +355,11 @@ class Constant(Expression): return bool(self.constant) def __repr__(self): - return '{}({!r})'.format(self.__class__.__name__, self._constant) - + if self.constant.denominator == 1: + return '{}({!r})'.format(self.__class__.__name__, self.constant) + else: + return '{}({!r}, {!r})'.format(self.__class__.__name__, + self.constant.numerator, self.constant.denominator) class Symbol(Expression): @@ -696,7 +699,8 @@ Universe = Polyhedron() if __name__ == '__main__': - p1 = Polyhedron('2a + 2b + 1 == 0') # empty - print(p1._toisl()) - p2 = Polyhedron('3x + 2y + 3 == 0') # not empty - print(p2._toisl()) + #p = Polyhedron('2a + 2b + 1 == 0') # empty + p = Polyhedron('3x + 2y + 3 == 0, y == 0') # not empty + ip = p._toisl() + print(ip) + print(ip.constraints())