Changeset 11576 for branches/OptimizationNetworks/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs
- Timestamp:
- 11/25/14 03:26:00 (10 years ago)
- Location:
- branches/OptimizationNetworks
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks
- Property svn:mergeinfo changed
-
branches/OptimizationNetworks/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs
r9456 r11576 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 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.