Index: /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj
===================================================================
--- /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj (revision 14420)
+++ /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj (revision 14421)
@@ -98,119 +98,105 @@
-
- UserControl
-
+
+ UserControl
+
+
+ PreprocessingFeatureCorrelationView.cs
+
+
+ UserControl
+
+
+ CheckedFilterCollectionView.cs
+
+
+ UserControl
+
+
+ CheckedTransformationListView.cs
+
+
+ UserControl
+
+
+ ComparisonFilterView.cs
+
+
+ Form
+
+
+ RenameColumnsDialog.cs
+
+
+ UserControl
+
+
+ ScatterPlotSingleView.cs
+
+
+ UserControl
+
+
+ DataCompletenessView.cs
+
+
+ UserControl
+
+
+ DataGridContentView.cs
+
+
+ UserControl
+
+
+ DataPreprocessingView.cs
+
+
+
+ UserControl
+
+
+ PreprocessingDataTableView.cs
+
+
+ UserControl
+
+
+ FilterView.cs
+
+
+
+ ScatterPlotMultiView.cs
+
+
+ UserControl
+
+
+ PreprocessingScatterPlotView.cs
+
+
+ Form
+
+
+ SearchAndReplaceDialog.cs
+
+
+
+ HistogramView.cs
+
+
+
+ LineChartView.cs
+
+
+ UserControl
+
+
+ ManipulationView.cs
+
+
+
PreprocessingChartView.cs
-
-
- UserControl
-
-
- PreprocessingFeatureCorrelationView.cs
-
-
- UserControl
-
-
- CheckedFilterCollectionView.cs
-
-
- UserControl
-
-
- CheckedTransformationListView.cs
-
-
- UserControl
-
-
- ComparisonFilterView.cs
-
-
- Form
-
-
- RenameColumnsDialog.cs
-
-
- UserControl
-
-
- ScatterPlotSingleView.cs
-
-
- UserControl
-
-
- DataCompletenessView.cs
-
-
- UserControl
-
-
- DataGridContentView.cs
-
-
- UserControl
-
-
- DataPreprocessingView.cs
-
-
-
- UserControl
-
-
- PreprocessingDataTableView.cs
-
-
- UserControl
-
-
- FilterView.cs
-
-
- UserControl
-
-
- ScatterPlotMultiView.cs
-
-
- UserControl
-
-
- PreprocessingScatterPlotView.cs
-
-
- Form
-
-
- SearchAndReplaceDialog.cs
-
-
- UserControl
-
-
- HistogramView.cs
-
-
- UserControl
-
-
- LineChartView.cs
-
-
- UserControl
-
-
- ManipulationView.cs
-
-
-
- UserControl
-
-
- PreprocessingCheckedVariablesView.cs
Index: /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs
===================================================================
--- /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs (revision 14420)
+++ /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs (revision 14421)
@@ -61,4 +61,13 @@
InitData();
GenerateChart();
+
+ foreach (var row in dataRows) {
+ string variableName = row.Name;
+ if (!IsVariableChecked(variableName)) {
+ dataTableView.SetRowEnabled(variableName, false);
+ dataTable.SelectedRows.Remove(variableName);
+ dataTablePerVariable.Remove(dataTablePerVariable.Find(x => (x.Name == variableName)));
+ }
+ }
}
}
@@ -71,17 +80,14 @@
//add data rows to data tables according to checked item list
- foreach (var checkedItem in Content.VariableItemList.CheckedItems) {
- string variableName = Content.VariableItemList[checkedItem.Index].Value;
+ foreach (var row in dataRows) {
+ string variableName = row.Name;
+
+ //add row to data table
+ dataTable.Rows.Add(row);
+
+ //add row to data table per variable
PreprocessingDataTable d = new PreprocessingDataTable(variableName);
- DataRow row = GetDataRow(variableName);
-
- if (row != null) {
- //add row to data table
- dataTable.Rows.Add(row);
-
- //add row to data table per variable
- d.Rows.Add(row);
- dataTablePerVariable.Add(d);
- }
+ d.Rows.Add(row);
+ dataTablePerVariable.Add(d);
}
@@ -95,10 +101,12 @@
string variableName = item.Value.Value;
- // not checked -> remove
+
if (!IsVariableChecked(variableName)) {
+ // not checked -> remove
dataTableView.SetRowEnabled(variableName, false);
dataTable.SelectedRows.Remove(variableName);
dataTablePerVariable.Remove(dataTablePerVariable.Find(x => (x.Name == variableName)));
} else {
+ // checked -> add
DataRow row = GetDataRow(variableName);
DataRow selectedRow = GetSelectedDataRow(variableName);
Index: /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.cs
===================================================================
--- /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.cs (revision 14420)
+++ /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.cs (revision 14421)
@@ -56,8 +56,11 @@
if (Content.VariableItemList == null) {
- Content.VariableItemList = Content.CreateVariableItemList();
+ IList inputs = Content.PreprocessingData.InputVariables;
+ if (Content.PreprocessingData.TargetVariable != null)
+ inputs = inputs.Union(new[] {Content.PreprocessingData.TargetVariable}).ToList();
+ Content.VariableItemList = Content.CreateVariableItemList(inputs);
} else {
var checkedNames = Content.VariableItemList.CheckedItems.Select(x => x.Value.Value);
- Content.VariableItemList = Content.CreateVariableItemList(checkedNames);
+ Content.VariableItemList = Content.CreateVariableItemList(checkedNames.ToList());
}
Content.VariableItemList.CheckedItemsChanged += CheckedItemsChanged;
Index: /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs
===================================================================
--- /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs (revision 14420)
+++ /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs (revision 14421)
@@ -23,5 +23,4 @@
using System.Collections.Generic;
using System.Drawing;
-using System.Linq;
using HeuristicLab.Analysis;
using HeuristicLab.Common;
@@ -126,9 +125,10 @@
- public ICheckedItemList CreateVariableItemList(IEnumerable checkedItems = null) {
+ public ICheckedItemList CreateVariableItemList(IList checkedItems = null) {
+ if (checkedItems == null) checkedItems = new string[0];
ICheckedItemList itemList = new CheckedItemList();
foreach (string name in PreprocessingData.GetDoubleVariableNames()) {
var n = new StringValue(name);
- itemList.Add(n, (checkedItems == null) ? true : checkedItems.Contains(name));
+ itemList.Add(n, checkedItems.Contains(name));
}
return new ReadOnlyCheckedItemList(itemList);
Index: /branches/symbreg-factors-2650/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HammingSimilarityCalculator.cs
===================================================================
--- /branches/symbreg-factors-2650/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HammingSimilarityCalculator.cs (revision 14421)
+++ /branches/symbreg-factors-2650/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HammingSimilarityCalculator.cs (revision 14421)
@@ -0,0 +1,66 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 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;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Optimization.Operators;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Encodings.BinaryVectorEncoding {
+ [Item("Hamming Similarity Calculator for BinaryVector", "Calculates the solution similarity based on the Hamming distance between two binary vectors.")]
+ [StorableClass]
+ public sealed class HammingSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
+ protected override bool IsCommutative {
+ get { return true; }
+ }
+
+ [StorableConstructor]
+ private HammingSimilarityCalculator(bool deserializing) : base(deserializing) { }
+ private HammingSimilarityCalculator(HammingSimilarityCalculator original, Cloner cloner) : base(original, cloner) { }
+ public HammingSimilarityCalculator() { }
+
+ public override IDeepCloneable Clone(Cloner cloner) {
+ return new HammingSimilarityCalculator(this, cloner);
+ }
+
+ public static double CalculateSimilarity(BinaryVector left, BinaryVector right) {
+ if (left == null || right == null)
+ throw new ArgumentException("Cannot calculate similarity because one or both of the provided scopes is null.");
+ if (left.Length != right.Length)
+ throw new ArgumentException("Cannot calculate similarity because the provided solutions have different lengths.");
+ if (left == right) return 1.0;
+
+ double similarity = 0.0;
+ for (int i = 0; i < left.Length; i++)
+ if (left[i] == right[i]) similarity++;
+ return similarity / left.Length;
+
+ }
+
+ public override double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution) {
+ var left = leftSolution.Variables[SolutionVariableName].Value as BinaryVector;
+ var right = rightSolution.Variables[SolutionVariableName].Value as BinaryVector;
+
+ return CalculateSimilarity(left, right);
+ }
+ }
+}
Index: /branches/symbreg-factors-2650/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj
===================================================================
--- /branches/symbreg-factors-2650/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj (revision 14420)
+++ /branches/symbreg-factors-2650/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/HeuristicLab.Encodings.BinaryVectorEncoding-3.3.csproj (revision 14421)
@@ -126,4 +126,5 @@
+
Index: /branches/symbreg-factors-2650/HeuristicLab.Problems.Binary/3.3/BinaryProblem.cs
===================================================================
--- /branches/symbreg-factors-2650/HeuristicLab.Problems.Binary/3.3/BinaryProblem.cs (revision 14420)
+++ /branches/symbreg-factors-2650/HeuristicLab.Problems.Binary/3.3/BinaryProblem.cs (revision 14421)
@@ -24,4 +24,5 @@
using System;
using System.Linq;
+using HeuristicLab.Analysis;
using HeuristicLab.Common;
using HeuristicLab.Core;
@@ -29,4 +30,5 @@
using HeuristicLab.Encodings.BinaryVectorEncoding;
using HeuristicLab.Optimization;
+using HeuristicLab.Optimization.Operators;
using HeuristicLab.Parameters;
using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -61,4 +63,8 @@
Parameters.Add(lengthParameter);
Encoding.LengthParameter = lengthParameter;
+ Operators.Add(new HammingSimilarityCalculator());
+ Operators.Add(new QualitySimilarityCalculator());
+ Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType()));
+ Parameterize();
RegisterEventHandlers();
}
@@ -87,6 +93,13 @@
base.OnEncodingChanged();
Encoding.LengthParameter = LengthParameter;
+ Parameterize();
}
+ private void Parameterize() {
+ foreach (var similarityCalculator in Operators.OfType()) {
+ similarityCalculator.SolutionVariableName = Encoding.SolutionCreator.BinaryVectorParameter.ActualName;
+ similarityCalculator.QualityVariableName = Evaluator.QualityParameter.ActualName;
+ }
+ }
private void RegisterEventHandlers() {
Index: /branches/symbreg-factors-2650/HeuristicLab.Problems.Binary/3.3/HeuristicLab.Problems.Binary-3.3.csproj
===================================================================
--- /branches/symbreg-factors-2650/HeuristicLab.Problems.Binary/3.3/HeuristicLab.Problems.Binary-3.3.csproj (revision 14420)
+++ /branches/symbreg-factors-2650/HeuristicLab.Problems.Binary/3.3/HeuristicLab.Problems.Binary-3.3.csproj (revision 14421)
@@ -96,4 +96,9 @@
+
+ {887425B4-4348-49ED-A457-B7D2C26DDBF9}
+ HeuristicLab.Analysis-3.3
+ False
+
{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}
@@ -124,4 +129,9 @@
{23da7ff4-d5b8-41b6-aa96-f0561d24f3ee}
HeuristicLab.Operators-3.3
+ False
+
+
+ {25087811-f74c-4128-bc86-8324271da13e}
+ HeuristicLab.Optimization.Operators-3.3
False
@@ -163,5 +173,5 @@
$SolutionDir/PreBuildEvent.sh
-
+