Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do Not Merge] Duplicate PR #91

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion asv.conf.actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

// This list needs to be updated after each release of sympy. The branch to
// be checked should always be the previous release.
"branches": ["upstream/1.11", "upstream/master", "HEAD"], // for git
"branches": ["upstream/1.12", "upstream/master", "HEAD"], // for git
// "branches": ["tip"], // for mercurial

// The DVCS being used. If not set, it will be automatically
Expand Down
28 changes: 26 additions & 2 deletions benchmarks/logic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

from sympy import symbols
from sympy.logic.utilities import load_file
from sympy.logic import satisfiable
from sympy.logic import satisfiable, SOPform

input_path = os.path.dirname(__file__)

Expand All @@ -17,6 +17,9 @@ def setup(self):
file_name = os.path.join(input_path, 'logic-inputs', '%s.cnf' % test)
theory = load_file(file_name)
self.theories.append(theory)
self.minterms = [0, 2, 3, 4, 7, 9, 10, 15, 16, 17, 18, 21, 24, 26, 46, 47, 49, 51, 56, 60, 61, 63]
self.dontcares = [27, 29, 32, 33, 34, 40, 41, 44]
self.symbols = symbols('a b c d e f')

def time_load_file(self):
file_name = os.path.join(input_path, 'logic-inputs', '10.cnf')
Expand All @@ -31,3 +34,24 @@ def time_dpll2(self):
for theory in self.theories:
if not satisfiable(theory, algorithm='dpll2'):
raise ValueError("Function returned false")


class BoolalgSuite:
def setup(self):
self.minterms = [0, 2, 3, 4, 8, 9, 10, 15, 16, 17, 18, 21, 24, 26, 47, 48, 49, 50, 56, 60, 61, 62]
self.dontcares = [32, 33, 34, 35, 36, 40, 41, 42]
self.variables = symbols('a b c d e f')
(a, b, c, d, e, f) = self.variables
self.ref = ((~a & ~d & ~f) | (~c & ~d & ~f) | (~d & ~e & ~f) |
(a & b & c & d & ~e) | (a & b & c & d & ~f) |
(c & d & e & f & ~b) | (b & ~c & ~d & ~e) |
(c & ~b & ~d & ~e) | (e & ~b & ~c & ~d) |
(~b & ~c & ~e & ~f) | (b & f & ~a & ~c & ~e))

def teardown(self):
if not self.result.equals(self.ref):
raise ValueError("Incorrect result, invalid timing:"
" %s != %s" % (self.result, self.ref))

def time_sopform(self):
self.result = SOPform(self.variables, self.minterms, self.dontcares)