Changeset 11110 for stable/HeuristicLab.Algorithms.TabuSearch
- Timestamp:
- 07/07/14 14:21:54 (10 years ago)
- Location:
- stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 11088,11096,11108
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs
r9456 r11110 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 353 354 foreach (IMoveGenerator generator in Problem.Operators.OfType<IMoveGenerator>().OrderBy(x => x.Name)) { 354 MoveGeneratorParameter.ValidValues.Add(generator); 355 // get all interfaces equal to or derived from IMoveOperator that this move generator implements 356 var moveTypes = generator.GetType().GetInterfaces().Where(x => typeof(IMoveOperator).IsAssignableFrom(x)).ToList(); 357 // keep only the most specific interfaces (e.g. IPermutationTranslocationMoveOperator); 358 // by removing all interfaces for which a derived interface is also contained in the moveTypes set 359 foreach (var type in moveTypes.ToList()) { 360 if (moveTypes.Any(t => t != type && type.IsAssignableFrom(t))) moveTypes.Remove(type); 361 } 362 // keep move generator only if there is a tabu checker and a tabu maker that is derived from the same move interface 363 if (Problem.Operators.OfType<ITabuChecker>().Any(op => moveTypes.Any(m => m.IsInstanceOfType(op))) 364 && Problem.Operators.OfType<ITabuMaker>().Any(op => moveTypes.Any(m => m.IsInstanceOfType(op)))) 365 MoveGeneratorParameter.ValidValues.Add(generator); 355 366 } 356 367 }
Note: See TracChangeset
for help on using the changeset viewer.