Changeset 5420 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Timestamp:
- 02/04/11 02:16:08 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.3/CrossValidation.cs
r5419 r5420 48 48 algorithm = null; 49 49 clonedAlgorithms = new ItemCollection<IAlgorithm>(); 50 readOnlyClonedAlgorithms = null;51 50 results = new ResultCollection(); 52 51 … … 157 156 [Storable] 158 157 private ItemCollection<IAlgorithm> clonedAlgorithms; 159 private ReadOnlyItemCollection<IAlgorithm> readOnlyClonedAlgorithms;160 public IItemCollection<IAlgorithm> ClonedAlgorithms {161 get {162 if (readOnlyClonedAlgorithms == null) readOnlyClonedAlgorithms = clonedAlgorithms.AsReadOnly();163 return readOnlyClonedAlgorithms;164 }165 }166 158 167 159 public IEnumerable<IOptimizer> NestedOptimizers { 168 get { 169 if (Algorithm != null) yield return Algorithm; 170 if (clonedAlgorithms != null) { 171 foreach (IAlgorithm alg in ClonedAlgorithms) { 172 yield return alg; 173 foreach (IOptimizer nested in alg.NestedOptimizers) 174 yield return nested; 175 } 176 } 177 } 160 get { return Enumerable.Empty<IOptimizer>(); } 178 161 } 179 162 … … 316 299 } 317 300 private void PauseAllClonedAlgorithms() { 318 foreach (IAlgorithm clonedAlgorithm in ClonedAlgorithms) {301 foreach (IAlgorithm clonedAlgorithm in clonedAlgorithms) { 319 302 if (clonedAlgorithm.ExecutionState == ExecutionState.Started) 320 303 clonedAlgorithm.Pause(); … … 333 316 } 334 317 private void StopAllClonedAlgorithms() { 335 foreach (IAlgorithm clonedAlgorithm in ClonedAlgorithms) {318 foreach (IAlgorithm clonedAlgorithm in clonedAlgorithms) { 336 319 if (clonedAlgorithm.ExecutionState == ExecutionState.Started || 337 320 clonedAlgorithm.ExecutionState == ExecutionState.Paused) … … 360 343 public void CollectResultValues(IDictionary<string, IItem> results) { 361 344 Dictionary<string, List<double>> resultValues = new Dictionary<string, List<double>>(); 362 IEnumerable<IRun> runs = ClonedAlgorithms.Select(alg => alg.Runs.FirstOrDefault()).Where(run => run != null);345 IEnumerable<IRun> runs = clonedAlgorithms.Select(alg => alg.Runs.FirstOrDefault()).Where(run => run != null); 363 346 IEnumerable<KeyValuePair<string, IItem>> resultCollections = runs.Where(x => x != null).SelectMany(x => x.Results).ToList(); 364 347
Note: See TracChangeset
for help on using the changeset viewer.