Changeset 7505 for branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves
- Timestamp:
- 02/22/12 22:43:09 (13 years ago)
- Location:
- branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/GQAPNMoveGenerator.cs
r7419 r7505 30 30 31 31 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { 32 [Item(" GQAPNMoveGenerator", "Base class for move operators that generate n-move moves.")]32 [Item("N-Move Generator", "Base class for move operators that generate N-Move moves.")] 33 33 [StorableClass] 34 34 public abstract class GQAPNMoveGenerator : GQAPMoveGenerator, IGQAPNMoveOperator { -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/NMove.cs
r7407 r7505 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 27 28 28 29 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { 29 [Item(" n-move", "An n-move describes moving n equipments to nlocations.")]30 [Item("N-Move", "An N-Move describes the relocation of n equipments to n different locations.")] 30 31 [StorableClass] 31 32 public class NMove : Item { 32 33 [Storable] 33 public int[] Equipments { get; private set; } 34 [Storable] 35 public int[] Locations { get; private set; } 34 public Dictionary<int, int> NewAssignments { get; private set; } 36 35 [Storable] 37 36 public IntegerVector OriginalVector { get; private set; } 38 37 39 public int N { get { return Equipments.Length; } }38 public int N { get { return NewAssignments.Count; } } 40 39 41 40 [StorableConstructor] … … 43 42 protected NMove(NMove original, Cloner cloner) 44 43 : base(original, cloner) { 45 Equipments = (int[])original.Equipments.Clone(); 46 Locations = (int[])original.Locations.Clone(); 44 NewAssignments = new Dictionary<int, int>(original.NewAssignments); 47 45 if (original.OriginalVector != null) 48 46 OriginalVector = cloner.Clone(original.OriginalVector); … … 55 53 if (locations == null) throw new ArgumentNullException("locations", "NMove: Locations must not be null."); 56 54 if (equipments.Length != locations.Length) throw new ArgumentException("NMove: Length of equipments and locations is not identical."); 57 Equipments = equipments; 58 Locations = locations; 55 NewAssignments = new Dictionary<int, int>(); 56 for (int i = 0; i < equipments.Length; i++) 57 NewAssignments[equipments[i]] = locations[i]; 59 58 OriginalVector = originalVector; 60 59 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/NMoveMaker.cs
r7419 r7505 30 30 31 31 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { 32 [Item("N MoveMaker", "Performs an n-move.")]32 [Item("N-Move Maker", "Performs an N-Move.")] 33 33 [StorableClass] 34 34 public class NMoveMaker : SingleSuccessorOperator, IAssignmentAwareGQAPOperator, IQualityAwareGQAPOperator, IMoveQualityAwareGQAPOperator, IGQAPNMoveOperator, IMoveMaker { … … 97 97 98 98 public static void Apply(IntegerVector vector, NMove move) { 99 for (int i = 0; i < move.N; i++) { 100 vector[move.Equipments[i]] = move.Locations[i]; 101 } 99 foreach (var kvp in move.NewAssignments) 100 vector[kvp.Key] = kvp.Value; 102 101 } 103 102 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/StochasticNMoveMultiMoveGenerator.cs
r7419 r7505 30 30 31 31 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { 32 [Item("Stochastic n-move MultiMoveGenerator", "Randomly samples a number of n-moves.")]32 [Item("Stochastic N-Move MultiMoveGenerator", "Randomly samples a number of N-Moves.")] 33 33 [StorableClass] 34 34 public class StochasticNMoveMultiMoveGenerator : GQAPNMoveGenerator, ICapacitiesAwareGQAPOperator, IStochasticOperator, IMultiMoveGenerator { -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/StochasticNMoveSingleMoveGenerator.cs
r7419 r7505 30 30 31 31 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { 32 [Item("Stochastic n-move SingleMoveGenerator", "Randomly samples a single n-move.")]32 [Item("Stochastic N-Move SingleMoveGenerator", "Randomly samples a single N-Move.")] 33 33 [StorableClass] 34 34 public class StochasticNMoveSingleMoveGenerator : GQAPNMoveGenerator, ICapacitiesAwareGQAPOperator, IStochasticOperator, ISingleMoveGenerator {
Note: See TracChangeset
for help on using the changeset viewer.