diff --git a/asv.conf.actions.json b/asv.conf.actions.json index ca60c93..f562add 100644 --- a/asv.conf.actions.json +++ b/asv.conf.actions.json @@ -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 diff --git a/benchmarks/logic.py b/benchmarks/logic.py index 62d6cde..b299d88 100644 --- a/benchmarks/logic.py +++ b/benchmarks/logic.py @@ -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__) @@ -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') @@ -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)