Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/24/11 17:38:42 (13 years ago)
Author:
abeham
Message:

#1344

  • Fixed discovery of the main loop operator in the MainLoop property
File:
1 edited

Legend:

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

    r5356 r5366  
    4242  [StorableClass]
    4343  public class NSGA2 : EngineAlgorithm, IStorableContent {
     44    public string Filename { get; set; }
     45
    4446    #region Problem Properties
    4547    public override Type ProblemType {
     
    143145    }
    144146    private NSGA2MainLoop MainLoop {
    145       get {
    146         return (NSGA2MainLoop)(
    147           (ResultsCollector)RankAndCrowdingSorter.Successor
    148         ).Successor;
    149       }
     147      get { return FindMainLoop(RankAndCrowdingSorter.Successor); }
    150148    }
    151149    #endregion
     
    392390      Analyzer.Operators.Add(paretoFrontAnalyzer);
    393391    }
     392    private NSGA2MainLoop FindMainLoop(IOperator start) {
     393      IOperator mainLoop = start;
     394      while (mainLoop != null && !(mainLoop is NSGA2MainLoop))
     395        mainLoop = ((SingleSuccessorOperator)mainLoop).Successor;
     396      if (mainLoop == null) return null;
     397      else return (NSGA2MainLoop)mainLoop;
     398    }
    394399    #endregion
    395 
    396     public string Filename {
    397       get;
    398       set;
    399     }
    400400  }
    401401}
Note: See TracChangeset for help on using the changeset viewer.