PySMT 0.9.7.dev479__py2.py3-none-any.whl → 0.9.7.dev485__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pysmt/__init__.py +1 -1
- pysmt/cmd/install.py +1 -1
- pysmt/optimization/z3.py +25 -29
- pysmt/test/test_doc_snippets.py +75 -0
- {pysmt-0.9.7.dev479.dist-info → pysmt-0.9.7.dev485.dist-info}/METADATA +1 -1
- {pysmt-0.9.7.dev479.dist-info → pysmt-0.9.7.dev485.dist-info}/RECORD +11 -10
- {pysmt-0.9.7.dev479.dist-info → pysmt-0.9.7.dev485.dist-info}/WHEEL +0 -0
- {pysmt-0.9.7.dev479.dist-info → pysmt-0.9.7.dev485.dist-info}/entry_points.txt +0 -0
- {pysmt-0.9.7.dev479.dist-info → pysmt-0.9.7.dev485.dist-info}/licenses/LICENSE +0 -0
- {pysmt-0.9.7.dev479.dist-info → pysmt-0.9.7.dev485.dist-info}/licenses/NOTICE +0 -0
- {pysmt-0.9.7.dev479.dist-info → pysmt-0.9.7.dev485.dist-info}/top_level.txt +0 -0
pysmt/__init__.py
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
from typing import Tuple, Union
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
VERSION: Union[Tuple[int, int, int], Tuple[int, int, int, str, int]] = (0, 9, 7, "dev",
|
|
22
|
+
VERSION: Union[Tuple[int, int, int], Tuple[int, int, int, str, int]] = (0, 9, 7, "dev", 485)
|
|
23
23
|
|
|
24
24
|
# Try to provide human-readable version of latest commit for dev versions
|
|
25
25
|
# E.g. v0.5.1-4-g49a49f2-wip
|
pysmt/cmd/install.py
CHANGED
|
@@ -36,7 +36,7 @@ INSTALLERS = [
|
|
|
36
36
|
Installer(CVC5Installer, "1.3.3", {}),
|
|
37
37
|
Installer(CVC4Installer, "1.7-prerelease",
|
|
38
38
|
{"git_version" : "391ab9df6c3fd9a3771864900c1718534c1e4666"}),
|
|
39
|
-
Installer(Z3Installer, "
|
|
39
|
+
Installer(Z3Installer, "5.1.0", {}),
|
|
40
40
|
Installer(YicesInstaller, "2.6.4", {"yices_api_version": "1.1.5"}),
|
|
41
41
|
Installer(BtorInstaller, "3.2.3", {}),
|
|
42
42
|
Installer(PicoSATInstaller, "965",
|
pysmt/optimization/z3.py
CHANGED
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
from __future__ import absolute_import
|
|
20
20
|
|
|
21
|
-
from warnings import warn
|
|
22
|
-
|
|
23
21
|
from pysmt.decorators import clear_pending_pop
|
|
24
22
|
from pysmt.solvers.solver import Model
|
|
25
23
|
from pysmt.solvers.z3 import Z3Solver, Z3Model
|
|
@@ -127,33 +125,31 @@ class Z3NativeOptimizer(Optimizer, Z3Solver):
|
|
|
127
125
|
|
|
128
126
|
@clear_pending_pop
|
|
129
127
|
def boxed_optimize(self, goals: Sequence[Goal]) -> Optional[Dict[Goal, Tuple[Model, FNode]]]:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
models[g] = r
|
|
156
|
-
return models
|
|
128
|
+
self.push()
|
|
129
|
+
try:
|
|
130
|
+
self.z3.set(priority='box')
|
|
131
|
+
handles = [self._assert_z3_goal(goal, goal_id)
|
|
132
|
+
for goal_id, goal in enumerate(goals)]
|
|
133
|
+
# In box mode, each call to check() yields the optimal model
|
|
134
|
+
# of the next objective, in the order they were asserted
|
|
135
|
+
models: Dict[Goal, Tuple[Model, FNode]] = {}
|
|
136
|
+
for goal, h in zip(goals, handles):
|
|
137
|
+
if self.z3.check() != z3.sat:
|
|
138
|
+
return None
|
|
139
|
+
try:
|
|
140
|
+
model = Z3Model(self.environment, self.z3.model())
|
|
141
|
+
if goal.is_maxsmt_goal():
|
|
142
|
+
models[goal] = (model, self._compute_max_smt_cost(model, goal))
|
|
143
|
+
else:
|
|
144
|
+
self.converter.back(self.z3.lower(h))
|
|
145
|
+
models[goal] = (model, model.get_value(goal.term()))
|
|
146
|
+
except PysmtInfinityError:
|
|
147
|
+
raise PysmtUnboundedOptimizationError("The optimal value is unbounded")
|
|
148
|
+
except PysmtInfinitesimalError:
|
|
149
|
+
raise PysmtInfinitesimalError("The optimal value is infinitesimal")
|
|
150
|
+
return models
|
|
151
|
+
finally:
|
|
152
|
+
self.pop()
|
|
157
153
|
|
|
158
154
|
@clear_pending_pop
|
|
159
155
|
def lexicographic_optimize(self, goals: Sequence[Goal]) -> Optional[Tuple[Model, List[FNode]]]:
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of pySMT.
|
|
3
|
+
#
|
|
4
|
+
# Copyright 2014 Andrea Micheli and Marco Gario
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
import os
|
|
19
|
+
import runpy
|
|
20
|
+
import unittest
|
|
21
|
+
|
|
22
|
+
from pysmt.test import (TestCase, skipIfSolverNotAvailable,
|
|
23
|
+
skipIfNoSolverForLogic,
|
|
24
|
+
skipIfNoUnsatCoreSolverForLogic, main)
|
|
25
|
+
from pysmt.logics import QF_LIA
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
SNIPPETS_DIR = os.path.join(os.path.dirname(__file__),
|
|
29
|
+
"..", "..", "docs", "code_snippets")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# The docs are not shipped with the package, so skip when run from an install.
|
|
33
|
+
@unittest.skipIf(not os.path.isdir(SNIPPETS_DIR), "docs/ not available")
|
|
34
|
+
class TestDocSnippets(TestCase):
|
|
35
|
+
|
|
36
|
+
def setUp(self):
|
|
37
|
+
super().setUp()
|
|
38
|
+
# Match the default environment a reader gets from pysmt.shortcuts.
|
|
39
|
+
self.env.enable_infix_notation = True
|
|
40
|
+
|
|
41
|
+
def run_snippets(self, *names):
|
|
42
|
+
for name in names:
|
|
43
|
+
with self.subTest(snippet=name):
|
|
44
|
+
runpy.run_path(os.path.join(SNIPPETS_DIR, name + ".py"),
|
|
45
|
+
run_name="__main__")
|
|
46
|
+
|
|
47
|
+
def test_no_solver(self):
|
|
48
|
+
self.run_snippets("hello_world_opening", "hello_world_infix")
|
|
49
|
+
|
|
50
|
+
@skipIfNoSolverForLogic(QF_LIA)
|
|
51
|
+
def test_qf_lia(self):
|
|
52
|
+
self.run_snippets("hello_world_is_sat", "hello_world_get_model",
|
|
53
|
+
"hello_world_qf_lia")
|
|
54
|
+
|
|
55
|
+
@skipIfSolverNotAvailable("z3")
|
|
56
|
+
def test_z3(self):
|
|
57
|
+
self.run_snippets("hello_world")
|
|
58
|
+
|
|
59
|
+
@skipIfNoUnsatCoreSolverForLogic(QF_LIA)
|
|
60
|
+
def test_unsat_cores(self):
|
|
61
|
+
self.run_snippets("unsat_core", "unsat_core_named",
|
|
62
|
+
"unsat_core_assumptions")
|
|
63
|
+
|
|
64
|
+
def test_all_snippets_are_tested(self):
|
|
65
|
+
tested = {"hello_world_opening", "hello_world_infix",
|
|
66
|
+
"hello_world_is_sat", "hello_world_get_model",
|
|
67
|
+
"hello_world_qf_lia", "hello_world", "unsat_core",
|
|
68
|
+
"unsat_core_named", "unsat_core_assumptions"}
|
|
69
|
+
found = {f[:-3] for f in os.listdir(SNIPPETS_DIR) if f.endswith(".py")}
|
|
70
|
+
self.assertEqual(found, tested,
|
|
71
|
+
"Add new docs/code_snippets files to this test")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
if __name__ == '__main__':
|
|
75
|
+
main()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
pysmt/__init__.py,sha256
|
|
1
|
+
pysmt/__init__.py,sha256=-1nhsqf1cDJwZGajwhlm8vA59g3l6eLyADmCUslgp7k,1701
|
|
2
2
|
pysmt/__main__.py,sha256=rR-MV1QtLYqtVoJyY3m5B5Iz-lua0-5o6YSB0W4lKy8,1085
|
|
3
3
|
pysmt/configuration.py,sha256=Iq_46QZ9z_jpBMk76euJWTqGEwHad2qyiEDPix5sXsA,4538
|
|
4
4
|
pysmt/constants.py,sha256=pulb6NvROY_X8BePeyyX8T9MJLB79HZ_1FUYSlZ7Jfg,5769
|
|
@@ -22,7 +22,7 @@ pysmt/typing.py,sha256=aI8ZKEin4J2XLAHsY5fW1Pt4hZvlBlArxM4nrrmBas4,19550
|
|
|
22
22
|
pysmt/utils.py,sha256=_dSgl45k-u9cMXSyR672GBJcKMKdtl6xSTjqXKTSfcs,2906
|
|
23
23
|
pysmt/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
pysmt/cmd/check_version.py,sha256=DCS6pHVuQm9J_vfSSDDGxtvrV6P1mEhQK-IUjacDh3s,2895
|
|
25
|
-
pysmt/cmd/install.py,sha256
|
|
25
|
+
pysmt/cmd/install.py,sha256=-PT8N0nbl9fkd0LLQ1LMdHy1szzsGVimGdmuogH3xcc,10467
|
|
26
26
|
pysmt/cmd/shell.py,sha256=1H5NJ9St879-U3EDizq_5l34vKPUJr-wi3MyBy164Sc,6594
|
|
27
27
|
pysmt/cmd/installers/__init__.py,sha256=fEAD4FUh0Hjv7u-o9dc5nYMjzPUAzR8bWo8DSgUQjq4,1438
|
|
28
28
|
pysmt/cmd/installers/base.py,sha256=agHbXV4ILfW2my8bjFLoRPmK9Jq8fPz9aESPGbPLu-g,13201
|
|
@@ -41,7 +41,7 @@ pysmt/optimization/msat.py,sha256=yj5-vqxQFJnK3zjVlYpxemZ2BWG-6IrCTDKvjl94xNY,93
|
|
|
41
41
|
pysmt/optimization/optimizer.py,sha256=nt7x9YCULbS5wVg2IPWV6ZKnZGRQjDk5yGPYiz7QdmY,29607
|
|
42
42
|
pysmt/optimization/optimsat.py,sha256=hRqhPcssuUzXnTeEEv8taFcRI5nE7gU8drwDIC0NtFk,11040
|
|
43
43
|
pysmt/optimization/yices.py,sha256=Ly48G5JpnOhJBkd25Vg21jGcCjLEeEQUrWsG2Xxl_KI,931
|
|
44
|
-
pysmt/optimization/z3.py,sha256=
|
|
44
|
+
pysmt/optimization/z3.py,sha256=oruI7J_4NmtmiinGcyzooKE-Ny61Tf-sMxjc4kSoTEI,7479
|
|
45
45
|
pysmt/smtlib/__init__.py,sha256=JXBHtcb4Lv-Sb8whc9JuGbRH2EBLWwtLUh3PL9HhNE8,650
|
|
46
46
|
pysmt/smtlib/annotations.py,sha256=UTl_nnBikMGKzdpW5N17yIpvx-_8HZmo8hxXIKsm7Wo,4596
|
|
47
47
|
pysmt/smtlib/commands.py,sha256=hwWnXrzZxJmKtkIitHRtuin01WDUErT0VERR9h45t2A,2277
|
|
@@ -81,6 +81,7 @@ pysmt/test/test_cnf.py,sha256=iDb5OJeKxE7xP9molEa3TFtDtan8eAUF5gtDZMFZJn4,4620
|
|
|
81
81
|
pysmt/test/test_configuration.py,sha256=qlY1K2ap4BMoPmbANg2y3391ndr7EophNd_UZNAOUko,3661
|
|
82
82
|
pysmt/test/test_constants.py,sha256=vdjjtAOw5oQg57Bl5tllslnVWBHuRq3Zk33F1xDsBtA,4664
|
|
83
83
|
pysmt/test/test_cvc_quantifiers.py,sha256=a40NDyPKNynVpqq9M5pDTR8qFL_EumR8whw8escxP4I,1850
|
|
84
|
+
pysmt/test/test_doc_snippets.py,sha256=y3dXAduT6PNyT_XQOczwKIV5ymeGzqj3JxCTfQmi0sI,2720
|
|
84
85
|
pysmt/test/test_dwf.py,sha256=_spseUblkyG0w2ttthUvm_gab2PqnjqCsnRHlH1Q2aE,5015
|
|
85
86
|
pysmt/test/test_eager_model.py,sha256=hF9V8wQYXVeyW2Bo4sACa98xeJtfOMYjMvjWMHQaGag,3662
|
|
86
87
|
pysmt/test/test_env.py,sha256=g98aqMU2dlPW2hQmWy8DxCLfm06upMic5mU91MGX_PQ,8758
|
|
@@ -143,10 +144,10 @@ pysmt/walkers/dag.py,sha256=hw9qUfadQTpihX685YQobfxKv9XA84ffiA8XRMUQEfU,5694
|
|
|
143
144
|
pysmt/walkers/generic.py,sha256=2oMr_MDr7FswSlyx2ulbJ9ke5FsTCKABURnCsMeg4fc,5093
|
|
144
145
|
pysmt/walkers/identitydag.py,sha256=EAxSneEW91Z8GphlkbMPsPdlac7_FDcVj-_6_aunU2s,10902
|
|
145
146
|
pysmt/walkers/tree.py,sha256=1vquhaChRMSG_pvbz16wqKOFnsQAkzLvjh_xbB3dg5c,2730
|
|
146
|
-
pysmt-0.9.7.
|
|
147
|
-
pysmt-0.9.7.
|
|
148
|
-
pysmt-0.9.7.
|
|
149
|
-
pysmt-0.9.7.
|
|
150
|
-
pysmt-0.9.7.
|
|
151
|
-
pysmt-0.9.7.
|
|
152
|
-
pysmt-0.9.7.
|
|
147
|
+
pysmt-0.9.7.dev485.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
148
|
+
pysmt-0.9.7.dev485.dist-info/licenses/NOTICE,sha256=Ns-Jsa6nbqZUiTEEAM6HqioSZIxQ2RCJzxoBlWQaUfc,601
|
|
149
|
+
pysmt-0.9.7.dev485.dist-info/METADATA,sha256=oY0W4dADbjmGgO9xwljRC_pXSAXQq1KmOeH4xAjXQk4,1774
|
|
150
|
+
pysmt-0.9.7.dev485.dist-info/WHEEL,sha256=4YBfCYNH4wlLpv3pzq1hbEuIlXA4WJabKLFurZ7eTL0,109
|
|
151
|
+
pysmt-0.9.7.dev485.dist-info/entry_points.txt,sha256=gDc1XM0xTJJMDGC_nXd0kfbX-Omjke9Dn9F3awMLYIU,57
|
|
152
|
+
pysmt-0.9.7.dev485.dist-info/top_level.txt,sha256=NwHQbpTaZMEvjIUdC0bvvj-WUyULe-nt-opK3YQNRMk,6
|
|
153
|
+
pysmt-0.9.7.dev485.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|