mirror of
https://github.com/Brandon-Rozek/matmod.git
synced 2025-12-19 05:10:25 +00:00
Implementing optimization #14
Discard subalgebras which are order-dependent
This commit is contained in:
parent
9f80fb8bba
commit
4b907281a5
3 changed files with 43 additions and 6 deletions
16
model.py
16
model.py
|
|
@ -103,18 +103,34 @@ def binary_function_str(f: ModelFunction) -> str:
|
|||
|
||||
Interpretation = Dict[Operation, ModelFunction]
|
||||
|
||||
class OrderTable:
|
||||
def __init__(self):
|
||||
self.ordering = set()
|
||||
|
||||
def add(self, x, y):
|
||||
"""
|
||||
Add x <= y
|
||||
"""
|
||||
self.ordering.add((x, y))
|
||||
|
||||
def is_lt(self, x, y):
|
||||
return (x, y) in self.ordering
|
||||
|
||||
|
||||
class Model:
|
||||
def __init__(
|
||||
self,
|
||||
carrier_set: Set[ModelValue],
|
||||
logical_operations: Set[ModelFunction],
|
||||
designated_values: Set[ModelValue],
|
||||
ordering: Optional[OrderTable] = None,
|
||||
name: Optional[str] = None
|
||||
):
|
||||
assert designated_values <= carrier_set
|
||||
self.carrier_set = carrier_set
|
||||
self.logical_operations = logical_operations
|
||||
self.designated_values = designated_values
|
||||
self.ordering = ordering
|
||||
self.name = str(abs(hash((
|
||||
frozenset(carrier_set),
|
||||
frozenset(logical_operations),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue