Changeset 15720


Ignore:
Timestamp:
02/04/18 21:34:23 (19 months ago)
Author:
abeham
Message:

#1614: merged analysis and analysis views from #2457

Location:
branches/1614_GeneralizedQAP
Files:
5 edited
5 copied

Legend:

Unmodified
Added
Removed
  • branches/1614_GeneralizedQAP/HeuristicLab.Analysis

  • branches/1614_GeneralizedQAP/HeuristicLab.Analysis.Views

  • branches/1614_GeneralizedQAP/HeuristicLab.Analysis.Views/3.3/HeatMapView.resx

  • branches/1614_GeneralizedQAP/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj

    r15719 r15720  
    170170    <Compile Include="AlleleFrequencyAnalysis\AlleleFrequencyCollection.cs" />
    171171    <Compile Include="AlleleFrequencyAnalysis\AlleleFrequencyCollectionHistory.cs" />
     172    <Compile Include="BestNScopesSolutionAnalyzer.cs" />
    172173    <Compile Include="BestScopeSolutionAnalyzer.cs" />
    173174    <Compile Include="DataVisualization\GanttData.cs" />
     175    <Compile Include="Clustering\CkMeans1D.cs">
     176      <SubType>Code</SubType>
     177    </Compile>
     178    <Compile Include="Clustering\ClusterHelper.cs" />
    174179    <Compile Include="DataVisualization\IndexedDataRow.cs" />
    175180    <Compile Include="DataVisualization\IndexedDataTable.cs" />
     
    190195    <Compile Include="MultiObjective\RankBasedParetoFrontAnalyzer.cs" />
    191196    <Compile Include="MultiObjective\ParetoFrontAnalyzer.cs" />
     197    <Compile Include="Optimizers\IteratedAlgorithm.cs" />
    192198    <Compile Include="Plugin.cs" />
    193199    <Compile Include="PopulationSimilarityAnalysis\PopulationDiversityAnalyzer.cs" />
     
    206212    <Compile Include="QualityAnalysis\QualityPerEvaluationsAnalyzer.cs" />
    207213    <Compile Include="QualityAnalysis\ScaledQualityDifferenceAnalyzer.cs" />
     214    <Compile Include="SelfOrganizingMaps\RelationalSOM.cs" />
     215    <Compile Include="SelfOrganizingMaps\SOM.cs" />
    208216    <Compile Include="Statistics\BonferroniHolm.cs" />
    209217    <Compile Include="Statistics\EnumerableStatisticsExtension.cs" />
  • branches/1614_GeneralizedQAP/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityDistributionAnalyzer.cs

    r15583 r15720  
    2020#endregion
    2121
    22 using System.Linq;
    2322using HeuristicLab.Common;
    2423using HeuristicLab.Core;
     
    2827using HeuristicLab.Parameters;
    2928using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using System.Collections.Generic;
     30using System.Linq;
    3031
    3132namespace HeuristicLab.Analysis.QualityAnalysis {
     
    3334  [StorableClass]
    3435  public class QualityDistributionAnalyzer : SingleSuccessorOperator, IAnalyzer, IIterationBasedOperator, ISingleObjectiveOperator {
     36    private const string TableDescription = "Shows the quality distributions in the current population.";
    3537
    3638    #region Parameter properties
     
    9395    }
    9496
     97    public static DataTable PrepareTable(string qualityName = "Quality") {
     98      var result = new DataTable("Population Quality Distribution", TableDescription);
     99      result.VisualProperties.XAxisTitle = qualityName;
     100      result.VisualProperties.YAxisTitle = "Frequency";
     101
     102      var row = new DataRow("QualityDistribution");
     103      row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
     104      result.Rows.Add(row);
     105
     106      return result;
     107    }
     108
     109    public static void UpdateTable(DataTable table, IEnumerable<double> qualities) {
     110      var row = table.Rows["QualityDistribution"];
     111      row.Values.Replace(qualities);
     112    }
     113
    95114    public override IOperation Apply() {
    96115      DataTable qualityDistribution = null;
    97       ResultCollection results = ResultsParameter.ActualValue;
    98       string description = "Shows the quality distributions in the current population.";
     116      var results = ResultsParameter.ActualValue;
    99117      if (results.ContainsKey(HistogramName)) {
    100         qualityDistribution = results[HistogramName].Value as DataTable;
     118        qualityDistribution = (DataTable)results[HistogramName].Value;
    101119      } else {
    102         qualityDistribution = new DataTable("Population Quality Distribution", description);
    103         qualityDistribution.VisualProperties.XAxisTitle = QualityParameter.ActualName;
    104         qualityDistribution.VisualProperties.YAxisTitle = "Frequency";
    105         results.Add(new Result(HistogramName, description, qualityDistribution));
     120        qualityDistribution = PrepareTable(QualityParameter.ActualName);
     121        results.Add(new Result(HistogramName, TableDescription, qualityDistribution));
    106122      }
    107       DataRow row;
    108       if (!qualityDistribution.Rows.TryGetValue("QualityDistribution", out row)) {
    109         row = new DataRow("QualityDistribution");
    110         row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
    111         qualityDistribution.Rows.Add(row);
    112       }
    113       var qualities = QualityParameter.ActualValue;
    114       row.Values.Replace(qualities.Select(x => x.Value));
     123
     124      UpdateTable(qualityDistribution, QualityParameter.ActualValue.Select(x => x.Value));
    115125
    116126      if (StoreHistory) {
    117         string historyResultName = HistogramName + " History";
     127        var historyResultName = HistogramName + " History";
    118128        DataTableHistory qdHistory = null;
    119129        if (results.ContainsKey(historyResultName)) {
    120           qdHistory = results[historyResultName].Value as DataTableHistory;
     130          qdHistory = (DataTableHistory)results[historyResultName].Value;
    121131        } else {
    122132          qdHistory = new DataTableHistory();
    123133          results.Add(new Result(historyResultName, qdHistory));
    124134        }
    125         DataTable table = (DataTable)qualityDistribution.Clone();
    126         IntValue iteration = IterationsParameter.ActualValue;
     135        var table = (DataTable)qualityDistribution.Clone();
     136        var iteration = IterationsParameter.ActualValue;
    127137        if (iteration != null) {
    128           string iterationName = IterationsParameter.ActualName;
     138          var iterationName = IterationsParameter.ActualName;
    129139          if (iterationName.EndsWith("s")) iterationName = iterationName.Remove(iterationName.Length - 1);
    130           string appendix = " at " + iterationName + " " + iteration.Value.ToString();
     140          var appendix = " at " + iterationName + " " + iteration.Value.ToString();
    131141          table.Name += appendix;
    132142          table.Rows["QualityDistribution"].VisualProperties.DisplayName += appendix;
Note: See TracChangeset for help on using the changeset viewer.