Skip to content

Commit e7ae54f

Browse files
committed
removed legacy __main__ sections
1 parent a9eba62 commit e7ae54f

File tree

3 files changed

+0
-87
lines changed

3 files changed

+0
-87
lines changed

src/wmipa/core/polynomial.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -199,41 +199,3 @@ def _is_integral(v: SupportsInt) -> bool:
199199
return v.denominator == 1
200200
else:
201201
return False
202-
203-
204-
if __name__ == "__main__":
205-
import pysmt.shortcuts as smt
206-
207-
x = smt.Symbol("x", REAL)
208-
y = smt.Symbol("y", REAL)
209-
z = smt.Symbol("z", REAL)
210-
vv = [x, y, z]
211-
212-
"""
213-
214-
p1 = Plus(Times(Real(3), Pow(x,Real(2))), Times(Real(4), Pow(y,Real(7)), z), Real(1))
215-
print("(p1)", str(Polynomial(p1, variables)), "\n\n\n")
216-
217-
p2 = Plus(p1, p1)
218-
print("(p2 = p1 + p1)", str(Polynomial(p2, variables)), "\n\n\n")
219-
220-
p3 = Times(p1, p1)
221-
print("(p3 = p1 * p1)", str(Polynomial(p3, variables)), "\n\n\n")
222-
223-
p4 = Plus(p3, p2, p1)
224-
print("(p4 = p3 + p2 + p1)", str(Polynomial(p4, variables)), "\n\n\n")
225-
226-
"""
227-
228-
p = Polynomial(
229-
smt.Plus(smt.Times(smt.Real(3), smt.Pow(x, smt.Real(2))), smt.Times(y, z)),
230-
vv,
231-
smt.get_env(),
232-
)
233-
f = p.to_numpy()
234-
235-
x = np.array(list(range(12))).reshape(-1, 3)
236-
print("p:", str(p))
237-
print("x:", x)
238-
239-
print("p(x):", f(x))

src/wmipa/core/polytope.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,3 @@ def to_numpy(self) -> tuple[np.ndarray, np.ndarray]:
4141

4242
def __str__(self) -> str:
4343
return "\n".join(["[" + str(b) + "]" for b in self.inequalities])
44-
45-
46-
if __name__ == "__main__":
47-
48-
import pysmt.shortcuts as smt
49-
50-
x = smt.Symbol("x", smt.REAL)
51-
y = smt.Symbol("y", smt.REAL)
52-
variables = [x, y]
53-
54-
h1 = smt.LE(
55-
smt.Plus(smt.Times(smt.Real(3), x), smt.Times(smt.Real(5), y), smt.Real(7)), x
56-
)
57-
h2 = smt.LE(x, y)
58-
59-
p = Polytope([h1, h2], variables, smt.get_env())
60-
print("p:", p)
61-
print("pysmt:", smt.serialize(p.to_pysmt()))
62-
A, b = p.to_numpy()
63-
print("A:", A)
64-
print("b:", b)

src/wmipa/integration/rejection.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,3 @@ def integrate_batch(
5555
volumes.append(self.integrate(polytope, integrand))
5656

5757
return np.array(volumes)
58-
59-
60-
if __name__ == "__main__":
61-
# avoid polluting the global namespace
62-
import pysmt.shortcuts as smt
63-
import pysmt.typing as smt_typing
64-
65-
import wmipa.core as wmipa_ds
66-
67-
x = smt.Symbol("x", smt_typing.REAL)
68-
y = smt.Symbol("y", smt_typing.REAL)
69-
env = smt.get_env()
70-
71-
variables = [x, y]
72-
73-
h1 = smt.LE(smt.Real(0), x)
74-
h2 = smt.LE(smt.Real(0), y)
75-
h3 = smt.LE(smt.Plus(x, y), smt.Real(1))
76-
77-
# w = smt.Minus(smt.Real(1), smt.Plus(x, y))
78-
w = smt.Plus(x, y)
79-
80-
pt = wmipa_ds.Polytope([h1, h2, h3], variables, env=env)
81-
pn = wmipa_ds.Polynomial(w, variables, env=env)
82-
83-
integrator = RejectionIntegrator(100000)
84-
85-
print("integral:", integrator.integrate(pt, pn))

0 commit comments

Comments
 (0)