Changeset 9563 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence
- Timestamp:
- 06/02/13 04:26:26 (12 years ago)
- Location:
- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence
- Files:
-
- 23 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceCrossover.cs
r9348 r9563 29 29 [Item("PackingSequenceCrossover", "An operator which crosses two PackingSequence representations.")] 30 30 [StorableClass] 31 public class PackingSequenceCrossover : PackingSolutionCrossover, IPackingSequenceOperator {31 public abstract class PackingSequenceCrossover : PackingSolutionCrossover, IPackingSequenceOperator { 32 32 33 33 [StorableConstructor] … … 39 39 ChildParameter.ActualName = "PackingSequence"; 40 40 } 41 public override IDeepCloneable Clone(Cloner cloner) {42 return new PackingSequenceCrossover(this, cloner);43 }44 41 45 public PackingSequenceEncoding Cross(IRandom random, PackingSequenceEncoding parent1, PackingSequenceEncoding parent2) { 46 PackingSequenceEncoding result = new PackingSequenceEncoding(); 47 result.PackingSequence = CosaCrossover.Apply(random, parent1.PackingSequence, parent2.PackingSequence); 48 return result; 49 } 42 public abstract PackingSequenceEncoding Cross(IRandom random, PackingSequenceEncoding parent1, PackingSequenceEncoding parent2); 50 43 51 44 public override IOperation Apply() { -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceEncoding.cs
r9348 r9563 30 30 [Item("Packing Sequence Encoding", "Represents an encoding for a bin packing problem using permutation of item-indexes to define the packing sequence.")] 31 31 [StorableClass] 32 public class PackingSequenceEncoding : Item, IPackingSolutionEncoding {32 public class PackingSequenceEncoding : Item, IPackingSolutionEncoding { 33 33 34 34 [Storable] … … 39 39 protected PackingSequenceEncoding(PackingSequenceEncoding original, Cloner cloner) 40 40 : base(original, cloner) { 41 41 this.PackingSequence = cloner.Clone(original.PackingSequence); 42 42 } 43 43 public override IDeepCloneable Clone(Cloner cloner) { … … 53 53 StringBuilder sb = new StringBuilder(); 54 54 sb.Append("[ "); 55 sb.Append(PackingSequence.ToString() + " \n"); 55 sb.Append(PackingSequence.ToString() + " \n"); 56 56 sb.Append("]"); 57 57 return sb.ToString(); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceManipulator.cs
r9348 r9563 30 30 [Item("PackingSequenceManipulator", "An operator which manipulates a PackingSequence representation.")] 31 31 [StorableClass] 32 public class PackingSequenceManipulator : PackingSolutionManipulator, IPackingSequenceOperator {32 public abstract class PackingSequenceManipulator : PackingSolutionManipulator, IPackingSequenceOperator { 33 33 [StorableConstructor] 34 34 protected PackingSequenceManipulator(bool deserializing) : base(deserializing) { } … … 38 38 EncodedSolutionParameter.ActualName = "PackingSequence"; 39 39 } 40 public override IDeepCloneable Clone(Cloner cloner) {41 return new PackingSequenceManipulator(this, cloner);42 }43 40 44 protected void Manipulate(IRandom random, PackingSequenceEncoding individual) { 45 Swap2Manipulator.Apply(random, individual.PackingSequence); 46 } 41 protected abstract void Manipulate(IRandom random, PackingSequenceEncoding individual); 47 42 48 43 public override IOperation Apply() { -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceRandomCreator.cs
r9348 r9563 60 60 public static PackingSequenceEncoding Apply(int items, IRandom random) { 61 61 var solution = new PackingSequenceEncoding(); 62 63 64 62 solution.PackingSequence = new Permutation(PermutationTypes.Absolute, items, random); 63 return solution; 64 } 65 65 66 protected override I PackingSolutionEncodingCreateSolution() {66 protected override IItem CreateSolution() { 67 67 return Apply(PackingItemsParameter.ActualValue.Value, RandomParameter.ActualValue); 68 68 }
Note: See TracChangeset
for help on using the changeset viewer.