Index: /trunk/sources/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj
===================================================================
--- /trunk/sources/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj (revision 6980)
+++ /trunk/sources/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj (revision 6981)
@@ -124,4 +124,5 @@
+
Index: /trunk/sources/HeuristicLab.Common/3.3/NaturalStringComparer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Common/3.3/NaturalStringComparer.cs (revision 6981)
+++ /trunk/sources/HeuristicLab.Common/3.3/NaturalStringComparer.cs (revision 6981)
@@ -0,0 +1,49 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
+
+namespace HeuristicLab.Common {
+ public class NaturalStringComparer : IComparer {
+ public int Compare(string x, string y) {
+ if (x == y) return 0;
+
+ string[] first = Regex.Split(x, "([0-9]+)");
+ string[] second = Regex.Split(y, "([0-9]+)");
+
+ for (int i = 0; i < first.Length && i < second.Length; i++) {
+ if (first[i] != second[i]) return CompareWithParsing(first[i], second[i]);
+ }
+
+ if (first.Length < second.Length) return -1;
+ if (second.Length < first.Length) return 1;
+ return 0;
+ }
+
+ private int CompareWithParsing(string x, string y) {
+ int first, second;
+ if (int.TryParse(x, out first) && int.TryParse(y, out second))
+ return first.CompareTo(second);
+ return x.CompareTo(y);
+ }
+ }
+}
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs (revision 6980)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs (revision 6981)
@@ -23,13 +23,12 @@
using System.Collections.Generic;
using System.Linq;
+using HeuristicLab.Analysis;
using HeuristicLab.Common;
using HeuristicLab.Core;
using HeuristicLab.Data;
using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Operators;
using HeuristicLab.Optimization;
using HeuristicLab.Parameters;
using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Analysis;
namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
@@ -139,5 +138,5 @@
double totalNumberOfSymbols = variableFrequencies.Values.Sum();
- foreach (var pair in variableFrequencies)
+ foreach (var pair in variableFrequencies.OrderBy(p => p.Key, new NaturalStringComparer()))
yield return new KeyValuePair(pair.Key, pair.Value / totalNumberOfSymbols);
}