- Timestamp:
- 02/04/11 02:16:08 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.3/CrossValidationView.cs
r5419 r5420 107 107 //The content must be stopped if no other view showing the content is available 108 108 var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>(); 109 //add nested optimizers110 optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers);111 112 if (!optimizers.Contains(Content)) Content.Stop();109 if (!optimizers.Contains(Content)) { 110 var nestedOptimizers = optimizers.SelectMany(opt => opt.NestedOptimizers); 111 if (!nestedOptimizers.Contains(Content)) Content.Stop(); 112 } 113 113 } 114 114 base.OnClosed(e); -
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 -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r5419 r5420 137 137 //The content must be stopped if no other view showing the content is available 138 138 var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>(); 139 //add nested optimizers140 optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers);141 142 if (!optimizers.Contains(Content)) Content.Stop();139 if (!optimizers.Contains(Content)) { 140 var nestedOptimizers = optimizers.SelectMany(opt => opt.NestedOptimizers); 141 if (!nestedOptimizers.Contains(Content)) Content.Stop(); 142 } 143 143 } 144 144 base.OnClosed(e); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs
r5419 r5420 113 113 //The content must be stopped if no other view showing the content is available 114 114 var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>(); 115 //add nested optimizers116 optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers);117 118 if (!optimizers.Contains(Content)) Content.Stop();115 if (!optimizers.Contains(Content)) { 116 var nestedOptimizers = optimizers.SelectMany(opt => opt.NestedOptimizers); 117 if (!nestedOptimizers.Contains(Content)) Content.Stop(); 118 } 119 119 } 120 120 base.OnClosed(e); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentView.cs
r5419 r5420 95 95 //The content must be stopped if no other view showing the content is available 96 96 var optimizers = MainFormManager.MainForm.Views.OfType<IContentView>().Where(v => v != this).Select(v => v.Content).OfType<IOptimizer>(); 97 //add nested optimizers98 optimizers = optimizers.SelectMany(opt => opt.NestedOptimizers).Union(optimizers);99 100 if (!optimizers.Contains(Content)) Content.Stop();97 if (!optimizers.Contains(Content)) { 98 var nestedOptimizers = optimizers.SelectMany(opt => opt.NestedOptimizers); 99 if (!nestedOptimizers.Contains(Content)) Content.Stop(); 100 } 101 101 } 102 102 base.OnClosed(e);
Note: See TracChangeset
for help on using the changeset viewer.