Implement IslObjects, delete Value
[linpy.git] / pypol / linear.py
index 331d3af..348294c 100644 (file)
@@ -5,7 +5,7 @@ import numbers
 from fractions import Fraction, gcd
 
 from . import isl, islhelper
 from fractions import Fraction, gcd
 
 from . import isl, islhelper
-from .isl import libisl, Context
+from .isl import libisl, Context, BasicSet
 
 
 __all__ = [
 
 
 __all__ = [
@@ -357,12 +357,6 @@ class Polyhedron:
                         raise TypeError('non-integer constraint: '
                                 '{} <= 0'.format(constraint))
                 self._inequalities.append(constraint)
                         raise TypeError('non-integer constraint: '
                                 '{} <= 0'.format(constraint))
                 self._inequalities.append(constraint)
-        self._bset = self._to_isl()
-        #print(self._bset)
-        #put this here just to test from isl method
-        #from_isl = self.from_isl(self._bset)
-        #print(from_isl)
-        #rint(self)
         return self
 
     @property
         return self
 
     @property
@@ -533,11 +527,7 @@ class Polyhedron:
                     iden = symbols.index(ineq)
                     cin = libisl.isl_constraint_set_coefficient_si(cin, islhelper.isl_dim_set, iden, num)  #use 3 for type isl_dim_set
             bset = libisl.isl_basic_set_add_constraint(bset, cin)
                     iden = symbols.index(ineq)
                     cin = libisl.isl_constraint_set_coefficient_si(cin, islhelper.isl_dim_set, iden, num)  #use 3 for type isl_dim_set
             bset = libisl.isl_basic_set_add_constraint(bset, cin)
-        ip = libisl.isl_printer_to_str(ctx) #create string printer
-        ip = libisl.isl_printer_print_basic_set(ip, bset) #print basic set to printer
-        string = libisl.isl_printer_get_str(ip)   #get string from printer
-        string = str(string.decode())
-        print(string)
+        bset = BasicSet(bset)
         return bset
 
     def from_isl(self, bset):
         return bset
 
     def from_isl(self, bset):
@@ -561,7 +551,5 @@ if __name__ == '__main__':
     ex1 = Expression(coefficients={'a': 1, 'x': 2}, constant=2)
     ex2 = Expression(coefficients={'a': 3  , 'b': 2}, constant=3)
     p = Polyhedron(inequalities=[ex1, ex2])
     ex1 = Expression(coefficients={'a': 1, 'x': 2}, constant=2)
     ex2 = Expression(coefficients={'a': 3  , 'b': 2}, constant=3)
     p = Polyhedron(inequalities=[ex1, ex2])
-    #p = eq(ex2, 0)# 2a+4 = 0, in fact 6a+3 = 0
-    #p.to_isl()
-
-#universe = Polyhedron()
+    bs = p._to_isl()
+    print(bs)