Changeset 13613


Ignore:
Timestamp:
02/08/16 21:54:26 (6 years ago)
Author:
gkronber
Message:

#1966: started work on PackingSequenceEncoding

Location:
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/GroupingVector/GroupingVectorEncoding.cs

    r13032 r13613  
    3333  [Item("Grouping Vector Encoding", "Represents an encoding for a bin packing problem using an array of group-assignments for every packing-item.")]
    3434  [StorableClass]
    35   public class GroupingVectorEncoding : Item, IPackingSolutionEncoding{
     35  public class GroupingVectorEncoding : Item, IPackingSolutionEncoding {
    3636
    3737    [Storable]
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceEncoding.cs

    r13032 r13613  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Encodings.PermutationEncoding;
     27using HeuristicLab.Optimization;
    2728using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2829using HeuristicLab.Problems.BinPacking.Interfaces;
     
    3132  [Item("Packing Sequence Encoding", "Represents an encoding for a bin packing problem using permutation of item-indexes to define the packing sequence.")]
    3233  [StorableClass]
    33   public class PackingSequenceEncoding : Item, IPackingSolutionEncoding {
     34  public class PackingSequenceEncoding : Encoding<PackingSequenceRandomCreator> {
    3435
    3536    [Storable]
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceRandomCreator.cs

    r13032 r13613  
    2525using HeuristicLab.Data;
    2626using HeuristicLab.Encodings.PermutationEncoding;
     27using HeuristicLab.Operators;
    2728using HeuristicLab.Optimization;
    2829using HeuristicLab.Parameters;
     
    3031
    3132namespace HeuristicLab.Encodings.PackingEncoding.PackingSequence {
    32   [Item("PackingSequenceCreator", "Creator class used to create PackingSequence solutions for bin packing problems.")]
    33   [StorableClass]
    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 {
    3536
    36     public ILookupParameter<IRandom> RandomParameter {
    37       get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    38     }
    39     public IValueLookupParameter<IntValue> PackingItemsParameter {
    40       get { return (IValueLookupParameter<IntValue>)Parameters["PackingItems"]; }
    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    }
    4243
    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    }
    5056
    5157    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"));
    5562
    56       EncodedSolutionParameter.ActualName = "PackingSequence";
    57     }
     63      SolutionParameter.ActualName = "PackingSequence";
     64    }
    5865
     66    public override IOperation Apply() {
     67      Apply(PackingItemsParameter.ActualValue.Value, RandomParameter.ActualValue);
     68      return base.Apply();
     69    }
    5970
    6071    public static PackingSequenceEncoding Apply(int items, IRandom random) {
     
    6475    }
    6576
    66     protected override IItem CreateSolution() {
    67       return Apply(PackingItemsParameter.ActualValue.Value, RandomParameter.ActualValue);
    68     }
    69   }
     77  }
    7078}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj

    r13611 r13613  
    217217    <Compile Include="Encodings\PackingPlans\BinPacking.cs" />
    218218    <Compile Include="Encodings\PackingPlans\PackingPlan.cs" />
     219    <Compile Include="Encodings\PackingSequence\IPackingSequenceCreator.cs" />
    219220    <Compile Include="Encodings\PackingSequence\Moves\Insertion\ExhaustiveInsertionMoveGenerator.cs" />
    220221    <Compile Include="Encodings\PackingSequence\Moves\Insertion\StochasticInsertionMoveGenerator.cs" />
     
    222223    <Compile Include="Encodings\PackingSequence\Moves\Insertion\InsertionMoveAttribute.cs" />
    223224    <Compile Include="Encodings\PackingSequence\Moves\Insertion\InsertionMoveGenerator.cs" />
     225    <Compile Include="Encodings\PackingSequence\PackingSequence.cs" />
    224226    <Compile Include="Encodings\PackingSequence\PackingSequenceInversionManipulator.cs" />
    225227    <Compile Include="Encodings\PackingSequence\PackingSequencePartiallyMatchedCrossover.cs" />
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingSolutionDecoder.cs

    r13608 r13613  
    6666      Parameters.Add(new LookupParameter<ItemList<I>>("PackingItemMeasures", "Packing-item data taken from the bin-packing problem-instance."));
    6767      Parameters.Add(new LookupParameter<B>("PackingBinMeasures", "Packing-bin data taken from the bin-packing problem-instance."));
    68       Parameters.Add(new ValueParameter<BoolValue>("StackingConstraint", "A flag determining whether stackingconstraints should be enforced or not.", new BoolValue(true)));
     68      Parameters.Add(new ValueParameter<BoolValue>("StackingConstraint", "A flag determining whether stacking constraints should be enforced or not.", new BoolValue(true)));
    6969    }
    7070
Note: See TracChangeset for help on using the changeset viewer.