Changeset 3662 for trunk/sources/HeuristicLab.Analysis
- Timestamp:
- 05/06/10 02:46:37 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Analysis/3.3
- Files:
-
- 1 added
- 3 deleted
- 4 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis/3.3/BestAverageWorstQualityAnalyzer.cs
r3659 r3662 20 20 #endregion 21 21 22 using System; 23 using HeuristicLab.Common; 22 24 using HeuristicLab.Core; 23 25 using HeuristicLab.Data; … … 30 32 namespace HeuristicLab.Analysis { 31 33 /// <summary> 32 /// An operator which analyzes the best, average and worst solution quality in the current population.34 /// An operator which analyzes the best, average and worst quality of solutions in the scope tree. 33 35 /// </summary> 34 [Item(" PopulationBestAverageWorstQualityAnalyzer", "An operator which analyzes the best, average and worst solution quality in the current population.")]36 [Item("BestAverageWorstQualityAnalyzer", "An operator which analyzes the best, average and worst quality of solutions in the scope tree.")] 35 37 [StorableClass] 36 public sealed class PopulationBestAverageWorstQualityAnalyzer : AlgorithmOperator, IAnalyzer {38 public sealed class BestAverageWorstQualityAnalyzer : AlgorithmOperator, IAnalyzer { 37 39 #region Parameter properties 38 40 public ValueLookupParameter<BoolValue> MaximizationParameter { … … 71 73 #endregion 72 74 73 [StorableConstructor] 74 private PopulationBestAverageWorstQualityAnalyzer(bool deserializing) : base() { } 75 public PopulationBestAverageWorstQualityAnalyzer() 75 #region Properties 76 private BestQualityMemorizer BestQualityMemorizer { 77 get { return (BestQualityMemorizer)OperatorGraph.InitialOperator; } 78 } 79 private BestQualityMemorizer BestKnownQualityMemorizer { 80 get { return (BestQualityMemorizer)BestQualityMemorizer.Successor; } 81 } 82 private BestAverageWorstQualityCalculator BestAverageWorstQualityCalculator { 83 get { return (BestAverageWorstQualityCalculator)BestKnownQualityMemorizer.Successor; } 84 } 85 #endregion 86 87 public BestAverageWorstQualityAnalyzer() 76 88 : base() { 77 Initialize();78 }79 80 private void Initialize() {81 89 #region Create parameters 82 90 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false.")); … … 94 102 95 103 #region Create operators 96 BestQualityMemorizer bestQualityMemorizer 1= new BestQualityMemorizer();97 BestQualityMemorizer best QualityMemorizer2= new BestQualityMemorizer();104 BestQualityMemorizer bestQualityMemorizer = new BestQualityMemorizer(); 105 BestQualityMemorizer bestKnownQualityMemorizer = new BestQualityMemorizer(); 98 106 BestAverageWorstQualityCalculator bestAverageWorstQualityCalculator = new BestAverageWorstQualityCalculator(); 99 107 DataTableValuesCollector dataTableValuesCollector = new DataTableValuesCollector(); … … 101 109 ResultsCollector resultsCollector = new ResultsCollector(); 102 110 103 bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality"; 104 bestQualityMemorizer1.MaximizationParameter.ActualName = "Maximization"; 105 bestQualityMemorizer1.QualityParameter.ActualName = "Quality"; 111 bestQualityMemorizer.BestQualityParameter.ActualName = BestQualityParameter.Name; 112 bestQualityMemorizer.MaximizationParameter.ActualName = MaximizationParameter.Name; 113 bestQualityMemorizer.QualityParameter.ActualName = QualityParameter.Name; 114 bestQualityMemorizer.QualityParameter.Depth = QualityParameter.Depth; 106 115 107 bestQualityMemorizer2.BestQualityParameter.ActualName = "BestKnownQuality"; 108 bestQualityMemorizer2.MaximizationParameter.ActualName = "Maximization"; 109 bestQualityMemorizer2.QualityParameter.ActualName = "Quality"; 116 bestKnownQualityMemorizer.BestQualityParameter.ActualName = BestKnownQualityParameter.Name; 117 bestKnownQualityMemorizer.MaximizationParameter.ActualName = MaximizationParameter.Name; 118 bestKnownQualityMemorizer.QualityParameter.ActualName = QualityParameter.Name; 119 bestKnownQualityMemorizer.QualityParameter.Depth = QualityParameter.Depth; 110 120 111 bestAverageWorstQualityCalculator.AverageQualityParameter.ActualName = "CurrentAverageQuality"; 112 bestAverageWorstQualityCalculator.BestQualityParameter.ActualName = "CurrentBestQuality"; 113 bestAverageWorstQualityCalculator.MaximizationParameter.ActualName = "Maximization"; 114 bestAverageWorstQualityCalculator.QualityParameter.ActualName = "Quality"; 115 bestAverageWorstQualityCalculator.WorstQualityParameter.ActualName = "CurrentWorstQuality"; 121 bestAverageWorstQualityCalculator.AverageQualityParameter.ActualName = CurrentAverageQualityParameter.Name; 122 bestAverageWorstQualityCalculator.BestQualityParameter.ActualName = CurrentBestQualityParameter.Name; 123 bestAverageWorstQualityCalculator.MaximizationParameter.ActualName = MaximizationParameter.Name; 124 bestAverageWorstQualityCalculator.QualityParameter.ActualName = QualityParameter.Name; 125 bestAverageWorstQualityCalculator.QualityParameter.Depth = QualityParameter.Depth; 126 bestAverageWorstQualityCalculator.WorstQualityParameter.ActualName = CurrentWorstQualityParameter.Name; 116 127 117 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality"));118 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality"));119 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality"));120 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));121 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, "BestKnownQuality"));122 dataTableValuesCollector.DataTableParameter.ActualName = "Qualities";128 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentBestQuality", null, CurrentBestQualityParameter.Name)); 129 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentAverageQuality", null, CurrentAverageQualityParameter.Name)); 130 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentWorstQuality", null, CurrentWorstQualityParameter.Name)); 131 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestQuality", null, BestQualityParameter.Name)); 132 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestKnownQuality", null, BestKnownQualityParameter.Name)); 133 dataTableValuesCollector.DataTableParameter.ActualName = QualitiesParameter.Name; 123 134 124 qualityDifferenceCalculator.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";125 qualityDifferenceCalculator.FirstQualityParameter.ActualName = "BestKnownQuality";126 qualityDifferenceCalculator.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";127 qualityDifferenceCalculator.SecondQualityParameter.ActualName = "BestQuality";135 qualityDifferenceCalculator.AbsoluteDifferenceParameter.ActualName = AbsoluteDifferenceBestKnownToBestParameter.Name; 136 qualityDifferenceCalculator.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name; 137 qualityDifferenceCalculator.RelativeDifferenceParameter.ActualName = RelativeDifferenceBestKnownToBestParameter.Name; 138 qualityDifferenceCalculator.SecondQualityParameter.ActualName = BestQualityParameter.Name; 128 139 129 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Best Quality", null, "CurrentBestQuality"));130 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Average Quality", null, "CurrentAverageQuality"));131 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Current Worst Quality", null, "CurrentWorstQuality"));132 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));133 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, "BestKnownQuality"));134 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest"));135 resultsCollector.CollectedValues.Add(new LookupParameter<PercentValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest"));136 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>( "Qualities"));137 resultsCollector.ResultsParameter.ActualName = "Results";140 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentBestQuality", null, CurrentBestQualityParameter.Name)); 141 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentAverageQuality", null, CurrentAverageQualityParameter.Name)); 142 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("CurrentWorstQuality", null, CurrentWorstQualityParameter.Name)); 143 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestQuality", null, BestQualityParameter.Name)); 144 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("BestKnownQuality", null, BestKnownQualityParameter.Name)); 145 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("AbsoluteDifferenceBestKnownToBest", null, AbsoluteDifferenceBestKnownToBestParameter.Name)); 146 resultsCollector.CollectedValues.Add(new LookupParameter<PercentValue>("RelativeDifferenceBestKnownToBest", null, RelativeDifferenceBestKnownToBestParameter.Name)); 147 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(QualitiesParameter.Name)); 148 resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name; 138 149 #endregion 139 150 140 151 #region Create operator graph 141 OperatorGraph.InitialOperator = bestQualityMemorizer 1;142 bestQualityMemorizer 1.Successor = bestQualityMemorizer2;143 best QualityMemorizer2.Successor = bestAverageWorstQualityCalculator;152 OperatorGraph.InitialOperator = bestQualityMemorizer; 153 bestQualityMemorizer.Successor = bestKnownQualityMemorizer; 154 bestKnownQualityMemorizer.Successor = bestAverageWorstQualityCalculator; 144 155 bestAverageWorstQualityCalculator.Successor = dataTableValuesCollector; 145 156 dataTableValuesCollector.Successor = qualityDifferenceCalculator; … … 147 158 resultsCollector.Successor = null; 148 159 #endregion 160 161 Initialize(); 162 } 163 [StorableConstructor] 164 private BestAverageWorstQualityAnalyzer(bool deserializing) : base() { } 165 166 [StorableHook(HookType.AfterDeserialization)] 167 private void Initialize() { 168 QualityParameter.DepthChanged += new EventHandler(QualityParameter_DepthChanged); 169 } 170 171 public override IDeepCloneable Clone(Cloner cloner) { 172 BestAverageWorstQualityAnalyzer clone = (BestAverageWorstQualityAnalyzer)base.Clone(cloner); 173 clone.Initialize(); 174 return clone; 175 } 176 177 private void QualityParameter_DepthChanged(object sender, System.EventArgs e) { 178 BestQualityMemorizer.QualityParameter.Depth = QualityParameter.Depth; 179 BestKnownQualityMemorizer.QualityParameter.Depth = QualityParameter.Depth; 180 BestAverageWorstQualityCalculator.QualityParameter.Depth = QualityParameter.Depth; 149 181 } 150 182 } -
trunk/sources/HeuristicLab.Analysis/3.3/BestAverageWorstQualityCalculator.cs
r3659 r3662 29 29 namespace HeuristicLab.Analysis { 30 30 /// <summary> 31 /// An operator which calculates the best, average and worst solution quality of the current population.31 /// An operator which calculates the best, average and worst quality of solutions in the scope tree. 32 32 /// </summary> 33 [Item("BestAverageWorstQualityCalculator", "An operator which calculates the best, average and worst solution quality of the current population.")]33 [Item("BestAverageWorstQualityCalculator", "An operator which calculates the best, average and worst quality of solutions in the scope tree.")] 34 34 [StorableClass] 35 35 public sealed class BestAverageWorstQualityCalculator : SingleSuccessorOperator { 36 public IValueLookupParameter<BoolValue> MaximizationParameter {37 get { return ( IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }36 public ValueLookupParameter<BoolValue> MaximizationParameter { 37 get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; } 38 38 } 39 public ILookupParameter<ItemArray<DoubleValue>> QualityParameter {40 get { return ( ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }39 public ScopeTreeLookupParameter<DoubleValue> QualityParameter { 40 get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 41 41 } 42 public IValueLookupParameter<DoubleValue> BestQualityParameter {43 get { return ( IValueLookupParameter<DoubleValue>)Parameters["BestQuality"]; }42 public ValueLookupParameter<DoubleValue> BestQualityParameter { 43 get { return (ValueLookupParameter<DoubleValue>)Parameters["BestQuality"]; } 44 44 } 45 public IValueLookupParameter<DoubleValue> AverageQualityParameter {46 get { return ( IValueLookupParameter<DoubleValue>)Parameters["AverageQuality"]; }45 public ValueLookupParameter<DoubleValue> AverageQualityParameter { 46 get { return (ValueLookupParameter<DoubleValue>)Parameters["AverageQuality"]; } 47 47 } 48 public IValueLookupParameter<DoubleValue> WorstQualityParameter {49 get { return ( IValueLookupParameter<DoubleValue>)Parameters["WorstQuality"]; }48 public ValueLookupParameter<DoubleValue> WorstQualityParameter { 49 get { return (ValueLookupParameter<DoubleValue>)Parameters["WorstQuality"]; } 50 50 } 51 51 … … 53 53 : base() { 54 54 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the current problem is a maximization problem, otherwise false.")); 55 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value contained in each sub-scope which represents the solution quality."));55 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value contained in the scope tree which represents the solution quality.")); 56 56 Parameters.Add(new ValueLookupParameter<DoubleValue>("BestQuality", "The quality value of the best solution.")); 57 57 Parameters.Add(new ValueLookupParameter<DoubleValue>("AverageQuality", "The average quality of all solutions.")); -
trunk/sources/HeuristicLab.Analysis/3.3/BestQualityMemorizer.cs
r3659 r3662 29 29 namespace HeuristicLab.Analysis { 30 30 /// <summary> 31 /// An operator that updates the best quality found so far with those qualities in the subscopes.31 /// An operator that updates the best quality found so far with those qualities contained in the scope tree. 32 32 /// </summary> 33 [Item("BestQualityMemorizer", "An operator that updates the best quality found so far with those qualities in the subscopes.")]33 [Item("BestQualityMemorizer", "An operator that updates the best quality found so far with those qualities contained in the scope tree.")] 34 34 [StorableClass] 35 35 public class BestQualityMemorizer : SingleSuccessorOperator { 36 public IValueLookupParameter<BoolValue> MaximizationParameter {37 get { return ( IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }36 public ValueLookupParameter<BoolValue> MaximizationParameter { 37 get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; } 38 38 } 39 public ILookupParameter<ItemArray<DoubleValue>> QualityParameter {40 get { return ( ILookupParameter<ItemArray<DoubleValue>>)Parameters["Quality"]; }39 public ScopeTreeLookupParameter<DoubleValue> QualityParameter { 40 get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 41 41 } 42 public IValueLookupParameter<DoubleValue> BestQualityParameter {43 get { return ( IValueLookupParameter<DoubleValue>)Parameters["BestQuality"]; }42 public ValueLookupParameter<DoubleValue> BestQualityParameter { 43 get { return (ValueLookupParameter<DoubleValue>)Parameters["BestQuality"]; } 44 44 } 45 45 … … 47 47 : base() { 48 48 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the current problem is a maximization problem, otherwise false.")); 49 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value contained in each sub-scope which represents the solution quality."));49 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value contained in the scope tree which represents the solution quality.")); 50 50 Parameters.Add(new ValueLookupParameter<DoubleValue>("BestQuality", "The quality value of the best solution.")); 51 51 } -
trunk/sources/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj
r3623 r3662 85 85 <ItemGroup> 86 86 <None Include="HeuristicLabAnalysisPlugin.cs.frame" /> 87 <Compile Include="BestAverageWorstQualityAnalyzer.cs" /> 87 88 <Compile Include="BestAverageWorstQualityCalculator.cs" /> 88 89 <Compile Include="BestQualityMemorizer.cs" /> 89 <Compile Include=" PopulationQualityAnalyzer.cs" />90 <Compile Include=" PopulationValueAnalyzer.cs" />90 <Compile Include="QualityAnalyzer.cs" /> 91 <Compile Include="MinAverageMaxValueAnalyzer.cs" /> 91 92 <Compile Include="MinAverageMaxValueCalculator.cs" /> 92 <Compile Include="PopulationMinAverageMaxValueAnalyzer.cs" />93 <Compile Include="SolutionValueAnalyzer.cs" />94 <Compile Include="SolutionQualityAnalyzer.cs" />95 93 <Compile Include="MultiAnalyzer.cs" /> 96 <Compile Include="PopulationBestAverageWorstQualityAnalyzer.cs" />97 94 <Compile Include="QualityDifferenceCalculator.cs" /> 98 95 <Compile Include="DataRow.cs" /> … … 101 98 <Compile Include="DataTable.cs" /> 102 99 <Compile Include="DataTableValuesCollector.cs" /> 100 <Compile Include="ValueAnalyzer.cs" /> 103 101 </ItemGroup> 104 102 <ItemGroup> -
trunk/sources/HeuristicLab.Analysis/3.3/MinAverageMaxValueAnalyzer.cs
r3659 r3662 20 20 #endregion 21 21 22 using System; 23 using HeuristicLab.Common; 22 24 using HeuristicLab.Core; 23 25 using HeuristicLab.Data; … … 30 32 namespace HeuristicLab.Analysis { 31 33 /// <summary> 32 /// An operator which analyzes the minimum, average and maximum of a value in the current population.34 /// An operator which analyzes the minimum, average and maximum of a value in the scope tree. 33 35 /// </summary> 34 [Item(" PopulationMinAverageMaxValueAnalyzer", "An operator which analyzes the minimum, average and maximum of a value in the current population.")]36 [Item("MinAverageMaxValueAnalyzer", "An operator which analyzes the minimum, average and maximum of a value in the scope tree.")] 35 37 [StorableClass] 36 public sealed class PopulationMinAverageMaxValueAnalyzer : AlgorithmOperator, IAnalyzer {38 public sealed class MinAverageMaxValueAnalyzer : AlgorithmOperator, IAnalyzer { 37 39 #region Parameter properties 38 40 public ScopeTreeLookupParameter<DoubleValue> ValueParameter { … … 56 58 #endregion 57 59 58 [StorableConstructor] 59 private PopulationMinAverageMaxValueAnalyzer(bool deserializing) : base() { } 60 public PopulationMinAverageMaxValueAnalyzer() 60 #region Properties 61 private MinAverageMaxValueCalculator MinAverageMaxValueCalculator { 62 get { return (MinAverageMaxValueCalculator)OperatorGraph.InitialOperator; } 63 } 64 #endregion 65 66 public MinAverageMaxValueAnalyzer() 61 67 : base() { 62 Initialize();63 }64 65 private void Initialize() {66 68 #region Create parameters 67 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", "The value contained in each solutionwhich should be analyzed."));69 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", "The value contained in the scope tree which should be analyzed.")); 68 70 Parameters.Add(new ValueLookupParameter<DoubleValue>("MinValue", "The minimum of the value.")); 69 71 Parameters.Add(new ValueLookupParameter<DoubleValue>("AverageValue", "The average of the value.")); … … 78 80 ResultsCollector resultsCollector = new ResultsCollector(); 79 81 80 minAverageMaxValueCalculator.AverageValueParameter.ActualName = "AverageValue"; 81 minAverageMaxValueCalculator.MaxValueParameter.ActualName = "MaxValue"; 82 minAverageMaxValueCalculator.MinValueParameter.ActualName = "MinValue"; 83 minAverageMaxValueCalculator.ValueParameter.ActualName = "Value"; 82 minAverageMaxValueCalculator.AverageValueParameter.ActualName = AverageValueParameter.Name; 83 minAverageMaxValueCalculator.MaxValueParameter.ActualName = MaxValueParameter.Name; 84 minAverageMaxValueCalculator.MinValueParameter.ActualName = MinValueParameter.Name; 85 minAverageMaxValueCalculator.ValueParameter.ActualName = ValueParameter.Name; 86 minAverageMaxValueCalculator.ValueParameter.Depth = ValueParameter.Depth; 84 87 85 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Min imum Value", null, "MinValue"));86 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Average Value", null, "AverageValue"));87 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Max imum Value", null, "MaxValue"));88 dataTableValuesCollector.DataTableParameter.ActualName = "Values";88 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("MinValue", null, MinValueParameter.Name)); 89 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("AverageValue", null, AverageValueParameter.Name)); 90 dataTableValuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("MaxValue", null, MaxValueParameter.Name)); 91 dataTableValuesCollector.DataTableParameter.ActualName = ValuesParameter.Name; 89 92 90 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Min imum Value", null, "MinValue"));91 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Average Value", null, "AverageValue"));92 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Max imum Value", null, "MaxValue"));93 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>( "Values"));94 resultsCollector.ResultsParameter.ActualName = "Results";93 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("MinValue", null, MinValueParameter.Name)); 94 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("AverageValue", null, AverageValueParameter.Name)); 95 resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("MaxValue", null, MaxValueParameter.Name)); 96 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(ValuesParameter.Name)); 97 resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name; 95 98 #endregion 96 99 … … 101 104 resultsCollector.Successor = null; 102 105 #endregion 106 107 Initialize(); 108 } 109 [StorableConstructor] 110 private MinAverageMaxValueAnalyzer(bool deserializing) : base() { } 111 112 [StorableHook(HookType.AfterDeserialization)] 113 private void Initialize() { 114 ValueParameter.DepthChanged += new EventHandler(ValueParameter_DepthChanged); 115 } 116 117 public override IDeepCloneable Clone(Cloner cloner) { 118 MinAverageMaxValueAnalyzer clone = (MinAverageMaxValueAnalyzer)base.Clone(cloner); 119 clone.Initialize(); 120 return clone; 121 } 122 123 private void ValueParameter_DepthChanged(object sender, System.EventArgs e) { 124 MinAverageMaxValueCalculator.ValueParameter.Depth = ValueParameter.Depth; 103 125 } 104 126 } -
trunk/sources/HeuristicLab.Analysis/3.3/MinAverageMaxValueCalculator.cs
r3659 r3662 29 29 namespace HeuristicLab.Analysis { 30 30 /// <summary> 31 /// An operator which calculates the minimum, average and maximum of a value in the current population.31 /// An operator which calculates the minimum, average and maximum of a value in the scope tree. 32 32 /// </summary> 33 [Item("MinAverageMaxValueCalculator", "An operator which calculates the minimum, average and maximum of a value in the current population.")]33 [Item("MinAverageMaxValueCalculator", "An operator which calculates the minimum, average and maximum of a value in the scope tree.")] 34 34 [StorableClass] 35 35 public sealed class MinAverageMaxValueCalculator : SingleSuccessorOperator { 36 public ILookupParameter<ItemArray<DoubleValue>> ValueParameter {37 get { return ( ILookupParameter<ItemArray<DoubleValue>>)Parameters["Value"]; }36 public ScopeTreeLookupParameter<DoubleValue> ValueParameter { 37 get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Value"]; } 38 38 } 39 public IValueLookupParameter<DoubleValue> MinValueParameter {40 get { return ( IValueLookupParameter<DoubleValue>)Parameters["MinValue"]; }39 public ValueLookupParameter<DoubleValue> MinValueParameter { 40 get { return (ValueLookupParameter<DoubleValue>)Parameters["MinValue"]; } 41 41 } 42 public IValueLookupParameter<DoubleValue> AverageValueParameter {43 get { return ( IValueLookupParameter<DoubleValue>)Parameters["AverageValue"]; }42 public ValueLookupParameter<DoubleValue> AverageValueParameter { 43 get { return (ValueLookupParameter<DoubleValue>)Parameters["AverageValue"]; } 44 44 } 45 public IValueLookupParameter<DoubleValue> MaxValueParameter {46 get { return ( IValueLookupParameter<DoubleValue>)Parameters["MaxValue"]; }45 public ValueLookupParameter<DoubleValue> MaxValueParameter { 46 get { return (ValueLookupParameter<DoubleValue>)Parameters["MaxValue"]; } 47 47 } 48 48 49 49 public MinAverageMaxValueCalculator() 50 50 : base() { 51 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", "The value contained in each sub-scope for which the minimum, average and maximum should be calculated."));51 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", "The value contained in the scope tree for which the minimum, average and maximum should be calculated.")); 52 52 Parameters.Add(new ValueLookupParameter<DoubleValue>("MinValue", "The minimum of the value.")); 53 53 Parameters.Add(new ValueLookupParameter<DoubleValue>("AverageValue", "The average of the value.")); 54 54 Parameters.Add(new ValueLookupParameter<DoubleValue>("MaxValue", "The maximum of the value.")); 55 55 } 56 57 56 58 57 public override IOperation Apply() { -
trunk/sources/HeuristicLab.Analysis/3.3/ValueAnalyzer.cs
r3659 r3662 20 20 #endregion 21 21 22 using System; 23 using HeuristicLab.Common; 22 24 using HeuristicLab.Core; 23 25 using HeuristicLab.Data; … … 30 32 namespace HeuristicLab.Analysis { 31 33 /// <summary> 32 /// An operator which analyzes a value in the current population.34 /// An operator which analyzes a value in the scope tree. 33 35 /// </summary> 34 [Item(" PopulationValueAnalyzer", "An operator which analyzes a value in the current population.")]36 [Item("ValueAnalyzer", "An operator which analyzes a value in the scope tree.")] 35 37 [StorableClass] 36 public sealed class PopulationValueAnalyzer : AlgorithmOperator, IAnalyzer {38 public sealed class ValueAnalyzer : AlgorithmOperator, IAnalyzer { 37 39 #region Parameter properties 38 40 public ScopeTreeLookupParameter<DoubleValue> ValueParameter { … … 47 49 #endregion 48 50 49 [StorableConstructor] 50 private PopulationValueAnalyzer(bool deserializing) : base() { } 51 public PopulationValueAnalyzer() 51 #region Properties 52 private DataTableValuesCollector DataTableValuesCollector { 53 get { return (DataTableValuesCollector)OperatorGraph.InitialOperator; } 54 } 55 private ResultsCollector ResultsCollector { 56 get { return (ResultsCollector)DataTableValuesCollector.Successor; } 57 } 58 #endregion 59 60 public ValueAnalyzer() 52 61 : base() { 53 Initialize();54 }55 56 private void Initialize() {57 62 #region Create parameters 58 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", "The value contained in each solutionwhich should be analyzed."));63 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", "The value contained in the scope tree which should be analyzed.")); 59 64 Parameters.Add(new ValueLookupParameter<DataTable>("Values", "The data table to store the values.")); 60 65 Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The results collection where the analysis values should be stored.")); … … 65 70 ResultsCollector resultsCollector = new ResultsCollector(); 66 71 67 dataTableValuesCollector.CollectedValues.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", null, "Value")); 68 dataTableValuesCollector.DataTableParameter.ActualName = "Values"; 72 dataTableValuesCollector.CollectedValues.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", null, ValueParameter.Name)); 73 ((ScopeTreeLookupParameter<DoubleValue>)dataTableValuesCollector.CollectedValues["Value"]).Depth = ValueParameter.Depth; 74 dataTableValuesCollector.DataTableParameter.ActualName = ValuesParameter.Name; 69 75 70 resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", null, "Value")); 71 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("Values")); 72 resultsCollector.ResultsParameter.ActualName = "Results"; 76 resultsCollector.CollectedValues.Add(new ScopeTreeLookupParameter<DoubleValue>("Value", null, ValueParameter.Name)); 77 ((ScopeTreeLookupParameter<DoubleValue>)resultsCollector.CollectedValues["Value"]).Depth = ValueParameter.Depth; 78 resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>(ValuesParameter.Name)); 79 resultsCollector.ResultsParameter.ActualName = ResultsParameter.Name; 73 80 #endregion 74 81 … … 78 85 resultsCollector.Successor = null; 79 86 #endregion 87 88 Initialize(); 89 } 90 [StorableConstructor] 91 private ValueAnalyzer(bool deserializing) : base() { } 92 93 [StorableHook(HookType.AfterDeserialization)] 94 private void Initialize() { 95 ValueParameter.DepthChanged += new EventHandler(ValueParameter_DepthChanged); 96 } 97 98 public override IDeepCloneable Clone(Cloner cloner) { 99 ValueAnalyzer clone = (ValueAnalyzer)base.Clone(cloner); 100 clone.Initialize(); 101 return clone; 102 } 103 104 private void ValueParameter_DepthChanged(object sender, System.EventArgs e) { 105 ((ScopeTreeLookupParameter<DoubleValue>)DataTableValuesCollector.CollectedValues["Value"]).Depth = ValueParameter.Depth; 106 ((ScopeTreeLookupParameter<DoubleValue>)ResultsCollector.CollectedValues["Value"]).Depth = ValueParameter.Depth; 80 107 } 81 108 }
Note: See TracChangeset
for help on using the changeset viewer.