private static void BuildInterpretationPlan(LGSPGraph graph) { graph.matchingState.patternGraph = BuildPatternGraph(graph); PlanGraph planGraph = PlanGraphGenerator.GeneratePlanGraph(graph.Model, graph.statistics, graph.matchingState.patternGraph, false, false, false, new Dictionary <PatternElement, SetValueType>()); PlanGraphGenerator.MarkMinimumSpanningArborescence(planGraph, graph.matchingState.patternGraph.name, false); SearchPlanGraph searchPlanGraph = SearchPlanGraphGeneratorAndScheduler.GenerateSearchPlanGraph(planGraph); ScheduledSearchPlan scheduledSearchPlan = SearchPlanGraphGeneratorAndScheduler.ScheduleSearchPlan( searchPlanGraph, graph.matchingState.patternGraph, false, false); InterpretationPlanBuilder builder = new InterpretationPlanBuilder(scheduledSearchPlan, searchPlanGraph, graph.Model); graph.matchingState.interpretationPlan = builder.BuildInterpretationPlan("ComparisonMatcher_" + graph.GraphId); ++GraphMatchingState.numInterpretationPlans; graph.matchingState.changesCounterAtInterpretationPlanBuilding = graph.changesCounterAtLastAnalyze; Debug.Assert(graph.changesCounterAtLastAnalyze == graph.ChangesCounter); #if LOG_ISOMORPHY_CHECKING SourceBuilder sb = new SourceBuilder(); graph.matchingState.interpretationPlan.Dump(sb); writer.WriteLine(); writer.WriteLine(sb.ToString()); writer.WriteLine(); writer.Flush(); #endif }
private static void InsertInlinedIndependentCheckForDuplicateMatch(List <SearchOperation> operations) { bool isInlinedIndependentElementExisting = false; foreach (SearchOperation op in operations) { if (SearchPlanGraphGeneratorAndScheduler.IsOperationAnInlinedIndependentElement(op)) { isInlinedIndependentElementExisting = true; break; } } if (isInlinedIndependentElementExisting) { // insert at end of schedule, just moved ahead over negatives and independents // TODO: if we can estimate condition overhead, it makes sense to move ahead over conditions, too int i = operations.Count - 1; while ((operations[i].Type == SearchOperationType.NegativePattern || operations[i].Type == SearchOperationType.IndependentPattern) && i > 0) { --i; } SearchOperation so = new SearchOperation(SearchOperationType.InlinedIndependentCheckForDuplicateMatch, null, null, operations[i].CostToEnd); operations.Insert(i + 1, so); } }