mirror of
				https://github.com/Brandon-Rozek/matmod.git
				synced 2025-11-03 03:11:12 +00:00 
			
		
		
		
	Implemented optimization #29
This commit is contained in:
		
							parent
							
								
									9f80fb8bba
								
							
						
					
					
						commit
						2ff9f8134c
					
				
					 1 changed files with 11 additions and 3 deletions
				
			
		
							
								
								
									
										14
									
								
								vsp.py
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								vsp.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -3,12 +3,11 @@ Check to see if the model has the variable
 | 
			
		|||
sharing property.
 | 
			
		||||
"""
 | 
			
		||||
from itertools import chain, combinations, product
 | 
			
		||||
from typing import Dict, List, Optional, Set, Tuple
 | 
			
		||||
from typing import List, Optional, Set, Tuple
 | 
			
		||||
from common import set_to_str
 | 
			
		||||
from model import (
 | 
			
		||||
    Model, model_closure, ModelFunction, ModelValue
 | 
			
		||||
)
 | 
			
		||||
from logic import Conjunction, Disjunction, Implication, Operation
 | 
			
		||||
 | 
			
		||||
def preseed(
 | 
			
		||||
        initial_set: Set[ModelValue],
 | 
			
		||||
| 
						 | 
				
			
			@ -145,10 +144,19 @@ def has_vsp(model: Model, impfunction: ModelFunction, mconjunction: Optional[Mod
 | 
			
		|||
 | 
			
		||||
        # NOTE: Optimziation before model_closure
 | 
			
		||||
        # If the two subalgebras intersect, move
 | 
			
		||||
        # onto the next pair
 | 
			
		||||
        # onto the next pair.
 | 
			
		||||
        if len(xs & ys) > 0:
 | 
			
		||||
            continue
 | 
			
		||||
 | 
			
		||||
        # NOTE: Optimization
 | 
			
		||||
        # If a subalgebra doesn't have at least one
 | 
			
		||||
        # designated value, move onto the next pair.
 | 
			
		||||
        if len(xs & model.designated_values) == 0:
 | 
			
		||||
            continue
 | 
			
		||||
 | 
			
		||||
        if len(ys & model.designated_values) == 0:
 | 
			
		||||
            continue
 | 
			
		||||
 | 
			
		||||
        # NOTE: Optimization
 | 
			
		||||
        # If the left subalgebra contains bottom
 | 
			
		||||
        # or the right subalgebra contains top
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue