Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/03/12 11:22:21 (13 years ago)
Author:
gkronber
Message:

#1081: merged r7214:7266 from trunk into time series branch.

Location:
branches/HeuristicLab.TimeSeries
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries

  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Analyzers/MinAverageMaxSymbolicExpressionTreeLengthAnalyzer.cs

    r7213 r7268  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Analyzers/SymbolicExpressionSymbolFrequencyAnalyzer.cs

    r7213 r7268  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Analyzers/SymbolicExpressionTreeLengthAnalyzer.cs

    r7213 r7268  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using HeuristicLab.Analysis;
     
    9091    private SymbolicExpressionTreeLengthAnalyzer(SymbolicExpressionTreeLengthAnalyzer original, Cloner cloner)
    9192      : base(original, cloner) {
    92       AfterDeserialization();
    9393    }
    9494    public override IDeepCloneable Clone(Cloner cloner) {
     
    106106      Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called since the last update", new IntValue(0)));
    107107
    108       AfterDeserialization();
     108      SymbolicExpressionTreeLengthsParameter.Hidden = true;
     109      SymbolicExpressionTreeLengthsHistoryParameter.Hidden = true;
     110      ResultsParameter.Hidden = true;
     111      UpdateCounterParameter.Hidden = true;
    109112    }
    110113
     
    118121        Parameters.Add(new ValueParameter<IntValue>(UpdateIntervalParameterName, "The interval in which the tree length analysis should be applied.", new IntValue(1)));
    119122      }
    120       if (Parameters.ContainsKey(UpdateCounterParameterName))
    121         Parameters.Remove(UpdateCounterParameterName);
    122       Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called since the last update", new IntValue(0)));
    123 
    124       SymbolicExpressionTreeLengthsParameter.Hidden = true;
    125       SymbolicExpressionTreeLengthsHistoryParameter.Hidden = true;
    126       ResultsParameter.Hidden = true;
    127       UpdateCounterParameter.Hidden = true;
    128     }
     123      if (!Parameters.ContainsKey(UpdateCounterParameterName)) {
     124        Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called since the last update", new IntValue(0)));
     125        UpdateCounterParameter.Hidden = true;
     126      }
     127    }
     128
     129    #region IStatefulItem members
     130    public override void InitializeState() {
     131      base.InitializeState();
     132      UpdateCounter.Value = 0;
     133    }
     134    public override void ClearState() {
     135      base.ClearState();
     136      UpdateCounter.Value = 0;
     137    }
     138    #endregion
    129139
    130140    public override IOperation Apply() {
     
    201211        treeLengthsTable.VisualProperties.YAxisMaximumAuto = false;
    202212        treeLengthsTable.VisualProperties.YAxisMinimumFixedValue = 0.0;
    203         int maxFreq = solutions.GroupBy(s => s.Length).Max(g => g.Count());
     213        int maxFreq = (int)Math.Round(solutions.GroupBy(s => s.Length).Max(g => g.Count()) / treeLengthsTableRow.VisualProperties.ScaleFactor);
    204214        if (maxFreq % 5 != 0)
    205215          maxFreq += (5 - maxFreq % 5);
     
    221231
    222232        if (storeHistory) {
    223           // store tree lengths for each generation
    224           var historyDataRow = new DataRow("Tree lengths", "", treeLengthsTableRow.Values);
    225           historyDataRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
    226           historyDataRow.VisualProperties.ExactBins = false;
    227           historyDataRow.VisualProperties.Bins = range;
    228           historyDataRow.VisualProperties.ScaleFactor = treeLengthsTableRow.VisualProperties.ScaleFactor;
    229           historyDataRow.VisualProperties.IsVisibleInLegend = false;
    230           var historyTable = new DataTable("Tree lengths");
    231           historyTable.Rows.Add(historyDataRow);
    232           // visual properties for the X-axis
    233           historyTable.VisualProperties.XAxisMinimumAuto = false;
    234           historyTable.VisualProperties.XAxisMaximumAuto = false;
    235           historyTable.VisualProperties.XAxisMinimumFixedValue = 0.0;
    236           if (maxLength > maximumAllowedTreeLength + 1)
    237             historyTable.VisualProperties.XAxisMaximumFixedValue = maxLength + 1; // +1 so the histogram column for the maximum length won't get trimmed
    238           else
    239             historyTable.VisualProperties.XAxisMaximumFixedValue = maximumAllowedTreeLength + 1;
    240           historyTable.VisualProperties.XAxisTitle = xAxisTitle;
    241           // visual properties for the Y-axis
    242           historyTable.VisualProperties.YAxisMinimumAuto = false;
    243           historyTable.VisualProperties.YAxisMaximumAuto = false;
    244           historyTable.VisualProperties.YAxisMinimumFixedValue = 0.0;
    245           historyTable.VisualProperties.YAxisMaximumFixedValue = yAxisMaximumFixedValue;
    246           historyTable.VisualProperties.YAxisTitle = yAxisTitle;
    247 
    248233          var treeLengthsHistory = SymbolicExpressionTreeLengthsHistoryParameter.ActualValue;
    249234          if (treeLengthsHistory == null) {
     
    251236            SymbolicExpressionTreeLengthsHistoryParameter.ActualValue = treeLengthsHistory;
    252237          }
    253 
    254           treeLengthsHistory.Add(historyTable);
     238          treeLengthsHistory.Add((DataTable)treeLengthsTable.Clone());
    255239
    256240          if (!results.ContainsKey(treeLengthHistoryTableName)) {
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Analyzers/SymbolicExpressionTreeLengthCalculator.cs

    r5809 r7268  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
Note: See TracChangeset for help on using the changeset viewer.