- Timestamp:
- 10/19/15 17:33:06 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/LayerCreator.cs
r12018 r13037 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Linq; 25 24 using HeuristicLab.Analysis; … … 28 27 using HeuristicLab.Data; 29 28 using HeuristicLab.Operators; 29 using HeuristicLab.Optimization; 30 30 using HeuristicLab.Parameters; 31 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 73 73 scopes.Add(clone); 74 74 75 // Set new layernumber 75 76 clone.Variables["Layer"].Value = new IntValue(OpenLayersParameter.ActualValue.Value); 77 78 // Decrement ages, because MainOperator is goint to increment it 76 79 foreach (var solution in clone.SubScopes) 77 ((IntValue)solution.Variables["Age"].Value).Value -= 1; // Decrement age, because MainOperator is goint to increment it 78 //foreach (var variable in clone.Variables.Where(v => !SavedVariables.Contains(v.Name))) 79 // variable.Value = null; 80 ((IntValue)solution.Variables["Age"].Value).Value -= 1; 80 81 81 //HACK: delete old values from quality table 82 /*var rows = ((DataTable)clone.Variables["Qualities"].Value).Rows; 83 var last = rows.Last(); 84 rows.Clear(); 85 rows.Add(last);*/ 82 // Reset existing values in the results to NaN to symbolize that no layer existed during that duration 83 var results = (ResultCollection)clone.Variables["LayerResults"].Value; 84 ResetResults(results); 86 85 87 86 return base.Apply(); 88 87 } 89 88 89 private void ResetResults(ResultCollection results) { 90 var values = results.Select(r => r.Value); 91 92 // Reset all values within results in results 93 foreach (var resultsCollection in values.OfType<ResultCollection>()) 94 ResetResults(resultsCollection); 95 96 // Reset values 97 foreach (var dataTable in values.OfType<DataTable>()) { 98 foreach (var row in dataTable.Rows) 99 for (int i = 0; i < row.Values.Count; i++) 100 row.Values[i] = double.NaN; 101 } 102 } 103 90 104 } 91 105 }
Note: See TracChangeset
for help on using the changeset viewer.