- Timestamp:
- 07/06/14 15:46:32 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs
r11088 r11096 351 351 MoveGeneratorParameter.ValidValues.Clear(); 352 352 if (Problem != null) { 353 // only add move generators that also have a corresponding tabu-checker and tabu-maker 354 // 355 // 1. assumption: all tabu checkers and tabu makers also implement the IMoveOperator interface 356 // 2. assumption: all move generators also implement the IMoveOperator interface 357 // 3. assumption: if compatible all three operators implement the same (most specific) IMoveOperator interface 353 358 foreach (IMoveGenerator generator in Problem.Operators.OfType<IMoveGenerator>().OrderBy(x => x.Name)) { 359 // get all interfaces equal to or derived from IMoveOperator that this move generator implements 354 360 var moveTypes = generator.GetType().GetInterfaces().Where(x => typeof(IMoveOperator).IsAssignableFrom(x)).ToList(); 361 // keep only the most specific interfaces (e.g. IPermutationTranslocationMoveOperator); 362 // by removing all interfaces for which a derived interface is also contained in the moveTypes set 355 363 foreach (var type in moveTypes.ToList()) { 356 364 if (moveTypes.Any(t => t != type && type.IsAssignableFrom(t))) moveTypes.Remove(type); 357 365 } 366 // keep move generator only if there is a tabu checker and a tabu maker that is derived from 367 // one of the most specific interfaces in moveTypes (e.g. IPermutationTranslocationMoveOperator) 358 368 if (Problem.Operators.OfType<ITabuChecker>().Any(op => moveTypes.Any(m => m.IsInstanceOfType(op))) 359 369 && Problem.Operators.OfType<ITabuMaker>().Any(op => moveTypes.Any(m => m.IsInstanceOfType(op))))
Note: See TracChangeset
for help on using the changeset viewer.