Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/14/15 19:52:46 (9 years ago)
Author:
gkronber
Message:

#1966:

  • used Items instead of NamedItems and adapted views (Names/Descriptions) were not set anyway
  • fixed problems identified by Essential unit tests
Location:
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceInversionManipulator.cs

    r13032 r13461  
    3333    [StorableConstructor]
    3434    protected PackingSequenceInversionManipulator(bool deserializing) : base(deserializing) { }
    35     protected PackingSequenceInversionManipulator(PackingSequenceManipulator original, Cloner cloner) : base(original, cloner) { }
     35    protected PackingSequenceInversionManipulator(PackingSequenceInversionManipulator original, Cloner cloner) : base(original, cloner) { }
    3636    public PackingSequenceInversionManipulator()
    3737      : base() {
    38         EncodedSolutionParameter.ActualName = "PackingSequence";
     38      EncodedSolutionParameter.ActualName = "PackingSequence";
    3939    }
    4040    public override IDeepCloneable Clone(Cloner cloner) {
     
    4444    protected override void Manipulate(IRandom random, PackingSequenceEncoding individual) {
    4545      InversionManipulator.Apply(random, individual.PackingSequence);
    46     }   
     46    }
    4747  }
    4848}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceScrambleManipulator.cs

    r13032 r13461  
    3232    [StorableConstructor]
    3333    protected PackingSequenceScrambleManipulator(bool deserializing) : base(deserializing) { }
    34     protected PackingSequenceScrambleManipulator(PackingSequenceManipulator original, Cloner cloner) : base(original, cloner) { }
     34    protected PackingSequenceScrambleManipulator(PackingSequenceScrambleManipulator original, Cloner cloner) : base(original, cloner) { }
    3535    public PackingSequenceScrambleManipulator()
    3636      : base() {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj

    r13460 r13461  
    155155    <Reference Include="System.Drawing" />
    156156    <Reference Include="System.IO.Compression" />
    157     <Reference Include="System.IO.Compression.FileSystem" />
    158157    <Reference Include="System.Windows.Forms" />
    159158  </ItemGroup>
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Interfaces/IPackingShape.cs

    r13032 r13461  
    2323
    2424namespace HeuristicLab.Problems.BinPacking.Interfaces {
    25   public interface IPackingShape : INamedItem {
     25  public interface IPackingShape : IItem {
    2626  }
    2727}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingBin/CuboidPackingBin.cs

    r13032 r13461  
    3131  [StorableClass]
    3232  public class CuboidPackingBin : CuboidPackingShape, IPackingBin {
    33    
    34     public CuboidPackingBin(int width, int height, int depth) : base (width, height, depth) {}
     33
     34    public CuboidPackingBin(int width, int height, int depth) : base(width, height, depth) { }
    3535
    3636    [StorableConstructor]
     
    4242      return new CuboidPackingBin(this, cloner);
    4343    }
    44     public CuboidPackingBin() : base() {
    45 
     44    public CuboidPackingBin()
     45      : base() {
    4646    }
    4747  }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingBin/RectangularPackingBin.cs

    r13032 r13461  
    3232
    3333    public RectangularPackingBin(int width, int height) : base(width, height) { }
    34     public RectangularPackingBin() : base() {
     34    public RectangularPackingBin()
     35      : base() {
    3536
    3637    }
     
    4041    protected RectangularPackingBin(RectangularPackingBin original, Cloner cloner)
    4142      : base(original, cloner) {
    42     }             
     43    }
    4344    public override IDeepCloneable Clone(Cloner cloner) {
    4445      return new RectangularPackingBin(this, cloner);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingItem/CuboidPackingItem.cs

    r13032 r13461  
    5151    }
    5252    public CuboidPackingItem() : base() {
    53 
    5453    }
    5554
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingItem/RectangularPackingItem.cs

    r13032 r13461  
    3131  [Item("RectangularPackingItem", "Represents a rectangular packing-item for bin-packing problems.")]
    3232  [StorableClass]
    33   public class RectangularPackingItem : RectangularPackingShape, IPackingItem{
     33  public class RectangularPackingItem : RectangularPackingShape, IPackingItem {
    3434
    3535    public RectangularPackingBin TargetBin { get; set; }
     
    5050      return new RectangularPackingItem(this, cloner);
    5151    }
    52     public RectangularPackingItem() : base() {
     52    public RectangularPackingItem()
     53      : base() {
    5354    }
    5455
    5556    public RectangularPackingItem(int width, int height, RectangularPackingBin targetBin) : base(width, height) { this.TargetBin = new RectangularPackingBin(targetBin.Width, targetBin.Height); }
    56                                  
     57
    5758    public void AddTargetBinMeasures(int[] targetBinMeasures) {
    5859      TargetBin = new RectangularPackingBin(targetBinMeasures[0], targetBinMeasures[1]);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Plugin.cs.frame

    r13032 r13461  
    2929  [PluginFile("HeuristicLab.Problems.BinPacking-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Common", "3.3")]
    31   [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
    3231  [PluginDependency("HeuristicLab.Core", "3.3")]
     32  [PluginDependency("HeuristicLab.Data", "3.3")]
     33  [PluginDependency("HeuristicLab.Encodings.IntegerVectorEncoding", "3.3")]
     34  [PluginDependency("HeuristicLab.Collections", "3.3")]
     35  [PluginDependency("HeuristicLab.Encodings.PermutationEncoding", "3.3")]
     36  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     37  [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]
     38  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3339  [PluginDependency("HeuristicLab.Persistence", "3.3")]
     40  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
    3441  public class HeuristicLabProblemsBinPackingPlugin : PluginBase {
    3542  }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/RegularIdenticalBinPackingProblem.cs

    r13460 r13461  
    4747
    4848    #region Parameter Properties
    49     public ValueParameter<B> PackingBinMeasuresParameter {
    50       get { return (ValueParameter<B>)Parameters["PackingBinMeasures"]; }
    51     }
    52     public ConstrainedValueParameter<IPackingSolutionDecoder> PackingSolutionDecoderParameter {
    53       get { return (ConstrainedValueParameter<IPackingSolutionDecoder>)Parameters["PackingSolutionDecoder"]; }
     49    public IValueParameter<B> PackingBinMeasuresParameter {
     50      get { return (IValueParameter<B>)Parameters["PackingBinMeasures"]; }
     51    }
     52    public IConstrainedValueParameter<IPackingSolutionDecoder> PackingSolutionDecoderParameter {
     53      get { return (IConstrainedValueParameter<IPackingSolutionDecoder>)Parameters["PackingSolutionDecoder"]; }
    5454    }
    5555    #endregion
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Shapes/CuboidPackingShape.cs

    r13032 r13461  
    3131  [StorableClass]
    3232  public abstract class CuboidPackingShape : PackingShape<ThreeDimensionalPacking>, IRegularPackingShape, IComparable<CuboidPackingShape> {
    33     #region Properties 
     33    #region Properties
    3434    /// <summary>
    3535    /// Describes the size on the X-axis
     
    6262    }
    6363    public override bool Encloses(ThreeDimensionalPacking checkedPosition, PackingShape<ThreeDimensionalPacking> checkedShape) {
    64       return Encloses(checkedPosition, (CuboidPackingShape) checkedShape);
     64      return Encloses(checkedPosition, (CuboidPackingShape)checkedShape);
    6565    }
    6666    private bool Encloses(ThreeDimensionalPacking checkedPosition, CuboidPackingShape checkedShape) {
    6767      return Encloses(new CuboidDiagonal(this), new CuboidDiagonal(checkedPosition, checkedShape));
    68     } 
     68    }
    6969    private bool Encloses(CuboidDiagonal c1, CuboidDiagonal c2) {
    7070      return (c1.x1 <= c2.x1 &&
     
    8484    private bool Overlaps(CuboidDiagonal c1, CuboidDiagonal c2) {
    8585      return !(c1.x1 > c2.x2 ||
    86                c1.y1 > c2.y2 || 
     86               c1.y1 > c2.y2 ||
    8787               c1.z1 > c2.z2 ||
    8888               c1.x2 < c2.x1 ||
     
    9898      }
    9999    }
    100     #endregion       
     100    #endregion
    101101
    102     public CuboidPackingShape(int width, int height, int depth) : base () {
     102    protected CuboidPackingShape(int width, int height, int depth)
     103      : base() {
    103104      this.Width = width;
    104105      this.Height = height;
     
    108109    public override void InitializeFromMeasures(int[] measures) {
    109110      if (measures.Length != 3)
    110         throw new InvalidOperationException("Nr of measures does not fit shape-dimension.");       
     111        throw new InvalidOperationException("Nr of measures does not fit shape-dimension.");
    111112      this.Width = measures[0];
    112113      this.Height = measures[1];
     
    125126      this.Depth = original.Depth;
    126127    }
    127     public CuboidPackingShape() : base(){ }
     128
     129    protected CuboidPackingShape() : base() { }
    128130
    129131    public override string ToString() {
     
    136138      //Using "Clustered-Area-Height"-comparison as descr
    137139
    138       int result = (this.Width * this.Depth).CompareTo (other.Width * other.Depth);
    139    
    140     if (result == 0)
    141     result = this.MultipliedMeasures.CompareTo(other.MultipliedMeasures);
    142       //if (result == 0) {
    143       //  result = this.Depth.CompareTo(other.Depth) + this.Width.CompareTo(other.Width);
    144       //  if (result == 0) {       
    145       //    result = this.Width.CompareTo(other.Width);
    146     if (result == 0)               
    147     result = this.Height.CompareTo(other.Height);
    148       //  }
    149       //}
     140      int result = (this.Width * this.Depth).CompareTo(other.Width * other.Depth);
     141
     142      if (result == 0)
     143        result = this.MultipliedMeasures.CompareTo(other.MultipliedMeasures);
     144      if (result == 0)
     145        result = this.Height.CompareTo(other.Height);
    150146      return result;
    151     }       
     147    }
    152148
    153149    public int CompareTo(object obj) {
    154       if (obj.GetType().Equals(this.GetType()))
     150      if (obj.GetType() == this.GetType())
    155151        return this.CompareTo((CuboidPackingShape)obj);
    156152      else return 0;
    157153    }
    158154
    159     #endregion 
     155    #endregion
    160156
    161157    private struct CuboidDiagonal {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Shapes/PackingShape.cs

    r13032 r13461  
    3030  [Item("PackingShape", "Represents an abstract shape to describe the measures and the positioning of objects related to bin-packing problems.")]
    3131  [StorableClass]
    32   public abstract class PackingShape<D> : NamedItem, IPackingShape
    33     where D: class, IPackingDimensions
    34   {
     32  public abstract class PackingShape<D> : Item, IPackingShape
     33    where D : class, IPackingDimensions {
    3534    public static Type PositionType {
    3635      get { return typeof(D); }
     
    4544    public abstract D Origin { get; }
    4645
    47     public PackingShape(int[] measures) {
     46    protected PackingShape(int[] measures) {
    4847      InitializeFromMeasures(measures);
    4948    }
    50     public PackingShape() {
    5149
    52     }
     50    protected PackingShape() { }
    5351
    5452
Note: See TracChangeset for help on using the changeset viewer.