Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7150


Ignore:
Timestamp:
12/07/11 17:25:12 (13 years ago)
Author:
bburlacu
Message:

#1661: Simplified the Y-axis scaling, removed generations counter, hid some parameters and renamed the history data table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Analyzers/SymbolicExpressionTreeLengthAnalyzer.cs

    r7147 r7150  
    4646    private const string UpdateIntervalParameterName = "UpdateInterval";
    4747    private const string UpdateCounterParameterName = "UpdateCounter";
    48     private const string GenerationCounterParameterName = "GenerationCounter";
    4948
    5049    #region Parameter properties
     
    7170      get { return (ValueParameter<IntValue>)Parameters[UpdateCounterParameterName]; }
    7271    }
    73     public ValueParameter<IntValue> GenerationCounterParameter {
    74       get { return (ValueParameter<IntValue>)Parameters[GenerationCounterParameterName]; }
    75     }
    7672    #endregion
    7773
     
    8682      get { return StoreHistoryParameter.Value; }
    8783    }
    88     public IntValue GenerationCounter {
    89       get { return GenerationCounterParameter.Value; }
    90     }
    91 
    9284    #endregion
    9385
     
    111103      Parameters.Add(new ValueParameter<IntValue>(UpdateIntervalParameterName, "The interval in which the tree length analysis should be applied.", new IntValue(1)));
    112104      Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called since the last update", new IntValue(0)));
    113       Parameters.Add(new ValueParameter<IntValue>(GenerationCounterParameterName, "The value of the total number of generations this operator has been applied.", new IntValue(0)));
    114 
    115       UpdateCounterParameter.Hidden = true;
    116105
    117106      AfterDeserialization();
     
    130119        Parameters.Remove(UpdateCounterParameterName);
    131120      Parameters.Add(new ValueParameter<IntValue>(UpdateCounterParameterName, "The value which counts how many times the operator was called since the last update", new IntValue(0)));
    132       if (!Parameters.ContainsKey(GenerationCounterParameterName)) {
    133         Parameters.Add(new ValueParameter<IntValue>(GenerationCounterParameterName, "The value of the total number of generations this operator has been applied.", new IntValue(1)));
    134       }
     121
     122      SymbolicExpressionTreeLengthsParameter.Hidden = true;
     123      SymbolicExpressionTreeLengthsHistoryParameter.Hidden = true;
     124      ResultsParameter.Hidden = true;
     125      UpdateCounterParameter.Hidden = true;
    135126    }
    136127
    137128    public override IOperation Apply() {
    138       //IntValue updateCounter = UpdateCounterParameter.Value;
    139       // if the counter doesn't exist yet, we initialize it here with the current update interval
    140       GenerationCounter.Value++;
    141129      UpdateCounter.Value++;
    142 
    143130      // the analyzer runs periodically, every 'updateInterval' times
    144131      if (UpdateCounter.Value == UpdateInterval.Value) {
     
    213200        treeLengthsTable.VisualProperties.YAxisMinimumFixedValue = 0.0;
    214201        int maxFreq = solutions.GroupBy(s => s.Length).Max(g => g.Count());
    215         double yAxisMaximumFixedValue = Math.Ceiling(solutions.Length / 2.0) > maxFreq ? Math.Ceiling(solutions.Length / 2.0) : maxFreq;
    216         // round up yAxisMaximumFixedValue to the nearest multiple of 5, so it would look nice in the chart
    217         yAxisMaximumFixedValue = yAxisMaximumFixedValue + 5 - ((int)yAxisMaximumFixedValue % 5);
     202        if (maxFreq % 5 != 0)
     203          maxFreq += (5 - maxFreq % 5);
     204        double yAxisMaximumFixedValue = maxFreq;
    218205
    219206        treeLengthsTable.VisualProperties.YAxisMaximumFixedValue = yAxisMaximumFixedValue;
     
    230217        bool storeHistory = StoreHistoryParameter.Value.Value;
    231218        const string treeLengthHistoryTableName = "Tree lengths history";
    232         const string treeLengthHistoryRowPrefix = "Tree lengths ";
    233219
    234220        if (storeHistory) {
    235221          // store tree lengths for each generation
    236           var historyDataRow = new DataRow(treeLengthHistoryRowPrefix + GenerationCounter.Value, "Symbolic expression tree lengths at generation " + GenerationCounter.Value, treeLengthsTableRow.Values);
     222          var historyDataRow = new DataRow("Tree lengths", "", treeLengthsTableRow.Values);
    237223          historyDataRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
    238224          historyDataRow.VisualProperties.ExactBins = false;
    239225          historyDataRow.VisualProperties.Bins = range;
    240226          historyDataRow.VisualProperties.ScaleFactor = treeLengthsTableRow.VisualProperties.ScaleFactor;
    241           var historyTable = new DataTable();
     227          historyDataRow.VisualProperties.IsVisibleInLegend = false;
     228          var historyTable = new DataTable("Tree lengths");
    242229          historyTable.Rows.Add(historyDataRow);
    243230          // visual properties for the X-axis
Note: See TracChangeset for help on using the changeset viewer.