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.SimulatedAnnealing/3.3/SimulatedAnnealing.cs

    r5356 r5366  
    136136    }
    137137    private SimulatedAnnealingMainLoop MainLoop {
    138       get {
    139         return (SimulatedAnnealingMainLoop)(
    140           (ResultsCollector)(
    141             (VariableCreator)SolutionsCreator.Successor
    142           ).Successor
    143         ).Successor;
    144       }
     138      get { return FindMainLoop(SolutionsCreator.Successor); }
    145139    }
    146140    [Storable]
     
    432426      Analyzer.Operators.Add(qualityAnalyzer);
    433427    }
     428    private SimulatedAnnealingMainLoop FindMainLoop(IOperator start) {
     429      IOperator mainLoop = start;
     430      while (mainLoop != null && !(mainLoop is SimulatedAnnealingMainLoop))
     431        mainLoop = ((SingleSuccessorOperator)mainLoop).Successor;
     432      if (mainLoop == null) return null;
     433      else return (SimulatedAnnealingMainLoop)mainLoop;
     434    }
    434435    #endregion
    435436  }
Note: See TracChangeset for help on using the changeset viewer.