Changeset 12396 for branches/LinearLinkage/HeuristicLab.Encodings.LinearLinkageEncoding/3.3/Manipulators
- Timestamp:
- 05/21/15 16:30:14 (9 years ago)
- Location:
- branches/LinearLinkage/HeuristicLab.Encodings.LinearLinkageEncoding/3.3/Manipulators
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LinearLinkage/HeuristicLab.Encodings.LinearLinkageEncoding/3.3/Manipulators/GraftManipulator.cs
r12288 r12396 24 24 using HeuristicLab.Common; 25 25 using HeuristicLab.Core; 26 using HeuristicLab.Data;27 using HeuristicLab.Parameters;28 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 27 … … 33 31 public sealed class GraftManipulator : LinearLinkageManipulator { 34 32 35 public IValueLookupParameter<IntValue> MaxGroupsParameter {36 get { return (IValueLookupParameter<IntValue>)Parameters["MaxGroups"]; }37 }38 39 33 [StorableConstructor] 40 34 private GraftManipulator(bool deserializing) : base(deserializing) { } 41 35 private GraftManipulator(GraftManipulator original, Cloner cloner) : base(original, cloner) { } 42 public GraftManipulator() { 43 Parameters.Add(new ValueLookupParameter<IntValue>("MaxGroups", "The maximum number of groups. If a value less or equal than 0 is used the number of groups is not limited.", new IntValue(-1))); 44 } 45 public GraftManipulator(int maxGroups) 46 : this() { 47 MaxGroupsParameter.Value = new IntValue(maxGroups); 48 } 36 public GraftManipulator() { } 49 37 50 38 public override IDeepCloneable Clone(Cloner cloner) { … … 52 40 } 53 41 54 public static void Apply(IRandom random, LinearLinkage lle , int maxGroups) {42 public static void Apply(IRandom random, LinearLinkage lle) { 55 43 int tries = lle.Length; 56 44 var index = random.Next(lle.Length); … … 59 47 tries--; 60 48 } 61 if (lle[index] != index) Apply(random, lle, maxGroups,index);49 if (lle[index] != index) Apply(random, lle, index); 62 50 } 63 51 64 public static void Apply(IRandom random, LinearLinkage lle, int maxGroups, intindex) {52 public static void Apply(IRandom random, LinearLinkage lle, int index) { 65 53 var groups = lle.Select((val, idx) => Tuple.Create(idx, val)) 66 54 .Where(x => x.Item1 == x.Item2) … … 84 72 85 73 protected override void Manipulate(IRandom random, LinearLinkage lle) { 86 var maxGroups = MaxGroupsParameter.ActualValue.Value; 87 Apply(random, lle, maxGroups <= 0 ? int.MaxValue : maxGroups); 74 Apply(random, lle); 88 75 } 89 76 } -
branches/LinearLinkage/HeuristicLab.Encodings.LinearLinkageEncoding/3.3/Manipulators/MergeGroupManipulator.cs
r12286 r12396 28 28 29 29 namespace HeuristicLab.Encodings.LinearLinkageEncoding { 30 [Item("Merge Group Manipulator", "Performs a maximum of N merge operations on the groups. Groups may be merged multiple times.")]30 [Item("Merge Group Manipulator", "Performs a maximum of N merge operations on the groups. An already merged group may be merged again.")] 31 31 [StorableClass] 32 32 public sealed class MergeGroupManipulator : LinearLinkageManipulator { -
branches/LinearLinkage/HeuristicLab.Encodings.LinearLinkageEncoding/3.3/Manipulators/MoveItemManipulator.cs
r12286 r12396 29 29 30 30 namespace HeuristicLab.Encodings.LinearLinkageEncoding { 31 [Item("Move Item Manipulator", "Performs a maximum of N move operations between groups or to new groups. Items may be moved multiple times.")]31 [Item("Move Item Manipulator", "Performs a maximum of N move operations between groups or to new groups. An already moved item may be moved again.")] 32 32 [StorableClass] 33 33 public sealed class MoveItemManipulator : LinearLinkageManipulator { -
branches/LinearLinkage/HeuristicLab.Encodings.LinearLinkageEncoding/3.3/Manipulators/SplitGroupManipulator.cs
r12286 r12396 31 31 32 32 namespace HeuristicLab.Encodings.LinearLinkageEncoding { 33 [Item("Split Group Manipulator", "Performs a maximum of N split operations on the groups. Groups may be split multiple times.")]33 [Item("Split Group Manipulator", "Performs a maximum of N split operations on the groups. An already split group may be split again.")] 34 34 [StorableClass] 35 35 public sealed class SplitGroupManipulator : LinearLinkageManipulator { -
branches/LinearLinkage/HeuristicLab.Encodings.LinearLinkageEncoding/3.3/Manipulators/SwapItemManipulator.cs
r12286 r12396 28 28 29 29 namespace HeuristicLab.Encodings.LinearLinkageEncoding { 30 [Item("Swap Item Manipulator", " Swaps items between groups. Items may be swapped multiple times.")]30 [Item("Swap Item Manipulator", "Performs N swaps operations of two items each. The same items may be swapped multiple times, at least two groups need to be present.")] 31 31 [StorableClass] 32 32 public sealed class SwapItemManipulator : LinearLinkageManipulator {
Note: See TracChangeset
for help on using the changeset viewer.