X-Git-Url: https://scm.cri.ensmp.fr/git/linpy.git/blobdiff_plain/7fff25bf40e4db570565586fb49165d1675002c2..c9bd08381cbc109ae9602cc780fc7e8899651ae3:/linpy/polyhedra.py diff --git a/linpy/polyhedra.py b/linpy/polyhedra.py index 8eddb2d..346ffff 100644 --- a/linpy/polyhedra.py +++ b/linpy/polyhedra.py @@ -23,7 +23,7 @@ from . import islhelper from .islhelper import mainctx, libisl from .geometry import GeometricObject, Point -from .linexprs import Expression, Rational +from .linexprs import LinExpr, Rational from .domains import Domain @@ -50,7 +50,7 @@ class Polyhedron(Domain): """ Create and return a new Polyhedron from a string or list of equalities and inequalities. """ - + if isinstance(equalities, str): if inequalities is not None: raise TypeError('too many arguments') @@ -63,14 +63,14 @@ class Polyhedron(Domain): equalities = [] else: for i, equality in enumerate(equalities): - if not isinstance(equality, Expression): + if not isinstance(equality, LinExpr): raise TypeError('equalities must be linear expressions') equalities[i] = equality.scaleint() if inequalities is None: inequalities = [] else: for i, inequality in enumerate(inequalities): - if not isinstance(inequality, Expression): + if not isinstance(inequality, LinExpr): raise TypeError('inequalities must be linear expressions') inequalities[i] = inequality.scaleint() symbols = cls._xsymbols(equalities + inequalities) @@ -191,7 +191,7 @@ class Polyhedron(Domain): coefficient = islhelper.isl_val_to_int(coefficient) if coefficient != 0: coefficients[symbol] = coefficient - expression = Expression(coefficients, constant) + expression = LinExpr(coefficients, constant) if libisl.isl_constraint_is_equality(islconstraint): equalities.append(expression) else: @@ -345,13 +345,13 @@ Universe = UniverseType() def _polymorphic(func): @functools.wraps(func) def wrapper(left, right): - if not isinstance(left, Expression): + if not isinstance(left, LinExpr): if isinstance(left, numbers.Rational): left = Rational(left) else: raise TypeError('left must be a a rational number ' 'or a linear expression') - if not isinstance(right, Expression): + if not isinstance(right, LinExpr): if isinstance(right, numbers.Rational): right = Rational(right) else: