Changeset 13613 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence
- Timestamp:
- 02/08/16 21:54:26 (9 years ago)
- Location:
- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceEncoding.cs
r13032 r13613 25 25 using HeuristicLab.Core; 26 26 using HeuristicLab.Encodings.PermutationEncoding; 27 using HeuristicLab.Optimization; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 29 using HeuristicLab.Problems.BinPacking.Interfaces; … … 31 32 [Item("Packing Sequence Encoding", "Represents an encoding for a bin packing problem using permutation of item-indexes to define the packing sequence.")] 32 33 [StorableClass] 33 public class PackingSequenceEncoding : Item, IPackingSolutionEncoding{34 public class PackingSequenceEncoding : Encoding<PackingSequenceRandomCreator> { 34 35 35 36 [Storable] -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceRandomCreator.cs
r13032 r13613 25 25 using HeuristicLab.Data; 26 26 using HeuristicLab.Encodings.PermutationEncoding; 27 using HeuristicLab.Operators; 27 28 using HeuristicLab.Optimization; 28 29 using HeuristicLab.Parameters; … … 30 31 31 32 namespace HeuristicLab.Encodings.PackingEncoding.PackingSequence { 32 33 34 public class PackingSequenceRandomCreator : PackingSolutionCreator, IStochasticOperator {33 [Item("PackingSequenceCreator", "Creator class used to create PackingSequence solutions for bin packing problems.")] 34 [StorableClass] 35 public class PackingSequenceRandomCreator : SingleSuccessorOperator, IPackingSequenceCreator, IStochasticOperator { 35 36 36 37 38 39 40 41 37 public ILookupParameter<IRandom> RandomParameter { 38 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 39 } 40 public IValueLookupParameter<IntValue> PackingItemsParameter { 41 get { return (IValueLookupParameter<IntValue>)Parameters["PackingItems"]; } 42 } 42 43 43 [StorableConstructor] 44 protected PackingSequenceRandomCreator(bool deserializing) : base(deserializing) { } 45 protected PackingSequenceRandomCreator(PackingSequenceRandomCreator original, Cloner cloner) : base(original, cloner) { 46 } 47 public override IDeepCloneable Clone(Cloner cloner) { 48 return new PackingSequenceRandomCreator(this, cloner); 49 } 44 public ILookupParameter<Problems.BinPacking.Encodings.PackingSequence.PackingSequence> SolutionParameter { 45 get { return (ILookupParameter<Problems.BinPacking.Encodings.PackingSequence.PackingSequence>)Parameters["PackingItems"]; } 46 } 47 48 [StorableConstructor] 49 protected PackingSequenceRandomCreator(bool deserializing) : base(deserializing) { } 50 protected PackingSequenceRandomCreator(PackingSequenceRandomCreator original, Cloner cloner) 51 : base(original, cloner) { 52 } 53 public override IDeepCloneable Clone(Cloner cloner) { 54 return new PackingSequenceRandomCreator(this, cloner); 55 } 50 56 51 57 public PackingSequenceRandomCreator() 52 : base() { 53 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator.")); 54 Parameters.Add(new ValueLookupParameter<IntValue>("PackingItems", "The number of packing-items handled in this problem instance.")); 58 : base() { 59 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator.")); 60 Parameters.Add(new ValueLookupParameter<IntValue>("PackingItems", "The number of packing-items handled in this problem instance.")); 61 Parameters.Add(new LookupParameter<Problems.BinPacking.Encodings.PackingSequence.PackingSequence>("PackingSequence")); 55 62 56 EncodedSolutionParameter.ActualName = "PackingSequence";57 63 SolutionParameter.ActualName = "PackingSequence"; 64 } 58 65 66 public override IOperation Apply() { 67 Apply(PackingItemsParameter.ActualValue.Value, RandomParameter.ActualValue); 68 return base.Apply(); 69 } 59 70 60 71 public static PackingSequenceEncoding Apply(int items, IRandom random) { … … 64 75 } 65 76 66 protected override IItem CreateSolution() { 67 return Apply(PackingItemsParameter.ActualValue.Value, RandomParameter.ActualValue); 68 } 69 } 77 } 70 78 }
Note: See TracChangeset
for help on using the changeset viewer.