Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/21/16 21:07:27 (8 years ago)
Author:
gkronber
Message:

#2641:

  • fixed persistence bug
  • added unit test to create BPP sample
  • added BPP sample to start page
  • renaming of properties
Location:
trunk/sources/HeuristicLab.Problems.BinPacking/3.3
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/Evaluators/BinUtilizationEvaluator.cs

    r14162 r14167  
    5353
    5454      for (int i = 0; i < nrOfBins; i++) {
    55         totalUsableSpace += solution.BinPackings[i].BinShape.Volume;
    56         totalUsedSpace += solution.BinPackings[i].Items.Sum(kvp => kvp.Value.Volume);
     55        totalUsableSpace += solution.Bins[i].BinShape.Volume;
     56        totalUsedSpace += solution.Bins[i].Items.Sum(kvp => kvp.Value.Volume);
    5757      }
    5858
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/Evaluators/PackingRatioEvaluator.cs

    r14162 r14167  
    6060      const double k = 2;
    6161      for (int i = 0; i < nrOfBins; i++) {
    62         double f = solution.BinPackings[i].Items.Sum(kvp => kvp.Value.Volume);
    63         double c = solution.BinPackings[i].BinShape.Volume;
     62        double f = solution.Bins[i].Items.Sum(kvp => kvp.Value.Volume);
     63        double c = solution.Bins[i].BinShape.Volume;
    6464        result += Math.Pow(f / c, k);
    6565      }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs

    r14162 r14167  
    5353      Solution partialSolution,
    5454      ref IList<int> remainingIDs, IList<PackingItem> items) {
    55       var bp = new BinPacking2D(partialSolution.BinMeasures);
     55      var bp = new BinPacking2D(partialSolution.BinShape);
    5656      bp.SlidingBasedPacking(ref remainingIDs, items);
    5757      return bp;
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/ExtremePointIntegerVectorDecoder.cs

    r14162 r14167  
    5353      Solution partialSolution,
    5454      ref IList<int> remainingIDs, IList<PackingItem> items) {
    55       var bp = new BinPacking2D(partialSolution.BinMeasures);
     55      var bp = new BinPacking2D(partialSolution.BinShape);
    5656      bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: false);
    5757      return bp;
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/IntegerVectorDecoderBase.cs

    r14162 r14167  
    4747      foreach (var sequence in sequenceMatrix) {
    4848        remainingIDs = remainingIDs.Concat(sequence).ToList();
    49         result.BinPackings.Add(CreatePacking(result, ref remainingIDs, items));
     49        result.Bins.Add(CreatePacking(result, ref remainingIDs, items));
    5050      }
    5151      result.UpdateBinPackings();
     
    5454      var temp = new List<int>(remainingIDs);
    5555      foreach (int id in temp) {
    56         foreach (BinPacking2D bp in result.BinPackings) {
     56        foreach (BinPacking2D bp in result.Bins) {
    5757          var position = FindPositionForItem(bp, items[id]);
    5858          if (position != null) {
     
    6666      //Put still remaining items in new bins
    6767      while (remainingIDs.Count > 0) {
    68         result.BinPackings.Add(CreatePacking(result, ref remainingIDs, items));
     68        result.Bins.Add(CreatePacking(result, ref remainingIDs, items));
    6969      }
    7070      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/PermutationEncoding/BottomLeftPermutationDecoder.cs

    r14162 r14167  
    4747        var bp = new BinPacking2D(binShape);
    4848        bp.SlidingBasedPacking(ref remainingIDs, items);
    49         result.BinPackings.Add(bp);
     49        result.Bins.Add(bp);
    5050      }
    5151      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/PermutationEncoding/ExtremePointPermutationDecoder.cs

    r14162 r14167  
    4747        var bp = new BinPacking2D(binShape);
    4848        bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: false);
    49         result.BinPackings.Add(bp);
     49        result.Bins.Add(bp);
    5050      }
    5151      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/Solution.cs

    r14162 r14167  
    2929  [StorableClass]
    3030  public class Solution : PackingPlan<PackingPosition, PackingShape, PackingItem> {
    31     public Solution(PackingShape binMeasures) : this(binMeasures, false, false) { }
    32     public Solution(PackingShape binMeasures, bool useExtremePoints, bool stackingConstraints) : base(binMeasures, useExtremePoints, stackingConstraints) { }
     31    public Solution(PackingShape binShape) : this(binShape, false, false) { }
     32    public Solution(PackingShape binShape, bool useExtremePoints, bool stackingConstraints) : base(binShape, useExtremePoints, stackingConstraints) { }
    3333    [StorableConstructor]
    3434    protected Solution(bool deserializing) : base(deserializing) { }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/Evaluators/BinUtilizationEvaluator.cs

    r14162 r14167  
    5454
    5555      for (int i = 0; i < nrOfBins; i++) {
    56         totalUsableSpace += solution.BinPackings[i].BinShape.Volume;
    57         totalUsedSpace += solution.BinPackings[i].Items.Sum(kvp => kvp.Value.Volume);
     56        totalUsableSpace += solution.Bins[i].BinShape.Volume;
     57        totalUsedSpace += solution.Bins[i].Items.Sum(kvp => kvp.Value.Volume);
    5858      }
    5959
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/Evaluators/PackingRatioEvaluator.cs

    r14162 r14167  
    6161      const double k = 2;
    6262      for (int i = 0; i < nrOfBins; i++) {
    63         double f = solution.BinPackings[i].Items.Sum(kvp => kvp.Value.Volume);
    64         double c = solution.BinPackings[i].BinShape.Volume;
     63        double f = solution.Bins[i].Items.Sum(kvp => kvp.Value.Volume);
     64        double c = solution.Bins[i].BinShape.Volume;
    6565        result += Math.Pow(f / c, k);
    6666      }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs

    r14162 r14167  
    6060      Solution partialSolution,
    6161      ref IList<int> remainingIDs, IList<PackingItem> items, bool useStackingConstraints) {
    62       var bp = new BinPacking3D(partialSolution.BinMeasures);
     62      var bp = new BinPacking3D(partialSolution.BinShape);
    6363      bp.SlidingBasedPacking(ref remainingIDs, items);
    6464      return bp;
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/ExtremePointIntegerVectorDecoder.cs

    r14162 r14167  
    5353      Solution partialSolution,
    5454      ref IList<int> remainingIDs, IList<PackingItem> items, bool useStackingConstraints) {
    55       var bp = new BinPacking3D(partialSolution.BinMeasures);
     55      var bp = new BinPacking3D(partialSolution.BinShape);
    5656      bp.ExtremePointBasedPacking(ref remainingIDs, items, useStackingConstraints);
    5757      return bp;
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/IntegerVectorDecoderBase.cs

    r14162 r14167  
    4747      foreach (var sequence in sequenceMatrix) {
    4848        remainingIDs = remainingIDs.Concat(sequence).ToList();
    49         result.BinPackings.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints));
     49        result.Bins.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints));
    5050      }
    5151      result.UpdateBinPackings();
     
    5454      var temp = new List<int>(remainingIDs);
    5555      foreach (int id in temp) {
    56         foreach (BinPacking3D bp in result.BinPackings) {
     56        foreach (BinPacking3D bp in result.Bins) {
    5757          var position = FindPositionForItem(bp, items[id], useStackingConstraints);
    5858          if (position != null) {
     
    6666      //Put still remaining items in new bins
    6767      while (remainingIDs.Count > 0) {
    68         result.BinPackings.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints));
     68        result.Bins.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints));
    6969      }
    7070      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/IntegerVectorProblem.cs

    r14162 r14167  
    3535  [Creatable(Category = CreatableAttribute.Categories.CombinatorialProblems, Priority = 330)]
    3636  public sealed class IntegerVectorProblem : ProblemBase<IntegerVectorEncoding, IntegerVector> {
    37     // persistence
    3837    [StorableConstructor]
    3938    private IntegerVectorProblem(bool deserializing) : base(deserializing) { }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/BottomLeftPermutationDecoder.cs

    r14162 r14167  
    4747        var bp = new BinPacking3D(binShape);
    4848        bp.SlidingBasedPacking(ref remainingIDs, items);
    49         result.BinPackings.Add(bp);
     49        result.Bins.Add(bp);
    5050      }
    5151      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/ExtremePointPermutationDecoder.cs

    r14162 r14167  
    4747        var bp = new BinPacking3D(binShape);
    4848        bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: useStackingConstraints);
    49         result.BinPackings.Add(bp);
     49        result.Bins.Add(bp);
    5050      }
    5151      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/PermutationProblem.cs

    r14162 r14167  
    3434  [Creatable(Category = CreatableAttribute.Categories.CombinatorialProblems, Priority = 320)]
    3535  public sealed class PermutationProblem : ProblemBase<PermutationEncoding, Permutation> {
    36     // persistence
    3736    [StorableConstructor]
    3837    private PermutationProblem(bool deserializing) : base(deserializing) { }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/Solution.cs

    r14162 r14167  
    88  [StorableClass]
    99  public class Solution : PackingPlan<PackingPosition, PackingShape, PackingItem> {
    10     public Solution(PackingShape binMeasures) : this(binMeasures, false, false) { }
    11     public Solution(PackingShape binMeasures, bool useExtremePoints, bool stackingConstraints) : base(binMeasures, useExtremePoints, stackingConstraints) { }
     10    public Solution(PackingShape binShape) : this(binShape, false, false) { }
     11    public Solution(PackingShape binShape, bool useExtremePoints, bool stackingConstraints) : base(binShape, useExtremePoints, stackingConstraints) { }
    1212    [StorableConstructor]
    1313    protected Solution(bool deserializing) : base(deserializing) { }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/PackingPlan.cs

    r14162 r14167  
    3838    public int NrOfBins {
    3939      get {
    40         if (BinPackings != null)
    41           return BinPackings.Count;
     40        if (Bins != null)
     41          return Bins.Count;
    4242        else return 0;
    4343      }
     
    4949
    5050    [Storable]
    51     public B BinMeasures { get; private set; }
     51    public B BinShape { get; private set; }
    5252
    5353    [Storable]
    54     public ObservableList<BinPacking<D, B, I>> BinPackings { get; set; }
     54    public ObservableList<BinPacking<D, B, I>> Bins { get; set; }
    5555
    5656    [Storable]
     
    6969    #endregion
    7070
    71     protected PackingPlan(B binMeasures, bool useExtremePoints, bool stackingConstraints)
     71    protected PackingPlan(B binShape, bool useExtremePoints, bool stackingConstraints)
    7272      : base() {
    73       BinMeasures = (B)binMeasures.Clone();
     73      BinShape = (B)binShape.Clone();
    7474      StackingConstraints = stackingConstraints;
    7575      UseExtremePoints = useExtremePoints;
    76       BinPackings = new ObservableList<BinPacking<D, B, I>>();
     76      Bins = new ObservableList<BinPacking<D, B, I>>();
    7777    }
    7878
     
    8181    protected PackingPlan(PackingPlan<D, B, I> original, Cloner cloner)
    8282      : base(original, cloner) {
    83       this.BinPackings = new ObservableList<BinPacking<D, B, I>>(original.BinPackings.Select(p => cloner.Clone(p)));
     83      this.Bins = new ObservableList<BinPacking<D, B, I>>(original.Bins.Select(p => cloner.Clone(p)));
    8484      UseExtremePoints = original.UseExtremePoints;
    8585      StackingConstraints = original.StackingConstraints;
    86       BinMeasures = cloner.Clone(original.BinMeasures);
     86      BinShape = cloner.Clone(original.BinShape);
    8787      Quality = cloner.Clone(original.Quality);
    8888    }
     
    9090
    9191    public void UpdateBinPackings() {
    92       BinPackings.RemoveAll(x => x.Positions.Count == 0);
    93       BinPackings = new ObservableList<BinPacking<D, B, I>>(BinPackings.OrderByDescending(bp => bp.PackingDensity));
     92      Bins.RemoveAll(x => x.Positions.Count == 0);
     93      Bins = new ObservableList<BinPacking<D, B, I>>(Bins.OrderByDescending(bp => bp.PackingDensity));
    9494    }
    9595
     
    110110      OnQualityChanged();
    111111    }
    112 
    113     public event EventHandler BinPackingsChanged;
    114112    #endregion
    115113  }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/PackingShape.cs

    r14162 r14167  
    7878    public abstract int CompareTo(object obj);
    7979
     80    [Storable]
    8081    public IKeyedItemCollection<string, IParameter> Parameters { get; private set; }
    8182  }
Note: See TracChangeset for help on using the changeset viewer.