Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/CrossoverPerformanceAnalyzer.cs
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/CrossoverPerformanceAnalyzer.cs (revision 8336)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/CrossoverPerformanceAnalyzer.cs (revision 8336)
@@ -0,0 +1,148 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Analysis.AlgorithmBehavior.Analyzers {
+ [Item("CrossoverPerformanceAnalyzer", "An operator that analyzes the performance of crossovers.")]
+ [StorableClass]
+ public class CrossoverPerformanceAnalyzer : SingleSuccessorOperator, IAnalyzer {
+ private const string ResultsParameterName = "Results";
+ private const string GenerationsParameterName = "Generations";
+
+ #region IAnalyzer Members
+ public bool EnabledByDefault {
+ get { return true; }
+ }
+ #endregion
+
+
+ #region Parameter properties
+ public ILookupParameter ResultsParameter {
+ get { return (ILookupParameter)Parameters[ResultsParameterName]; }
+ }
+ public ILookupParameter GenerationsParameter {
+ get { return (ILookupParameter)Parameters[GenerationsParameterName]; }
+ }
+ public ILookupParameter> ParentsParameter {
+ get { return (ScopeTreeLookupParameter)Parameters["Parents"]; }
+ }
+ public ILookupParameter> ParentsQualityParameter {
+ get { return (ScopeTreeLookupParameter)Parameters["ParentsQuality"]; }
+ }
+ public ILookupParameter ChildParameter {
+ get { return ((LookupParameter)Parameters["Child"]); }
+ }
+ public ILookupParameter QualityParameter {
+ get { return (ILookupParameter)Parameters["Quality"]; }
+ }
+ #endregion
+
+ #region Properties
+ public ResultCollection Results {
+ get { return ResultsParameter.ActualValue; }
+ }
+ #endregion
+
+ ScatterPlot plot;
+ int cnt = 0;
+
+ [StorableConstructor]
+ private CrossoverPerformanceAnalyzer(bool deserializing) : base(deserializing) { }
+ private CrossoverPerformanceAnalyzer(CrossoverPerformanceAnalyzer original, Cloner cloner) : base(original, cloner) { }
+ public CrossoverPerformanceAnalyzer()
+ : base() {
+ Parameters.Add(new LookupParameter(ResultsParameterName, "The results collection where the analysis values should be stored."));
+ Parameters.Add(new LookupParameter(GenerationsParameterName, "Nr of generations."));
+
+ Parameters.Add(new ScopeTreeLookupParameter("Parents", "The parent permutations which have been crossed."));
+ ParentsParameter.ActualName = "TSPTour";
+
+ Parameters.Add(new LookupParameter("Child", "The child permutation resulting from the crossover."));
+ ChildParameter.ActualName = "TSPTour";
+
+ Parameters.Add(new ScopeTreeLookupParameter("ParentsQuality", "The quality of the parent solutions."));
+ ParentsQualityParameter.ActualName = "TSPTourLength";
+
+ Parameters.Add(new LookupParameter("Quality", "The evaluated quality of the child solution."));
+ QualityParameter.ActualName = "TSPTourLength";
+ }
+
+ public override IDeepCloneable Clone(Cloner cloner) {
+ return new CrossoverPerformanceAnalyzer(this, cloner);
+ }
+
+ public override IOperation Apply() {
+ var qualityParent1 = ParentsQualityParameter.ActualValue.First().Value;
+ var qualityParent2 = ParentsQualityParameter.ActualValue.Last().Value;
+ Point2D curPoint;
+
+ double worseQuality = qualityParent1 > qualityParent2 ? qualityParent1 : qualityParent2;
+ curPoint = new Point2D(cnt++, worseQuality - QualityParameter.ActualValue.Value);
+
+ string curGenStr = GenerationsParameter.ActualValue.Value.ToString();
+ ScatterPlotDataRow row;
+
+ if (!Results.ContainsKey("Scatter Plot")) {
+ InitializePlot();
+ Results.Add(new Result("Scatter Plot", plot));
+ Results.Add(new Result("Scatter Plot History", new ScatterPlotHistory()));
+ cnt = 0;
+ }
+
+ if (!plot.Rows.ContainsKey(curGenStr)) {
+ if (GenerationsParameter.ActualValue.Value != 0) {
+ ((ScatterPlotHistory)Results["Scatter Plot History"].Value).Add(plot);
+ InitializePlot();
+ Results["Scatter Plot"].Value = plot;
+ cnt = 0;
+ }
+
+ var points = new List>();
+ points.Add(curPoint);
+ row = new ScatterPlotDataRow(curGenStr, null, points);
+ row.VisualProperties.PointStyle = ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Circle;
+ row.VisualProperties.PointSize = 5;
+ plot.Rows.Add(row);
+ } else {
+ plot.Rows[curGenStr].Points.Add(curPoint);
+ }
+
+ return base.Apply();
+ }
+
+ private void InitializePlot() {
+ plot = new ScatterPlot("Crossover Performance", null);
+ plot.VisualProperties.XAxisTitle = "Solution Index";
+ plot.VisualProperties.YAxisTitle = "Absolut Quality Difference";
+ }
+ }
+}
Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj (revision 8336)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj (revision 8336)
@@ -0,0 +1,128 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {2533D1F9-F7F6-46CB-90D2-76D254E38DEE}
+ Library
+ Properties
+ HeuristicLab.Analysis.AlgorithmBehavior.Analyzers
+ HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3
+ v4.0
+ 512
+
+
+ true
+ full
+ false
+ ..\..\..\..\trunk\sources\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ ..\..\..\..\trunk\sources\bin\
+ TRACE
+ prompt
+ 4
+
+
+ true
+
+
+ HeuristicLab.snk
+
+
+
+ False
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll
+ False
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll
+ False
+
+
+ False
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll
+ False
+
+
+ False
+
+
+ False
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll
+ False
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll
+ False
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll
+ False
+
+
+ ..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll
+ False
+
+
+ False
+
+
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {1F75CEA3-464F-4A6F-B2F0-04B9841EBC16}
+ HeuristicLab.Analysis.AlgorithmBehavior-3.3
+
+
+
+
+
+
+
+
+ set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+
+
+
+
Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/Plugin.cs.frame
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/Plugin.cs.frame (revision 8336)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/Plugin.cs.frame (revision 8336)
@@ -0,0 +1,38 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Analysis.AlgorithmBehavior.Analyzers {
+ [Plugin("HeuristicLab.Analysis.AlgorithmBehavior.Analyzers", "Provides operators and related classes for tracking the evolution within a GA.", "3.3.6.$WCREV$")]
+ [PluginFile("HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.dll", PluginFileType.Assembly)]
+ [PluginDependency("HeuristicLab.Collections", "3.3")]
+ [PluginDependency("HeuristicLab.Common", "3.3")]
+ [PluginDependency("HeuristicLab.Core", "3.3")]
+ [PluginDependency("HeuristicLab.Data", "3.3")]
+ [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3")]
+ [PluginDependency("HeuristicLab.Operators", "3.3")]
+ [PluginDependency("HeuristicLab.Optimization", "3.3")]
+ [PluginDependency("HeuristicLab.Parameters", "3.3")]
+ [PluginDependency("HeuristicLab.Persistence", "3.3")]
+ public class HeuristicLabAnalysisAlgorithmBehaviorAnalyzers : PluginBase {
+ }
+}
Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/Properties/AssemblyInfo.cs.frame (revision 8336)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/Properties/AssemblyInfo.cs.frame (revision 8336)
@@ -0,0 +1,56 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.Analysis.AlgorithmBehavior")]
+[assembly: AssemblyDescription("Provides operators and related classes for tracking the evolution within a GA.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2012 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("410e1c1e-c991-49cd-843d-35a741927e4d")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("3.3.0.0")]
+[assembly: AssemblyFileVersion("3.3.6.$WCREV$")]
Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.sln
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.sln (revision 8335)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.sln (revision 8336)
@@ -13,4 +13,6 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Selection-3.3", "HeuristicLab.Selection\3.3\HeuristicLab.Selection-3.3.csproj", "{2C36CD4F-E5F5-43A4-801A-201EA895FE17}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3", "HeuristicLab.Analysis.AlgorithmBehavior.Analyzers\3.3\HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj", "{2533D1F9-F7F6-46CB-90D2-76D254E38DEE}"
EndProject
Global
@@ -52,4 +54,12 @@
{2C36CD4F-E5F5-43A4-801A-201EA895FE17}.Release|x86.ActiveCfg = Release|x86
{2C36CD4F-E5F5-43A4-801A-201EA895FE17}.Release|x86.Build.0 = Release|x86
+ {2533D1F9-F7F6-46CB-90D2-76D254E38DEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2533D1F9-F7F6-46CB-90D2-76D254E38DEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2533D1F9-F7F6-46CB-90D2-76D254E38DEE}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {2533D1F9-F7F6-46CB-90D2-76D254E38DEE}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {2533D1F9-F7F6-46CB-90D2-76D254E38DEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2533D1F9-F7F6-46CB-90D2-76D254E38DEE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2533D1F9-F7F6-46CB-90D2-76D254E38DEE}.Release|x64.ActiveCfg = Release|Any CPU
+ {2533D1F9-F7F6-46CB-90D2-76D254E38DEE}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/Analyzers/AlleleOccurencesInGenerationsPerIndAnalyzer.cs
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/Analyzers/AlleleOccurencesInGenerationsPerIndAnalyzer.cs (revision 8335)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/Analyzers/AlleleOccurencesInGenerationsPerIndAnalyzer.cs (revision 8336)
@@ -104,4 +104,6 @@
for (int i = 0; i < GenerationsParameter.ActualValue.Value; i++) {
var individuals = graph.Values.Where(x => x.Rank.Contains(i));
+ var others = graph.Values.Where(x => x.Rank.Contains(i - 0.5));
+ var others2 = graph.Values.Where(x => x.Rank.Contains(i + 0.5));
List qualitiesInGen = new List();
foreach (var individual in individuals) {
@@ -109,4 +111,5 @@
}
+ points.Clear();
foreach (var individual in individuals) {
var ind = (IntArray)individual.Data;
@@ -122,5 +125,4 @@
double qualityRange = Math.Abs(qualitiesInGen.Max() - qualitiesInGen.Min());
points.Add(new Point2D(cnt, Math.Abs(curQuality - qualitiesInGen.Min()) / qualityRange));
-
}
Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/HeuristicLab.Analysis.AlgorithmBehavior-3.3.csproj
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/HeuristicLab.Analysis.AlgorithmBehavior-3.3.csproj (revision 8335)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/HeuristicLab.Analysis.AlgorithmBehavior-3.3.csproj (revision 8336)
@@ -104,4 +104,5 @@
+
Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/SimplePermutationEqualityComparer.cs
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/SimplePermutationEqualityComparer.cs (revision 8336)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior/3.3/SimplePermutationEqualityComparer.cs (revision 8336)
@@ -0,0 +1,42 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+
+namespace HeuristicLab.Analysis.AlgorithmBehavior {
+ public class SimplePermutationEqualityComparer : EqualityComparer {
+ public override bool Equals(Permutation x, Permutation y) {
+ if (object.ReferenceEquals(x, y)) return true;
+ if (x == null || y == null || x.Length != y.Length) return false;
+ bool match = true;
+ for (int i = 0; i < x.Length && match; i++) // check normal tour
+ if (x[i] != y[i]) match = false;
+
+ return match;
+ }
+
+ public override int GetHashCode(Permutation obj) {
+ return 0; // return the same hash code for each object, otherwise Equals will not be called
+ }
+ }
+}