Changeset 11015
- Timestamp:
- 06/13/14 17:20:36 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/Formatters/SymbolicExpressionTreeLatexFormatter.cs
r10655 r11015 65 65 66 66 public string Format(ISymbolicExpressionTree symbolicExpressionTree) { 67 string s; 68 Format(symbolicExpressionTree, out s); 69 return s; 70 } 71 72 public Dictionary<ISymbolicExpressionTreeNode, string> Format(ISymbolicExpressionTree symbolicExpressionTree, out string str, int offset = 0) { 73 var nodeIds = new Dictionary<ISymbolicExpressionTreeNode, string>(); 67 74 var root = symbolicExpressionTree.Root; 68 75 var actualRoot = root.SubtreeCount == 0 ? root.GetSubtree(0) : root; … … 78 85 "\\begin{tikzpicture}" + nl + 79 86 "\\def\\ws{1}" + nl + 80 "\\def\\hs{0.7}" + nl); 87 "\\def\\hs{0.7}" + nl + 88 "\\def\\offs{" + offset + "}" + nl); 81 89 82 var nodeIndices = new Dictionary<ISymbolicExpressionTreeNode, int>();83 90 var nodes = symbolicExpressionTree.IterateNodesBreadth().ToList(); 84 91 for (int i = 0; i < nodes.Count; ++i) { 85 92 var node = nodes[i]; 86 nodeIndices.Add(node, i); 93 var id = Guid.NewGuid().ToString(); 94 nodeIds[node] = id; 87 95 var coord = nodeCoordinates[node]; 88 96 var nodeName = symbolNameMap.ContainsKey(node.Symbol.Name) ? symbolNameMap[node.Symbol.Name] : node.ToString(); 89 sb.AppendLine(string.Format(CultureInfo.InvariantCulture, "\\node ({0}) at (\\ws*{1} ,\\hs*{2}) {{{3}}};", i, ws * coord.X, -hs * coord.Y, EscapeLatexString(nodeName)));97 sb.AppendLine(string.Format(CultureInfo.InvariantCulture, "\\node ({0}) at (\\ws*{1} + {2},\\hs*{3}) {{{4}}};", nodeIds[node], ws * coord.X, offset, -hs * coord.Y, EscapeLatexString(nodeName))); 90 98 } 91 99 92 100 for (int i = 0; i < nodes.Count; ++i) { 101 var n = nodes[i]; 93 102 foreach (var s in nodes[i].Subtrees) { 94 sb.AppendLine(string.Format(CultureInfo.InvariantCulture, "\\draw ({0}) -- ({1});", i, nodeIndices[s]));103 sb.AppendLine(string.Format(CultureInfo.InvariantCulture, "\\draw ({0}) -- ({1});", nodeIds[n], nodeIds[s])); 95 104 } 96 105 } … … 98 107 sb.Append("\\end{tikzpicture}" + nl + 99 108 "\\end{document}" + nl); 100 return sb.ToString(); 109 str = sb.ToString(); 110 return nodeIds; 101 111 } 102 112 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/HeuristicLab.EvolutionTracking.Views-3.4.csproj
r10936 r11015 97 97 <DependentUpon>FrequentFragmentsDialog.cs</DependentUpon> 98 98 </Compile> 99 <Compile Include="GenealogyGraphChart.cs" /> 99 <Compile Include="GenealogyGraphChart.cs"> 100 <SubType>UserControl</SubType> 101 </Compile> 100 102 <Compile Include="GenealogyGraphChart.Designer.cs"> 101 103 <DependentUpon>GenealogyGraphChart.cs</DependentUpon> -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r10936 r11015 279 279 <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon> 280 280 </Compile> 281 <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs" /> 281 <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs"> 282 <SubType>UserControl</SubType> 283 </Compile> 282 284 <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs"> 283 285 <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon> … … 289 291 <DependentUpon>SymbolicDataAnalysisExpressionLineageExplorerView.cs</DependentUpon> 290 292 </Compile> 291 <Compile Include="Tracking\SymbolicExpressionChartControl.cs" /> 293 <Compile Include="Tracking\SymbolicExpressionChartControl.cs"> 294 <SubType>UserControl</SubType> 295 </Compile> 292 296 <Compile Include="Tracking\SymbolicExpressionChartControl.Designer.cs"> 293 297 <DependentUpon>SymbolicExpressionChartControl.cs</DependentUpon> -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/FragmentGraphView.cs
r10888 r11015 69 69 var chart = symbolicExpressionChartControl.Chart; 70 70 tileDictionary.Clear(); 71 foreach (var node in Content. Nodes) {71 foreach (var node in Content.Vertices) { 72 72 var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)node.Content; 73 73 var tile = new SymbolicExpressionTreeTile(chart); … … 79 79 tileDictionary.Add(node, tileNode); 80 80 } 81 foreach (var node in Content. Nodes.Where(n => n.OutArcs.Any())) {81 foreach (var node in Content.Vertices.Where(n => n.OutArcs.Any())) { 82 82 var layoutNode = tileDictionary[node]; 83 83 layoutNode.Children = new List<TileLayoutNode>(node.OutArcs.Select(a => tileDictionary[(FragmentNode)a.Target])); … … 87 87 private void Draw() { 88 88 var chart = symbolicExpressionChartControl.Chart; 89 var nodes = Content. Nodes.ToList();89 var nodes = Content.Vertices.ToList(); 90 90 var root = nodes[0]; 91 91 var fragmentRoot = tileDictionary[root]; -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.cs
r10903 r11015 100 100 var subtreeIndex = graphNode.Content.IterateNodesPrefix().ToList().IndexOf(subtree); 101 101 var fragmentGraph = SymbolicDataAnalysisExpressionTracing.TraceSubtree(graphNode, subtreeIndex); 102 if (fragmentGraph. Nodes.Any()) {102 if (fragmentGraph.Vertices.Any()) { 103 103 MainFormManager.MainForm.ShowContent(fragmentGraph); // display the fragment graph on the screen 104 104 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r10888 r11015 306 306 <Compile Include="Tracking\SymbolicDataAnalysisExpressionBeforeManipulatorOperator.cs" /> 307 307 <Compile Include="Tracking\SymbolicDataAnalysisExpressionTracing.cs" /> 308 <Compile Include="TreeDistance\BottomUpDistanceCalculator.cs" /> 308 309 <None Include="HeuristicLab.snk" /> 309 310 <None Include="Plugin.cs.frame" /> … … 340 341 </ItemGroup> 341 342 <ItemGroup> 343 <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.csproj"> 344 <Project>{423bd94f-963a-438e-ba45-3bb3d61cd03b}</Project> 345 <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4</Name> 346 </ProjectReference> 342 347 <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj"> 343 348 <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project> -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs
r10650 r11015 103 103 104 104 if (found) { 105 similarity += MaxCommonSubtreeSimilarity(current, tree, SimilarityComparer); 105 // similarity += MaxCommonSubtreeSimilarity(current, tree, SimilarityComparer); 106 var distance = BottomUpDistanceCalculator.CalculateDistance(current, tree) / (current.Length + tree.Length); 107 similarity += 1 - distance; 106 108 } 107 109 }
Note: See TracChangeset
for help on using the changeset viewer.