- Timestamp:
- 06/02/13 04:26:26 (11 years ago)
- Location:
- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings
- Files:
-
- 75 added
- 4 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/GroupingVector/GroupingVectorCrossover.cs
r9348 r9563 30 30 [Item("Grouping Vector Crossover", "An operator which crosses two GroupingVector representations.")] 31 31 [StorableClass] 32 public class GroupingVectorCrossover : PackingSolutionCrossover, IGroupingVectorOperator {32 public abstract class GroupingVectorCrossover : PackingSolutionCrossover, IGroupingVectorOperator { 33 33 34 34 [StorableConstructor] … … 40 40 ChildParameter.ActualName = "GroupingVector"; 41 41 } 42 public override IDeepCloneable Clone(Cloner cloner) {43 return new GroupingVectorCrossover(this, cloner);44 }45 42 46 public GroupingVectorEncoding Cross(IRandom random, GroupingVectorEncoding parent1, GroupingVectorEncoding parent2) { 47 GroupingVectorEncoding result = new GroupingVectorEncoding(); 48 result.GroupingVector = SinglePointCrossover.Apply(random, parent1.GroupingVector, parent2.GroupingVector); 49 return result; 50 } 43 public abstract GroupingVectorEncoding Cross(IRandom random, GroupingVectorEncoding parent1, GroupingVectorEncoding parent2); 51 44 52 45 public override IOperation Apply() { -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/GroupingVector/GroupingVectorRandomCreator.cs
r9440 r9563 68 68 } 69 69 70 protected override I PackingSolutionEncodingCreateSolution() {70 protected override IItem CreateSolution() { 71 71 return Apply(PackingItemsParameter.ActualValue.Value, LowerBoundParameter.ActualValue.Value, RandomParameter.ActualValue); 72 72 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/MultiComponentVectorEncoding.cs
r9495 r9563 46 46 return nrOfItems; 47 47 } 48 } 48 } 49 49 50 50 [StorableConstructor] … … 64 64 : base() { 65 65 PackingInformations = new ObservableDictionary<int, ItemList<PackingInformation>>(); 66 } 66 } 67 67 68 68 public override string ToString() { … … 95 95 return PackingInformations.GetHashCode(); 96 96 } 97 97 98 } 98 99 -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/MultiComponentVectorRandomCreator.cs
r9495 r9563 76 76 } 77 77 78 protected override I PackingSolutionEncodingCreateSolution() {78 protected override IItem CreateSolution() { 79 79 return Apply(PackingItemsParameter.ActualValue.Value, LowerBoundParameter.ActualValue.Value, RandomParameter.ActualValue, SortedSequenceParameter.Value.Value); 80 80 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/PackingPlan.cs
r9495 r9563 35 35 36 36 namespace HeuristicLab.Encodings.PackingEncoding.PackingPlan { 37 //RegularPackingPlan defines that the packingItems have to be parallel to the packingBin in every moment38 //SimpleRotation defines that the items may be rotated39 // only in one dimension,40 // only once and41 // only by 90degree42 // so that parallelism to the correlating bin is ensured43 //This definition implies that the floor of the (3D) objects never changes (what may be a wanted constraint in most cases..)44 37 [Item("PackingPlan", "Represents a concrete solution for a bin-packing problem.")] 45 38 [StorableClass] … … 85 78 public PackingPlan(B binMeasures, ItemList<I> itemMeasures) 86 79 : base() { 87 this.PackingItemMeasures = itemMeasures;80 this.PackingItemMeasures = new ItemList<I> (itemMeasures); 88 81 this.PackingBinMeasures = new ObservableDictionary<int, B>(); 89 82 this.PackingBinMeasures[0] = binMeasures; -
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 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSolutionCreator.cs
r9348 r9563 32 32 public abstract class PackingSolutionCreator : SingleSuccessorOperator, IPackingSolutionCreator { 33 33 34 public ILookupParameter<I PackingSolutionEncoding> EncodedSolutionParameter {35 get { return (ILookupParameter<I PackingSolutionEncoding>)Parameters["EncodedPackingSolution"]; }34 public ILookupParameter<IItem> EncodedSolutionParameter { 35 get { return (ILookupParameter<IItem>)Parameters["EncodedPackingSolution"]; } 36 36 } 37 37 … … 41 41 public PackingSolutionCreator() 42 42 : base() { 43 Parameters.Add(new LookupParameter<I PackingSolutionEncoding>("EncodedPackingSolution", "The new bin packing solution candidate."));43 Parameters.Add(new LookupParameter<IItem>("EncodedPackingSolution", "The new bin packing solution candidate.")); 44 44 } 45 45 … … 49 49 } 50 50 51 protected abstract I PackingSolutionEncodingCreateSolution();51 protected abstract IItem CreateSolution(); 52 52 } 53 53 }
Note: See TracChangeset
for help on using the changeset viewer.