projects
/
linpy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Overloading for Domains.project_out(), to be improved
[linpy.git]
/
examples
/
squares.py
diff --git
a/examples/squares.py
b/examples/squares.py
index
0f4e1a5
..
d606631
100755
(executable)
--- a/
examples/squares.py
+++ b/
examples/squares.py
@@
-2,15
+2,15
@@
from pypol import *
from pypol import *
-
x, y = symbols('x y
')
+
a, x, y, z = symbols('a x y z
')
sq1 = Le(0, x) & Le(x, 2) & Le(0, y) & Le(y, 2)
sq2 = Le(2, x) & Le(x, 4) & Le(2, y) & Le(y, 4)
sq1 = Le(0, x) & Le(x, 2) & Le(0, y) & Le(y, 2)
sq2 = Le(2, x) & Le(x, 4) & Le(2, y) & Le(y, 4)
-
sq3 = Le(0, x) & Le(x, 3) & Le(0, y) & Le(y, 3)
sq4 = Le(1, x) & Le(x, 2) & Le(1, y) & Le(y, 2)
sq3 = Le(0, x) & Le(x, 3) & Le(0, y) & Le(y, 3)
sq4 = Le(1, x) & Le(x, 2) & Le(1, y) & Le(y, 2)
-sq5 = Le(1, x) & Le(x, 2) & Le(1, y)
+sq5 = Le(1, x) & Le(x, 2) & Le(1, y)
sq6 = Le(1, x) & Le(x, 2) & Le(1, y) & Eq(y, 3)
sq6 = Le(1, x) & Le(x, 2) & Le(1, y) & Eq(y, 3)
+sq7 = Le(0, x) & Le(x, 2) & Le(0, y) & Eq(z, 2) & Le(a, 3)
u = Polyhedron([])
x = sq1 - sq2
u = Polyhedron([])
x = sq1 - sq2
@@
-20,7
+20,7
@@
print('sq3 =', sq3) #print correct square
print('sq4 =', sq4) #print correct square
print('u =', u) #print correct square
print()
print('sq4 =', sq4) #print correct square
print('u =', u) #print correct square
print()
-print('¬sq1 =', ~sq1) #test compl
i
ment
+print('¬sq1 =', ~sq1) #test compl
e
ment
print()
print('sq1 + sq1 =', sq1 + sq2) #test addition
print('sq1 + sq2 =', Polyhedron(sq1 + sq2)) #test addition
print()
print('sq1 + sq1 =', sq1 + sq2) #test addition
print('sq1 + sq2 =', Polyhedron(sq1 + sq2)) #test addition
@@
-39,7
+39,7
@@
print('sq1 ⊔ sq2 =', Polyhedron(sq1 | sq2)) # test convex union
print()
print('check if sq1 and sq2 disjoint:', sq1.isdisjoint(sq2)) #should return false
print()
print()
print('check if sq1 and sq2 disjoint:', sq1.isdisjoint(sq2)) #should return false
print()
-print('sq1 disjoint:', sq1.disjoint()) #make disjoint
+print('sq1 disjoint:', sq1.disjoint()) #make disjoint
print('sq2 disjoint:', sq2.disjoint()) #make disjoint
print()
print('is square 1 universe?:', sq1.isuniverse()) #test if square is universe
print('sq2 disjoint:', sq2.disjoint()) #make disjoint
print()
print('is square 1 universe?:', sq1.isuniverse()) #test if square is universe
@@
-54,7
+54,7
@@
print()
print('lexographic min of sq2:', sq2.lexmin()) #test lexmax()
print('lexographic max of sq2:', sq2.lexmax()) #test lexmax()
print()
print('lexographic min of sq2:', sq2.lexmin()) #test lexmax()
print('lexographic max of sq2:', sq2.lexmax()) #test lexmax()
print()
-print('Polyhedral hull of sq1 + sq2 is:', x.polyhedral_hull()) #test polyhedral hull, returns same
+print('Polyhedral hull of sq1 + sq2 is:', x.polyhedral_hull()) #test polyhedral hull, returns same
#value as Polyhedron(sq1 + sq2)
print()
print('is sq1 bounded?', sq1.isbounded()) #unbounded should return True
#value as Polyhedron(sq1 + sq2)
print()
print('is sq1 bounded?', sq1.isbounded()) #unbounded should return True
@@
-62,4
+62,6
@@
print('is sq5 bounded?', sq5.isbounded()) #unbounded should return False
print()
print('sq6:', sq6)
print('sq6 simplified:', sq6.sample())
print()
print('sq6:', sq6)
print('sq6 simplified:', sq6.sample())
-
+print()
+#print(u.drop_dims(' '))
+print('sq7 with out constraints involving y and a', sq7.drop_dims('y a')) #drops dims that are passed