fixed vertices pushed before adding plot
[linpy.git] / pypol / polyhedra.py
index 6b44bdc..63ecb64 100644 (file)
@@ -37,7 +37,7 @@ class Polyhedron(Domain):
         elif isinstance(equalities, Domain):
             if inequalities is not None:
                 raise TypeError('too many arguments')
         elif isinstance(equalities, Domain):
             if inequalities is not None:
                 raise TypeError('too many arguments')
-            return equalities.polyhedral_hull()
+            return equalities.aspolyhedron()
         if equalities is None:
             equalities = []
         else:
         if equalities is None:
             equalities = []
         else:
@@ -82,9 +82,16 @@ class Polyhedron(Domain):
         libisl.isl_basic_set_free(islbset)
         return universe
 
         libisl.isl_basic_set_free(islbset)
         return universe
 
-    def polyhedral_hull(self):
+    def aspolyhedron(self):
         return self
 
         return self
 
+    def subs(self, symbol, expression=None):
+        equalities = [equality.subs(symbol, expression)
+            for equality in self.equalities]
+        inequalities = [inequality.subs(symbol, expression)
+            for inequality in self.inequalities]
+        return Polyhedron(equalities, inequalities)
+
     @classmethod
     def _fromislbasicset(cls, islbset, symbols):
         islconstraints = islhelper.isl_basic_set_constraints(islbset)
     @classmethod
     def _fromislbasicset(cls, islbset, symbols):
         islconstraints = islhelper.isl_basic_set_constraints(islbset)
@@ -164,9 +171,9 @@ class Polyhedron(Domain):
         else:
             strings = []
             for equality in self.equalities:
         else:
             strings = []
             for equality in self.equalities:
-                strings.append('Eq({}, 0)'.format(equality))
+                strings.append('0 == {}'.format(equality))
             for inequality in self.inequalities:
             for inequality in self.inequalities:
-                strings.append('Ge({}, 0)'.format(inequality))
+                strings.append('0 <= {}'.format(inequality))
             if len(strings) == 1:
                 return strings[0]
             else:
             if len(strings) == 1:
                 return strings[0]
             else: