Changeset 5838 for branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Evaluators/QAPSwapMoveEvaluator.cs
- Timestamp:
- 03/28/11 15:34:30 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/Evaluators/QAPSwapMoveEvaluator.cs
r5785 r5838 29 29 30 30 namespace HeuristicLab.Problems.QuadraticAssignment { 31 [Item("QAPSwap MoveEvaluator", "Evaluated a swapmove on a QAP solution.")]31 [Item("QAPSwap2MoveEvaluator", "Evaluated a swap-2 move on a QAP solution.")] 32 32 [StorableClass] 33 public class QAPSwap MoveEvaluator : QAPMoveEvaluator, IPermutationSwapMoveOperator {34 public ILookupParameter<Swap Move> SwapMoveParameter {35 get { return (ILookupParameter<Swap Move>)Parameters["SwapMove"]; }33 public class QAPSwap2MoveEvaluator : QAPMoveEvaluator, IPermutationSwap2MoveOperator { 34 public ILookupParameter<Swap2Move> Swap2MoveParameter { 35 get { return (ILookupParameter<Swap2Move>)Parameters["Swap2Move"]; } 36 36 } 37 37 38 38 [StorableConstructor] 39 protected QAPSwap MoveEvaluator(bool deserializing) : base(deserializing) { }40 protected QAPSwap MoveEvaluator(QAPSwapMoveEvaluator original, Cloner cloner)39 protected QAPSwap2MoveEvaluator(bool deserializing) : base(deserializing) { } 40 protected QAPSwap2MoveEvaluator(QAPSwap2MoveEvaluator original, Cloner cloner) 41 41 : base(original, cloner) { 42 42 } 43 public QAPSwap MoveEvaluator() {44 Parameters.Add(new LookupParameter<Swap Move>("SwapMove", "The move to evaluate."));43 public QAPSwap2MoveEvaluator() { 44 Parameters.Add(new LookupParameter<Swap2Move>("Swap2Move", "The move to evaluate.")); 45 45 } 46 46 47 47 public override IDeepCloneable Clone(Cloner cloner) { 48 return new QAPSwap MoveEvaluator(this, cloner);48 return new QAPSwap2MoveEvaluator(this, cloner); 49 49 } 50 50 51 public static double Apply(Permutation assignment, Swap Move move, DoubleMatrix weights, DoubleMatrix distances) {51 public static double Apply(Permutation assignment, Swap2Move move, DoubleMatrix weights, DoubleMatrix distances) { 52 52 if (move.Index1 == move.Index2) return 0; 53 53 double moveQuality = 0; … … 70 70 71 71 public override IOperation Apply() { 72 Swap Move move = SwapMoveParameter.ActualValue;73 if (move == null) throw new InvalidOperationException("Swap move is not found.");72 Swap2Move move = Swap2MoveParameter.ActualValue; 73 if (move == null) throw new InvalidOperationException("Swap-2 move is not found."); 74 74 Permutation assignment = PermutationParameter.ActualValue; 75 DoubleMatrix distances = Distance MatrixParameter.ActualValue;75 DoubleMatrix distances = DistancesParameter.ActualValue; 76 76 DoubleMatrix weights = WeightsParameter.ActualValue; 77 77
Note: See TracChangeset
for help on using the changeset viewer.