Changeset 13461


Ignore:
Timestamp:
12/14/15 19:52:46 (5 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
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/HeuristicLab.Problems.BinPacking.Views-3.3.csproj

    r13028 r13461  
    120120      <Private>False</Private>
    121121    </Reference>
    122     <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    123       <Private>False</Private>
    124     </Reference>
    125122    <Reference Include="HeuristicLab.MainForm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    126123      <Private>False</Private>
     
    145142    <Reference Include="System" />
    146143    <Reference Include="System.Core" />
    147     <Reference Include="System.Data" />
    148144    <Reference Include="System.Drawing" />
    149145    <Reference Include="System.Windows.Forms" />
    150     <Reference Include="System.Xml" />
    151146  </ItemGroup>
    152147  <ItemGroup>
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Plugin.cs.frame

    r13161 r13461  
    2929  [PluginFile("HeuristicLab.Problems.BinPacking.Views-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginFile("PackingPlanVisualizations.dll", PluginFileType.Assembly)]
    31   [PluginDependency("HeuristicLab.Common", "3.3")]
    32   [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
    3331  [PluginDependency("HeuristicLab.Core", "3.3")]
    34   [PluginDependency("HeuristicLab.Persistence", "3.3")]
     32  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
     33  [PluginDependency("HeuristicLab.Optimization.Views", "3.3")]
     34  [PluginDependency("HeuristicLab.Problems.BinPacking", "3.3")]
     35  [PluginDependency("HeuristicLab.MainForm", "3.3")]
     36  [PluginDependency("HeuristicLab.Collections", "3.3")]
     37  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
     38  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    3539  [PluginDependency("HeuristicLab.SharpDX", "2.6.3")]
    3640  public class HeuristicLabProblemsBinPackingViewsPlugin : PluginBase {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/CuboidPackingItemView.Designer.cs

    r13032 r13461  
    4949    private void InitializeComponent() {
    5050      this.packingPlan3D1 = new PackingPlanVisualizations.PackingPlan3D();
    51       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5251      this.SuspendLayout();
    53       //
    54       // nameTextBox
    55       //
    56       this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    57       this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    5852      //
    5953      // packingPlan3D1
     
    7367      this.Name = "CuboidPackingShapeView";
    7468      this.Size = new System.Drawing.Size(351, 299);
    75       this.Controls.SetChildIndex(this.nameLabel, 0);
    76       this.Controls.SetChildIndex(this.nameTextBox, 0);
    77       this.Controls.SetChildIndex(this.infoLabel, 0);
    7869      this.Controls.SetChildIndex(this.packingPlan3D1, 0);
    79       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    8070      this.ResumeLayout(false);
    8171      this.PerformLayout();
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/CuboidPackingItemView.cs

    r13032 r13461  
    2727  [View("View for a cuboid packing item.")]
    2828  [Content(typeof(CuboidPackingItem), true)]
    29   public partial class CuboidPackingItemView : NamedItemView {
     29  public partial class CuboidPackingItemView : ItemView {
    3030    public CuboidPackingItemView() {
    3131      InitializeComponent();
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/CuboidPackingShapeView.Designer.cs

    r13032 r13461  
    4949    private void InitializeComponent() {
    5050      this.packingPlan3D1 = new PackingPlanVisualizations.PackingPlan3D();
    51       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5251      this.SuspendLayout();
    53       //
    54       // nameTextBox
    55       //
    56       this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    57       this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    5852      //
    5953      // packingPlan3D1
     
    7367      this.Name = "CuboidPackingShapeView";
    7468      this.Size = new System.Drawing.Size(351, 299);
    75       this.Controls.SetChildIndex(this.nameLabel, 0);
    76       this.Controls.SetChildIndex(this.nameTextBox, 0);
    77       this.Controls.SetChildIndex(this.infoLabel, 0);
    7869      this.Controls.SetChildIndex(this.packingPlan3D1, 0);
    79       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    8070      this.ResumeLayout(false);
    8171      this.PerformLayout();
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/CuboidPackingShapeView.cs

    r13032 r13461  
    2727  [View("View for a cuboid shape.")]
    2828  [Content(typeof(CuboidPackingShape), true)]
    29   public partial class CuboidPackingShapeView : NamedItemView {
     29  public partial class CuboidPackingShapeView : ItemView {
    3030    public CuboidPackingShapeView() {
    3131      InitializeComponent();
     
    4545      } else {
    4646        Redraw(Content);
    47         Content.Name = "XX";
    4847        packingPlan3D1.StartRendering();
    4948      }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/RectangularPackingItemView.Designer.cs

    r13032 r13461  
    4646    private void InitializeComponent() {
    4747      this.packingPlan2D = new PackingPlanVisualizations.PackingPlan2D();
    48       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    4948      this.SuspendLayout();
    50       //
    51       // nameTextBox
    52       //
    53       this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    54       this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    5549      //
    5650      // packingPlan2D
     
    7064      this.Name = "PackingPlanView";
    7165      this.Size = new System.Drawing.Size(351, 299);
    72       this.Controls.SetChildIndex(this.nameLabel, 0);
    73       this.Controls.SetChildIndex(this.nameTextBox, 0);
    74       this.Controls.SetChildIndex(this.infoLabel, 0);
    7566      this.Controls.SetChildIndex(this.packingPlan2D, 0);
    76       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    7767      this.ResumeLayout(false);
    7868      this.PerformLayout();
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/RectangularPackingItemView.cs

    r13032 r13461  
    2727  [View("View for a rectangular packing item.")]
    2828  [Content(typeof(RectangularPackingItem), true)]
    29   public partial class RectangularPackingItemView : NamedItemView {
     29  public partial class RectangularPackingItemView : ItemView {
    3030    public RectangularPackingItemView() {
    3131      InitializeComponent();
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/RectangularPackingShapeView.Designer.cs

    r13032 r13461  
    4646    private void InitializeComponent() {
    4747      this.packingPlan2D = new PackingPlanVisualizations.PackingPlan2D();
    48       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    4948      this.SuspendLayout();
    50       //
    51       // nameTextBox
    52       //
    53       this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    54       this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    5549      //
    5650      // packingPlan2D
     
    7064      this.Name = "PackingPlanView";
    7165      this.Size = new System.Drawing.Size(351, 299);
    72       this.Controls.SetChildIndex(this.nameLabel, 0);
    73       this.Controls.SetChildIndex(this.nameTextBox, 0);
    74       this.Controls.SetChildIndex(this.infoLabel, 0);
    7566      this.Controls.SetChildIndex(this.packingPlan2D, 0);
    76       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    7767      this.ResumeLayout(false);
    7868      this.PerformLayout();
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/RectangularPackingShapeView.cs

    r13032 r13461  
    2727  [View("View for a rectangular shape.")]
    2828  [Content(typeof(RectangularPackingShape), true)]
    29   public partial class RectangularPackingShapeView : NamedItemView {
     29  public partial class RectangularPackingShapeView : ItemView {
    3030    public RectangularPackingShapeView() {
    3131      InitializeComponent();
  • 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.