Changeset 14167 for trunk/sources/HeuristicLab.Problems.BinPacking
- Timestamp:
- 07/21/16 21:07:27 (8 years ago)
- 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 53 53 54 54 for (int i = 0; i < nrOfBins; i++) { 55 totalUsableSpace += solution.Bin Packings[i].BinShape.Volume;56 totalUsedSpace += solution.Bin Packings[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); 57 57 } 58 58 -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/Evaluators/PackingRatioEvaluator.cs
r14162 r14167 60 60 const double k = 2; 61 61 for (int i = 0; i < nrOfBins; i++) { 62 double f = solution.Bin Packings[i].Items.Sum(kvp => kvp.Value.Volume);63 double c = solution.Bin Packings[i].BinShape.Volume;62 double f = solution.Bins[i].Items.Sum(kvp => kvp.Value.Volume); 63 double c = solution.Bins[i].BinShape.Volume; 64 64 result += Math.Pow(f / c, k); 65 65 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs
r14162 r14167 53 53 Solution partialSolution, 54 54 ref IList<int> remainingIDs, IList<PackingItem> items) { 55 var bp = new BinPacking2D(partialSolution.Bin Measures);55 var bp = new BinPacking2D(partialSolution.BinShape); 56 56 bp.SlidingBasedPacking(ref remainingIDs, items); 57 57 return bp; -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/ExtremePointIntegerVectorDecoder.cs
r14162 r14167 53 53 Solution partialSolution, 54 54 ref IList<int> remainingIDs, IList<PackingItem> items) { 55 var bp = new BinPacking2D(partialSolution.Bin Measures);55 var bp = new BinPacking2D(partialSolution.BinShape); 56 56 bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: false); 57 57 return bp; -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/IntegerVectorDecoderBase.cs
r14162 r14167 47 47 foreach (var sequence in sequenceMatrix) { 48 48 remainingIDs = remainingIDs.Concat(sequence).ToList(); 49 result.Bin Packings.Add(CreatePacking(result, ref remainingIDs, items));49 result.Bins.Add(CreatePacking(result, ref remainingIDs, items)); 50 50 } 51 51 result.UpdateBinPackings(); … … 54 54 var temp = new List<int>(remainingIDs); 55 55 foreach (int id in temp) { 56 foreach (BinPacking2D bp in result.Bin Packings) {56 foreach (BinPacking2D bp in result.Bins) { 57 57 var position = FindPositionForItem(bp, items[id]); 58 58 if (position != null) { … … 66 66 //Put still remaining items in new bins 67 67 while (remainingIDs.Count > 0) { 68 result.Bin Packings.Add(CreatePacking(result, ref remainingIDs, items));68 result.Bins.Add(CreatePacking(result, ref remainingIDs, items)); 69 69 } 70 70 result.UpdateBinPackings(); -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/PermutationEncoding/BottomLeftPermutationDecoder.cs
r14162 r14167 47 47 var bp = new BinPacking2D(binShape); 48 48 bp.SlidingBasedPacking(ref remainingIDs, items); 49 result.Bin Packings.Add(bp);49 result.Bins.Add(bp); 50 50 } 51 51 result.UpdateBinPackings(); -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/PermutationEncoding/ExtremePointPermutationDecoder.cs
r14162 r14167 47 47 var bp = new BinPacking2D(binShape); 48 48 bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: false); 49 result.Bin Packings.Add(bp);49 result.Bins.Add(bp); 50 50 } 51 51 result.UpdateBinPackings(); -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/Solution.cs
r14162 r14167 29 29 [StorableClass] 30 30 public class Solution : PackingPlan<PackingPosition, PackingShape, PackingItem> { 31 public Solution(PackingShape bin Measures) : this(binMeasures, false, false) { }32 public Solution(PackingShape bin Measures, 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) { } 33 33 [StorableConstructor] 34 34 protected Solution(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/Evaluators/BinUtilizationEvaluator.cs
r14162 r14167 54 54 55 55 for (int i = 0; i < nrOfBins; i++) { 56 totalUsableSpace += solution.Bin Packings[i].BinShape.Volume;57 totalUsedSpace += solution.Bin Packings[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); 58 58 } 59 59 -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/Evaluators/PackingRatioEvaluator.cs
r14162 r14167 61 61 const double k = 2; 62 62 for (int i = 0; i < nrOfBins; i++) { 63 double f = solution.Bin Packings[i].Items.Sum(kvp => kvp.Value.Volume);64 double c = solution.Bin Packings[i].BinShape.Volume;63 double f = solution.Bins[i].Items.Sum(kvp => kvp.Value.Volume); 64 double c = solution.Bins[i].BinShape.Volume; 65 65 result += Math.Pow(f / c, k); 66 66 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs
r14162 r14167 60 60 Solution partialSolution, 61 61 ref IList<int> remainingIDs, IList<PackingItem> items, bool useStackingConstraints) { 62 var bp = new BinPacking3D(partialSolution.Bin Measures);62 var bp = new BinPacking3D(partialSolution.BinShape); 63 63 bp.SlidingBasedPacking(ref remainingIDs, items); 64 64 return bp; -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/ExtremePointIntegerVectorDecoder.cs
r14162 r14167 53 53 Solution partialSolution, 54 54 ref IList<int> remainingIDs, IList<PackingItem> items, bool useStackingConstraints) { 55 var bp = new BinPacking3D(partialSolution.Bin Measures);55 var bp = new BinPacking3D(partialSolution.BinShape); 56 56 bp.ExtremePointBasedPacking(ref remainingIDs, items, useStackingConstraints); 57 57 return bp; -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/IntegerVectorDecoderBase.cs
r14162 r14167 47 47 foreach (var sequence in sequenceMatrix) { 48 48 remainingIDs = remainingIDs.Concat(sequence).ToList(); 49 result.Bin Packings.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints));49 result.Bins.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints)); 50 50 } 51 51 result.UpdateBinPackings(); … … 54 54 var temp = new List<int>(remainingIDs); 55 55 foreach (int id in temp) { 56 foreach (BinPacking3D bp in result.Bin Packings) {56 foreach (BinPacking3D bp in result.Bins) { 57 57 var position = FindPositionForItem(bp, items[id], useStackingConstraints); 58 58 if (position != null) { … … 66 66 //Put still remaining items in new bins 67 67 while (remainingIDs.Count > 0) { 68 result.Bin Packings.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints));68 result.Bins.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints)); 69 69 } 70 70 result.UpdateBinPackings(); -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/IntegerVectorProblem.cs
r14162 r14167 35 35 [Creatable(Category = CreatableAttribute.Categories.CombinatorialProblems, Priority = 330)] 36 36 public sealed class IntegerVectorProblem : ProblemBase<IntegerVectorEncoding, IntegerVector> { 37 // persistence38 37 [StorableConstructor] 39 38 private IntegerVectorProblem(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/BottomLeftPermutationDecoder.cs
r14162 r14167 47 47 var bp = new BinPacking3D(binShape); 48 48 bp.SlidingBasedPacking(ref remainingIDs, items); 49 result.Bin Packings.Add(bp);49 result.Bins.Add(bp); 50 50 } 51 51 result.UpdateBinPackings(); -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/ExtremePointPermutationDecoder.cs
r14162 r14167 47 47 var bp = new BinPacking3D(binShape); 48 48 bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: useStackingConstraints); 49 result.Bin Packings.Add(bp);49 result.Bins.Add(bp); 50 50 } 51 51 result.UpdateBinPackings(); -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/PermutationProblem.cs
r14162 r14167 34 34 [Creatable(Category = CreatableAttribute.Categories.CombinatorialProblems, Priority = 320)] 35 35 public sealed class PermutationProblem : ProblemBase<PermutationEncoding, Permutation> { 36 // persistence37 36 [StorableConstructor] 38 37 private PermutationProblem(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/Solution.cs
r14162 r14167 8 8 [StorableClass] 9 9 public class Solution : PackingPlan<PackingPosition, PackingShape, PackingItem> { 10 public Solution(PackingShape bin Measures) : this(binMeasures, false, false) { }11 public Solution(PackingShape bin Measures, 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) { } 12 12 [StorableConstructor] 13 13 protected Solution(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/PackingPlan.cs
r14162 r14167 38 38 public int NrOfBins { 39 39 get { 40 if (Bin Packings != null)41 return Bin Packings.Count;40 if (Bins != null) 41 return Bins.Count; 42 42 else return 0; 43 43 } … … 49 49 50 50 [Storable] 51 public B Bin Measures{ get; private set; }51 public B BinShape { get; private set; } 52 52 53 53 [Storable] 54 public ObservableList<BinPacking<D, B, I>> Bin Packings { get; set; }54 public ObservableList<BinPacking<D, B, I>> Bins { get; set; } 55 55 56 56 [Storable] … … 69 69 #endregion 70 70 71 protected PackingPlan(B bin Measures, bool useExtremePoints, bool stackingConstraints)71 protected PackingPlan(B binShape, bool useExtremePoints, bool stackingConstraints) 72 72 : base() { 73 Bin Measures = (B)binMeasures.Clone();73 BinShape = (B)binShape.Clone(); 74 74 StackingConstraints = stackingConstraints; 75 75 UseExtremePoints = useExtremePoints; 76 Bin Packings = new ObservableList<BinPacking<D, B, I>>();76 Bins = new ObservableList<BinPacking<D, B, I>>(); 77 77 } 78 78 … … 81 81 protected PackingPlan(PackingPlan<D, B, I> original, Cloner cloner) 82 82 : base(original, cloner) { 83 this.Bin Packings = 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))); 84 84 UseExtremePoints = original.UseExtremePoints; 85 85 StackingConstraints = original.StackingConstraints; 86 Bin Measures = cloner.Clone(original.BinMeasures);86 BinShape = cloner.Clone(original.BinShape); 87 87 Quality = cloner.Clone(original.Quality); 88 88 } … … 90 90 91 91 public void UpdateBinPackings() { 92 Bin Packings.RemoveAll(x => x.Positions.Count == 0);93 Bin Packings = 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)); 94 94 } 95 95 … … 110 110 OnQualityChanged(); 111 111 } 112 113 public event EventHandler BinPackingsChanged;114 112 #endregion 115 113 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/PackingShape.cs
r14162 r14167 78 78 public abstract int CompareTo(object obj); 79 79 80 [Storable] 80 81 public IKeyedItemCollection<string, IParameter> Parameters { get; private set; } 81 82 }
Note: See TracChangeset
for help on using the changeset viewer.