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

    r5356 r5366  
    135135    }
    136136    private TabuSearchMainLoop MainLoop {
    137       get {
    138         return (TabuSearchMainLoop)(
    139           (ResultsCollector)(
    140             (VariableCreator)SolutionsCreator.Successor
    141           ).Successor
    142         ).Successor;
    143       }
     137      get { return FindMainLoop(SolutionsCreator.Successor); }
    144138    }
    145139    [Storable]
     
    492486      }
    493487    }
     488    private TabuSearchMainLoop FindMainLoop(IOperator start) {
     489      IOperator mainLoop = start;
     490      while (mainLoop != null && !(mainLoop is TabuSearchMainLoop))
     491        mainLoop = ((SingleSuccessorOperator)mainLoop).Successor;
     492      if (mainLoop == null) return null;
     493      else return (TabuSearchMainLoop)mainLoop;
     494    }
    494495    #endregion
    495496  }
Note: See TracChangeset for help on using the changeset viewer.