Changeset 11108
- Timestamp:
- 07/07/14 14:17:15 (10 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs
r11096 r11108 352 352 if (Problem != null) { 353 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 interface356 // 2. assumption: all move generators also implement the IMoveOperator interface357 // 3. assumption: if compatible all three operators implement the same (most specific) IMoveOperator interface358 354 foreach (IMoveGenerator generator in Problem.Operators.OfType<IMoveGenerator>().OrderBy(x => x.Name)) { 359 355 // get all interfaces equal to or derived from IMoveOperator that this move generator implements … … 364 360 if (moveTypes.Any(t => t != type && type.IsAssignableFrom(t))) moveTypes.Remove(type); 365 361 } 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) 362 // keep move generator only if there is a tabu checker and a tabu maker that is derived from the same move interface 368 363 if (Problem.Operators.OfType<ITabuChecker>().Any(op => moveTypes.Any(m => m.IsInstanceOfType(op))) 369 364 && Problem.Operators.OfType<ITabuMaker>().Any(op => moveTypes.Any(m => m.IsInstanceOfType(op)))) -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IMoveGenerator.cs
r9456 r11108 26 26 /// An interface which represents an operator for generating moves. 27 27 /// </summary> 28 /// <remarks> 29 /// Please read the remarks on <see cref="IMoveOperator"/> on how to implement moves. 30 /// </remarks> 28 31 public interface IMoveGenerator : IOperator { 29 32 } -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IMoveOperator.cs
r9456 r11108 24 24 namespace HeuristicLab.Optimization { 25 25 /// <summary> 26 /// The basic interface that marks all move operators. 26 /// The basic interface that marks all move operators. Derived interfaces 27 /// are used to group move operators together. 27 28 /// </summary> 28 29 /// <remarks> 29 /// A group of move operators that belong together should derive an interface from this one 30 /// and implement the interface in each operator.<br /> 31 /// In an algorithm one can thus find out all move operators that belong together, by grouping operators 32 /// according to the most specific interface derived from this interface that they implement.<br /><br /> 33 /// A concrete example:<br /> 34 /// You have a solution representation <c>MyRep</c> and there you have a move <c>MyRepMove</c> that you want 35 /// to make available to the friendly GUIs. So in <c>MyRep</c> you derive an interface <c>IMyRepMoveOperator</c>.<br /> 36 /// Now you need to implement at least three operators that handle these moves: A MoveGenerator, a MoveMaker, and a MoveEvaluator. 37 /// Note: The MoveEvaluator should be implemented in the problem plugin if you choose to separate representation and problem.<br /> 38 /// In each of these operators you implement <c>IMyRepMoveOperator</c> as well as the appropriate operator specific interface. 39 /// For a MoveGenerator that would be one of <c>IExhaustiveMoveGenerator</c>, <c>ISingleMoveGenerator</c>, 40 /// or <c>IMultiMoveGenerator</c>, for a MoveMaker that would be <c>IMoveMaker</c>, and for a MoveEvaluator that would 41 /// either be <c>ISingleObjectiveMoveEvaluator</c> or <c>IMultiObjectiveMoveEvaluator</c>.<br /> 42 /// If you have this you need to make sure that an instance of all your operators are loaded in the Operators collection of your IProblem 43 /// and you can select them in the respective algorithms.<br /><br /> 44 /// For Tabu Search support you will need two additional operators: A TabuChecker (e.g. derived from <see cref="TabuChecker" />), 45 /// and a TabuMaker.<br /><br /> 46 /// If you decide later that you want another move, e.g. <c>MyRepMove2</c>, you would do as before and group them under 47 /// the interface <c>IMyRepMove2Operator</c>.<br /><br /> 48 /// If you want to make use of multiple different moves, all your operators would need to know about all the moves that you plan 49 /// to use.<br /><br /> 50 /// Take a look at the Permutation and TSP plugin to see how this looks like in real code. 51 /// </remarks> 30 /// A group of move operators that belong together should derive a new 31 /// interface from IMoveOperator and implement the new interface in each 32 /// operator.<br /> 33 /// 34 /// E.g. a new move is to be implemented and INewMove is created as a derived 35 /// type of IMoveOperator. Then you create the additional following types<br /> 36 /// <list type="bullet"> 37 /// <item> 38 /// <term>NewMoveGenerator</term> 39 /// <description> 40 /// implements INewMove as well as either IExhaustiveMoveGenerator, 41 /// IMultiMoveGenerator or ISingleMoveGenerator 42 /// </description> 43 /// </item> 44 /// <item> 45 /// <term>NewMoveMaker</term> 46 /// <description> 47 /// implements INewMove as well as IMoveMaker 48 /// </description> 49 /// </item> 50 /// <item> 51 /// <term>NewMoveEvaluator</term> 52 /// <description> 53 /// (problem plugin) implements INewMove as well as ISingleObjectiveMoveEvaluator 54 /// </description> 55 /// </item> 56 /// <item> 57 /// <term>NewMoveTabuMaker</term> 58 /// <description> 59 /// (only for Tabu Search) implements INewMove as well as TabuMaker 60 /// </description> 61 /// </item> 62 /// <item> 63 /// <term>NewMoveTabuChecker</term> 64 /// <description> 65 /// (only for Tabu Search) implements INewMove as well as ITabuChecker 66 /// </description> 67 /// </item> 68 /// </list> 69 /// 70 /// These operators should not implement further move types. For further moves 71 /// a new interface derived from IMoveOperator should be created. 52 72 public interface IMoveOperator : IOperator { 53 73 }
Note: See TracChangeset
for help on using the changeset viewer.