Changeset 9293
- Timestamp:
- 03/07/13 14:53:43 (11 years ago)
- Location:
- branches/HeuristicLab.EvolutionaryTracking
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj
r9246 r9293 51 51 <DebugType>pdbonly</DebugType> 52 52 <Optimize>true</Optimize> 53 <OutputPath>..\..\..\..\ Trunk\sources\bin\</OutputPath>53 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 54 54 <DefineConstants>TRACE</DefineConstants> 55 55 <ErrorReport>prompt</ErrorReport> -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs
r9246 r9293 23 23 24 24 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { 25 [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.3.92 37")]25 [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.3.9246")] 26 26 [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll", PluginFileType.Assembly)] 27 27 [PluginDependency("HeuristicLab.Analysis", "3.3")] -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r9241 r9293 50 50 <DebugType>pdbonly</DebugType> 51 51 <Optimize>true</Optimize> 52 <OutputPath>..\..\..\..\ Trunk\sources\bin\</OutputPath>52 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 53 53 <DefineConstants>TRACE</DefineConstants> 54 54 <ErrorReport>prompt</ErrorReport> … … 66 66 </PropertyGroup> 67 67 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> 68 <OutputPath> $(SolutionDir)\bin\</OutputPath>68 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 69 69 <DefineConstants>TRACE</DefineConstants> 70 70 <Optimize>true</Optimize> … … 84 84 </PropertyGroup> 85 85 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> 86 <OutputPath> $(SolutionDir)\bin\</OutputPath>86 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 87 87 <DefineConstants>TRACE</DefineConstants> 88 88 <Optimize>true</Optimize> … … 200 200 <Compile Include="Interfaces\ISymbolicDataAnalysisProblem.cs" /> 201 201 <Compile Include="SymbolicDataAnalysisExpressionTreeMatching.cs" /> 202 <Compile Include="SymbolicDataAnalysisExpressionTreeSimilarity.cs" /> 202 203 <Compile Include="SymbolicDataAnalysisModel.cs"> 203 204 <SubType>Code</SubType> -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeMatching.cs
r9249 r9293 161 161 162 162 public static class SymbolicExpressionTreeMatching { 163 public static bool IsSimilarTo(this ISymbolicExpressionTree t1, ISymbolicExpressionTree t2, SymbolicExpressionTreeNodeSimilarityComparer comparer) {164 return t1.Root.IsSimilarTo(t2.Root, comparer);165 }166 public static bool IsSimilarTo(this ISymbolicExpressionTreeNode t1, ISymbolicExpressionTreeNode t2, SymbolicExpressionTreeNodeSimilarityComparer comparer) {167 return Match(t1, t2, comparer) == Math.Min(t1.GetLength(), t2.GetLength());168 }169 163 public static bool ContainsFragment(this ISymbolicExpressionTreeNode root, IFragment fragment, SymbolicExpressionTreeNodeSimilarityComparer comparer) { 170 164 return FindMatches(root, fragment.Root, comparer).Any(); … … 179 173 // below, we use ">=" for Match(n, fragment, comp) >= fragmentLength because in case of relaxed conditions, 180 174 // we can have multiple matches of the same node 175 181 176 return root.IterateNodesBreadth().Where(n => n.GetLength() >= fragmentLength && Match(n, fragment, comp) == fragmentLength); 182 177 } … … 206 201 } 207 202 } 203 204 public class MaximalCommonSubsequenceCalculator { 205 private ISymbolicExpressionTreeNode[] x; 206 private ISymbolicExpressionTreeNode[] y; 207 private List<ISymbolicExpressionTreeNode> maxCommonSubseq; 208 private double[,] matrix; 209 210 public SymbolicExpressionTreeNodeSimilarityComparer comparer; 211 212 public List<ISymbolicExpressionTreeNode> Calculate(ISymbolicExpressionTreeNode n1, ISymbolicExpressionTreeNode n2) { 213 if (comparer == null) throw new Exception("Comparer cannot be null."); 214 215 x = n1.IterateNodesPrefix().ToArray(); 216 y = n2.IterateNodesPrefix().ToArray(); 217 218 if (maxCommonSubseq == null) maxCommonSubseq = new List<ISymbolicExpressionTreeNode>(); 219 else maxCommonSubseq.Clear(); 220 221 int n = x.Length; 222 int m = y.Length; 223 224 matrix = new double[n + 1, m + 1]; 225 226 for (int i = 0; i <= n; ++i) { 227 for (int j = 0; j <= m; ++j) { 228 if (i == 0 || j == 0) { 229 matrix[i, j] = 0; 230 } else if (comparer.Equals(x[i - 1], y[j - 1])) { 231 matrix[i, j] = matrix[i - 1, j - 1] + 1; 232 } else { 233 matrix[i, j] = Math.Max(matrix[i - 1, j], matrix[i, j - 1]); 234 } 235 } 236 } 237 recon(n, m); 238 return new List<ISymbolicExpressionTreeNode>(maxCommonSubseq); 239 } 240 241 private void recon(int i, int j) { 242 if (i == 0 || j == 0) return; 243 if (comparer.Equals(x[i - 1], y[j - 1])) { 244 recon(i - 1, j - 1); 245 maxCommonSubseq.Add(x[i - 1]); 246 } else if (matrix[i - 1, j] > matrix[i, j - 1]) { 247 recon(i - 1, j); 248 } else recon(i, j - 1); 249 } 250 } -
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Tracking.sln
r8557 r9293 1 1 2 Microsoft Visual Studio Solution File, Format Version 1 1.003 # Visual Studio 201 02 Microsoft Visual Studio Solution File, Format Version 12.00 3 # Visual Studio 2012 4 4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4", "HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj", "{06D4A186-9319-48A0-BADE-A2058D462EEA}" 5 5 EndProject … … 20 20 EndProject 21 21 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj", "{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}" 22 EndProject 23 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Optimization.Views-3.3", "HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj", "{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}" 22 24 EndProject 23 25 Global … … 78 80 {1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 79 81 {1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}.Release|Mixed Platforms.Build.0 = Release|Any CPU 80 {1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}.Release|x64.ActiveCfg = Release|Any CPU 82 {1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}.Release|x64.ActiveCfg = Release|x64 83 {1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}.Release|x64.Build.0 = Release|x64 81 84 {1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}.Release|x86.ActiveCfg = Release|Any CPU 82 85 {318DFE8C-CA23-4F1B-A4AC-62B425060241}.Debug|Any CPU.ActiveCfg = Debug|Any CPU … … 90 93 {318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 91 94 {318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|Mixed Platforms.Build.0 = Release|Any CPU 92 {318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|x64.ActiveCfg = Release|Any CPU 95 {318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|x64.ActiveCfg = Release|x64 96 {318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|x64.Build.0 = Release|x64 93 97 {318DFE8C-CA23-4F1B-A4AC-62B425060241}.Release|x86.ActiveCfg = Release|Any CPU 94 98 {3D28463F-EC96-4D82-AFEE-38BE91A0CA00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU … … 108 112 {3D28463F-EC96-4D82-AFEE-38BE91A0CA00}.Release|x86.ActiveCfg = Release|x86 109 113 {3D28463F-EC96-4D82-AFEE-38BE91A0CA00}.Release|x86.Build.0 = Release|x86 114 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 115 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|Any CPU.Build.0 = Debug|Any CPU 116 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 117 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|Mixed Platforms.Build.0 = Debug|x86 118 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|x64.ActiveCfg = Debug|x64 119 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|x64.Build.0 = Debug|x64 120 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|x86.ActiveCfg = Debug|x86 121 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Debug|x86.Build.0 = Debug|x86 122 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|Any CPU.ActiveCfg = Release|Any CPU 123 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|Any CPU.Build.0 = Release|Any CPU 124 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|Mixed Platforms.ActiveCfg = Release|x86 125 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|Mixed Platforms.Build.0 = Release|x86 126 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|x64.ActiveCfg = Release|x64 127 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|x64.Build.0 = Release|x64 128 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|x86.ActiveCfg = Release|x86 129 {662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}.Release|x86.Build.0 = Release|x86 110 130 EndGlobalSection 111 131 GlobalSection(SolutionProperties) = preSolution 112 132 HideSolutionNode = FALSE 113 133 EndGlobalSection 134 GlobalSection(Performance) = preSolution 135 HasPerformanceSessions = true 136 EndGlobalSection 114 137 EndGlobal
Note: See TracChangeset
for help on using the changeset viewer.