- Timestamp:
- 03/29/10 17:53:12 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Permutation.cs
r3160 r3231 25 25 26 26 namespace HeuristicLab.Encodings.PermutationEncoding { 27 [Item("Permutation", "Represents a permutation of integer values.")] 27 28 [StorableClass] 28 [Item("Permutation", "Represents a permutation of integer values.")]29 29 public class Permutation : IntArray { 30 public Permutation() : base() { } 31 public Permutation(int length) 30 [Storable] 31 private PermutationTypes permutationType; 32 /// <summary> 33 /// Gets the type of the permutation (see <see cref="PermutationType"/>). 34 /// </summary> 35 public PermutationTypes PermutationType { 36 get { return permutationType; } 37 } 38 39 public Permutation() : base() { 40 permutationType = PermutationTypes.RelativeUndirected; 41 } 42 public Permutation(PermutationTypes type) : base() { 43 permutationType = type; 44 } 45 46 public Permutation(PermutationTypes type, int length) 32 47 : base(length) { 33 48 for (int i = 0; i < length; i++) 34 49 this[i] = i; 50 permutationType = type; 35 51 } 36 public Permutation( int length, IRandom random)37 : this( length) {52 public Permutation(PermutationTypes type, int length, IRandom random) 53 : this(type, length) { 38 54 Randomize(random); 39 55 } 40 public Permutation(int[] elements) : base(elements) { } 41 public Permutation(IntArray elements) 42 : this(elements.Length) { 56 public Permutation(PermutationTypes type, int[] elements) : base(elements) { 57 permutationType = type; 58 } 59 public Permutation(PermutationTypes type, IntArray elements) : this(type, elements.Length) { 43 60 for (int i = 0; i < array.Length; i++) 44 61 array[i] = elements[i]; … … 46 63 47 64 public override IDeepCloneable Clone(Cloner cloner) { 48 Permutation clone = new Permutation( array);65 Permutation clone = new Permutation(permutationType, array); 49 66 cloner.RegisterClonedObject(this, clone); 50 67 return clone;
Note: See TracChangeset
for help on using the changeset viewer.