Changeset 15048 for trunk/sources/HeuristicLab.Analysis/3.3
- Timestamp:
- 06/23/17 15:20:31 (7 years ago)
- Location:
- trunk/sources/HeuristicLab.Analysis/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/IndexedDataRow.cs
r14185 r15048 30 30 31 31 namespace HeuristicLab.Analysis { 32 [Item("IndexedDataRow", "A data row that contains time series.")]32 [Item("IndexedDataRow", "A data row that contains a series of points.")] 33 33 [StorableClass] 34 34 public class IndexedDataRow<T> : NamedItem { … … 105 105 OnVisualPropertiesChanged(); 106 106 } 107 protected override void OnNameChanged() { 108 base.OnNameChanged(); 109 VisualProperties.DisplayName = Name; 110 } 107 111 } 108 112 } -
trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/IndexedDataTable.cs
r14185 r15048 107 107 public event EventHandler VisualPropertiesChanged; 108 108 protected virtual void OnVisualPropertiesChanged() { 109 EventHandler handler = VisualPropertiesChanged;109 var handler = VisualPropertiesChanged; 110 110 if (handler != null) handler(this, EventArgs.Empty); 111 111 } … … 115 115 } 116 116 117 protected virtual void RegisterRowsEvents() { 118 rows.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(rows_ItemsAdded); 119 rows.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(rows_ItemsRemoved); 120 rows.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(rows_ItemsReplaced); 121 rows.CollectionReset += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(rows_CollectionReset); 122 } 123 private void rows_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) { 117 private void RegisterRowsEvents() { 118 rows.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(RowsOnItemsAdded); 119 rows.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(RowsOnItemsRemoved); 120 rows.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(RowsOnItemsReplaced); 121 rows.CollectionReset += new CollectionItemsChangedEventHandler<IndexedDataRow<T>>(RowsOnCollectionReset); 122 foreach (var row in Rows) RegisterRowEvents(row); 123 } 124 protected virtual void RowsOnItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) { 124 125 foreach (var row in e.Items) 125 126 this.RegisterRowEvents(row); … … 129 130 this.OnReset(); 130 131 } 131 pr ivate void rows_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {132 protected virtual void RowsOnItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) { 132 133 foreach (var row in e.Items) 133 134 this.DeregisterRowEvents(row); … … 137 138 this.OnReset(); 138 139 } 139 pr ivate void rows_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {140 protected virtual void RowsOnItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) { 140 141 foreach (var row in e.OldItems) 141 142 this.DeregisterRowEvents(row); … … 147 148 this.OnReset(); 148 149 } 149 pr ivate void rows_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) {150 protected virtual void RowsOnCollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedDataRow<T>> e) { 150 151 foreach (var row in e.OldItems) 151 152 this.DeregisterRowEvents(row); … … 159 160 } 160 161 161 pr otected virtualvoid RegisterRowEvents(IndexedDataRow<T> row) {162 row.Values.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values _ItemsAdded);163 row.Values.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values _ItemsMoved);164 row.Values.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values _ItemsRemoved);165 row.Values.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values _ItemsReplaced);166 row.Values.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values _CollectionReset);167 } 168 pr otected virtualvoid DeregisterRowEvents(IndexedDataRow<T> row) {169 row.Values.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values _ItemsAdded);170 row.Values.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values _ItemsMoved);171 row.Values.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values _ItemsRemoved);172 row.Values.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values _ItemsReplaced);173 row.Values.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values _CollectionReset);174 } 175 176 pr ivate void Values_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {177 this.OnReset(); 178 } 179 pr ivate void Values_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {180 this.OnReset(); 181 } 182 pr ivate void Values_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {183 this.OnReset(); 184 } 185 pr ivate void Values_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {186 this.OnReset(); 187 } 188 pr ivate void Values_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {162 private void RegisterRowEvents(IndexedDataRow<T> row) { 163 row.Values.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsAdded); 164 row.Values.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsMoved); 165 row.Values.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsRemoved); 166 row.Values.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsReplaced); 167 row.Values.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnCollectionReset); 168 } 169 private void DeregisterRowEvents(IndexedDataRow<T> row) { 170 row.Values.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsAdded); 171 row.Values.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsMoved); 172 row.Values.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsRemoved); 173 row.Values.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnItemsReplaced); 174 row.Values.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(ValuesOnCollectionReset); 175 } 176 177 protected virtual void ValuesOnItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) { 178 this.OnReset(); 179 } 180 protected virtual void ValuesOnItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) { 181 this.OnReset(); 182 } 183 protected virtual void ValuesOnItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) { 184 this.OnReset(); 185 } 186 protected virtual void ValuesOnItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) { 187 this.OnReset(); 188 } 189 protected virtual void ValuesOnCollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) { 189 190 this.OnReset(); 190 191 } -
trunk/sources/HeuristicLab.Analysis/3.3/QualityAnalysis/ExpectedRuntimeHelper.cs
r14775 r15048 46 46 47 47 public struct ErtCalculationResult { 48 public int SuccessfulRuns;49 public int TotalRuns;50 public double ExpectedRuntime;48 public readonly int SuccessfulRuns; 49 public readonly int TotalRuns; 50 public readonly double ExpectedRuntime; 51 51 52 52 public ErtCalculationResult(int successful, int total, double ert) { … … 57 57 58 58 public override string ToString() { 59 return SuccessfulRuns == 0 ? "\u221e" // infinity symbol 60 : ExpectedRuntime.ToString("##,0.0", CultureInfo.CurrentCulture.NumberFormat); 59 return ExpectedRuntime.ToString("##,0.0", CultureInfo.CurrentCulture.NumberFormat); 61 60 } 62 61 } -
trunk/sources/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityPerClockAnalyzer.cs
r14102 r15048 91 91 92 92 if (values.Count == 0) { 93 values.Add(newEntry); 94 values.Add(Tuple.Create(runtimeSoFar, bestQuality)); // duplicate entry that will be replaced93 values.Add(newEntry); // record the first data 94 values.Add(Tuple.Create(runtimeSoFar, bestQuality)); // last entry records max number of evaluations 95 95 return base.Apply(); 96 96 } … … 98 98 var improvement = values.Last().Item2 != bestQuality; 99 99 if (improvement) { 100 values[values.Count - 1] = newEntry; 101 values.Add(Tuple.Create(runtimeSoFar, bestQuality)); // duplicate entry that will be replaced100 values[values.Count - 1] = newEntry; // record the improvement 101 values.Add(Tuple.Create(runtimeSoFar, bestQuality)); // last entry records max number of evaluations 102 102 } else { 103 103 values[values.Count - 1] = Tuple.Create(runtimeSoFar, bestQuality); -
trunk/sources/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityPerEvaluationsAnalyzer.cs
r14102 r15048 88 88 if (evalMoves != null) evaluations += evalMoves.Value * MoveCostPerSolutionParameter.ActualValue.Value; 89 89 90 var dataTable = QualityPerEvaluationsParameter.ActualValue; 91 var values = dataTable.Rows["First-hit Graph"].Values; 92 if (evaluations == 0 || values.Count > 0 && evaluations < values.Last().Item1) evaluations = 1; 93 var newEntry = Tuple.Create(evaluations, bestQuality); 90 if (evaluations > 0) { 91 var dataTable = QualityPerEvaluationsParameter.ActualValue; 92 var values = dataTable.Rows["First-hit Graph"].Values; 94 93 95 if (values.Count == 0) { 96 values.Add(newEntry); 97 values.Add(Tuple.Create(evaluations, bestQuality)); // duplicate entry that will be replaced 98 return base.Apply(); 99 } 94 var newEntry = Tuple.Create(evaluations, bestQuality); 100 95 101 var improvement = values.Last().Item2 != bestQuality; 102 if (improvement) { 103 values[values.Count - 1] = newEntry; 104 values.Add(Tuple.Create(evaluations, bestQuality)); // duplicate entry that will be replaced 105 } else { 106 values[values.Count - 1] = Tuple.Create(evaluations, bestQuality); 96 if (values.Count == 0) { 97 values.Add(newEntry); // record the first data 98 values.Add(Tuple.Create(evaluations, bestQuality)); // last entry records max number of evaluations 99 return base.Apply(); 100 } 101 102 var improvement = values.Last().Item2 != bestQuality; 103 if (improvement) { 104 values[values.Count - 1] = newEntry; // record the improvement 105 values.Add(Tuple.Create(evaluations, bestQuality)); // last entry records max number of evaluations 106 } else { 107 values[values.Count - 1] = Tuple.Create(evaluations, bestQuality); // the last entry is updated 108 } 107 109 } 108 110 return base.Apply();
Note: See TracChangeset
for help on using the changeset viewer.