Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11110 for stable


Ignore:
Timestamp:
07/07/14 14:21:54 (10 years ago)
Author:
abeham
Message:

#2189: merged to stable

Location:
stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs

    r9456 r11110  
    351351      MoveGeneratorParameter.ValidValues.Clear();
    352352      if (Problem != null) {
     353        // only add move generators that also have a corresponding tabu-checker and tabu-maker
    353354        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);
    355366        }
    356367      }
  • stable/HeuristicLab.Optimization/3.3/Interfaces/IMoveGenerator.cs

    r9456 r11110  
    2626  /// An interface which represents an operator for generating moves.
    2727  /// </summary>
     28  /// <remarks>
     29  /// Please read the remarks on <see cref="IMoveOperator"/> on how to implement moves.
     30  /// </remarks>
    2831  public interface IMoveGenerator : IOperator {
    2932  }
  • stable/HeuristicLab.Optimization/3.3/Interfaces/IMoveOperator.cs

    r9456 r11110  
    2424namespace HeuristicLab.Optimization {
    2525  /// <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.
    2728  /// </summary>
    2829  /// <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.
    5272  public interface IMoveOperator : IOperator {
    5373  }
Note: See TracChangeset for help on using the changeset viewer.