Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/24/11 17:38:42 (14 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.LocalSearch/3.3/LocalSearch.cs

    r5356 r5366  
    118118    }
    119119    private LocalSearchMainLoop MainLoop {
    120       get {
    121         return (LocalSearchMainLoop)(
    122           (ResultsCollector)(
    123             (VariableCreator)SolutionsCreator.Successor
    124           ).Successor
    125         ).Successor;
    126       }
     120      get { return FindMainLoop(SolutionsCreator.Successor); }
    127121    }
    128122    [Storable]
     
    396390      }
    397391    }
     392    private LocalSearchMainLoop FindMainLoop(IOperator start) {
     393      IOperator mainLoop = start;
     394      while (mainLoop != null && !(mainLoop is LocalSearchMainLoop))
     395        mainLoop = ((SingleSuccessorOperator)mainLoop).Successor;
     396      if (mainLoop == null) return null;
     397      else return (LocalSearchMainLoop)mainLoop;
     398    }
    398399    #endregion
    399400  }
Note: See TracChangeset for help on using the changeset viewer.