Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/04/11 02:16:08 (14 years ago)
Author:
mkommend
Message:

#1402 - Refactored OnClosed method of IOptimizer views.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.3/CrossValidation.cs

    r5419 r5420  
    4848      algorithm = null;
    4949      clonedAlgorithms = new ItemCollection<IAlgorithm>();
    50       readOnlyClonedAlgorithms = null;
    5150      results = new ResultCollection();
    5251
     
    157156    [Storable]
    158157    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     }
    166158
    167159    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>(); }
    178161    }
    179162
     
    316299    }
    317300    private void PauseAllClonedAlgorithms() {
    318       foreach (IAlgorithm clonedAlgorithm in ClonedAlgorithms) {
     301      foreach (IAlgorithm clonedAlgorithm in clonedAlgorithms) {
    319302        if (clonedAlgorithm.ExecutionState == ExecutionState.Started)
    320303          clonedAlgorithm.Pause();
     
    333316    }
    334317    private void StopAllClonedAlgorithms() {
    335       foreach (IAlgorithm clonedAlgorithm in ClonedAlgorithms) {
     318      foreach (IAlgorithm clonedAlgorithm in clonedAlgorithms) {
    336319        if (clonedAlgorithm.ExecutionState == ExecutionState.Started ||
    337320            clonedAlgorithm.ExecutionState == ExecutionState.Paused)
     
    360343    public void CollectResultValues(IDictionary<string, IItem> results) {
    361344      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);
    363346      IEnumerable<KeyValuePair<string, IItem>> resultCollections = runs.Where(x => x != null).SelectMany(x => x.Results).ToList();
    364347
Note: See TracChangeset for help on using the changeset viewer.