def __init__(self, entity: Entity, conditions: List[Condition], target: Target): if len(entity.children) == 0: raise ValueError("Problem entity is empty!") self.entity = entity self.conditions = conditions self.target = target # Initialize deduction graph. self.graph = DeductionGraph(conditions, target) # Build indexer self.indexer = Indexer(entity, self.graph)
def basic_pattern(): entity, target, conditions = get_problem() graph = DeductionGraph(conditions, target) indexer = Indexer(entity, graph) pattern = TrianglePattern(angle_A=AttributeState.KNOWN, angle_B=AttributeState.KNOWN, angle_C=AttributeState.KNOWN) conditions, entitis = indexer.index_by_pattern(pattern, True) print(entitis) print(conditions)