mirror of
https://github.com/Brandon-Rozek/matmod.git
synced 2025-12-09 04:30:24 +00:00
Futile attempts at improving average runtime
This commit is contained in:
parent
872e54ec5e
commit
0a894388a0
1 changed files with 37 additions and 13 deletions
38
vsp.py
38
vsp.py
|
|
@ -44,13 +44,19 @@ def has_vsp(model: Model, impfunction: ModelFunction,
|
|||
bottom = model.ordering.bottom()
|
||||
|
||||
C: Dict[ModelValue, Set[ModelValue]] = {}
|
||||
U: Dict[ModelValue, Set[ModelValue]] = {}
|
||||
|
||||
for d in model.designated_values:
|
||||
C[d] = model_closure({d,}, model.logical_operations, None)
|
||||
U[d] = {y for y in model.designated_values if impfunction(d, y) in model.designated_values}
|
||||
|
||||
for x in model.designated_values:
|
||||
|
||||
# Discard ({⊥} ∪ A', B) subalgebras
|
||||
if bottom is not None and x == bottom:
|
||||
continue
|
||||
|
||||
# Discard ({⊤} ∪ A', B) subalgebras when negation is defined
|
||||
if top is not None and negation_defined and x == top:
|
||||
continue
|
||||
|
||||
if x not in C:
|
||||
C[x] = model_closure({x,}, model.logical_operations, None)
|
||||
Xs = C[x]
|
||||
|
||||
# Discard ({⊥} ∪ A', B) subalgebras
|
||||
|
|
@ -61,8 +67,26 @@ def has_vsp(model: Model, impfunction: ModelFunction,
|
|||
if top is not None and negation_defined and top in Xs:
|
||||
continue
|
||||
|
||||
Ux = U[x]
|
||||
for y in model.designated_values - Xs - Ux:
|
||||
for y in model.designated_values - Xs:
|
||||
|
||||
# Discard (A, {⊤} ∪ B') subalgebras
|
||||
if top is not None and y == top:
|
||||
continue
|
||||
|
||||
# Discard (A, {⊥} ∪ B') subalgebras when negation is defined
|
||||
if bottom is not None and negation_defined and y == bottom:
|
||||
continue
|
||||
|
||||
# Discard ({a} ∪ A', {b} ∪ B') subalgebras when a <= b
|
||||
if model.ordering.is_lt(x, y):
|
||||
continue
|
||||
|
||||
# Discard ({a} ∪ A', {b} ∪ B') subalgebras when b <= a and negation is defined
|
||||
if negation_defined and model.ordering.is_lt(y, x):
|
||||
continue
|
||||
|
||||
if y not in C:
|
||||
C[y] = model_closure({y,}, model.logical_operations, None)
|
||||
Ys = C[y]
|
||||
|
||||
# Discard (A, {⊤} ∪ B') subalgebras
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue