- Timestamp:
- 07/21/16 10:19:55 (8 years ago)
- Location:
- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/BinPacking.cs
r14128 r14146 31 31 [Item("BinPacking", "Represents a single-bin packing for a bin-packing problem.")] 32 32 [StorableClass] 33 public abstract class BinPacking<D, B,I>: Item33 public abstract class BinPacking<D, B, I> : Item 34 34 where D : class, IPackingPosition 35 35 where B : PackingShape<D> 36 where I : PackingShape<D> , IPackingItem{36 where I : PackingShape<D> { 37 37 #region Properties 38 38 [Storable] 39 public ObservableDictionary<int, D> ItemPositions { get; private set; } 39 public ObservableDictionary<int, D> ItemPositions { get; private set; } 40 40 41 41 [Storable] … … 43 43 44 44 [Storable] 45 public B BinMeasures { get; private set; } 45 public B BinMeasures { get; private set; } 46 46 47 47 [Storable] … … 53 53 #endregion Properties 54 54 55 protected BinPacking(B binMeasures) : base() { 55 protected BinPacking(B binMeasures) 56 : base() { 56 57 ItemPositions = new ObservableDictionary<int, D>(); 57 58 ItemMeasures = new ObservableDictionary<int, I>(); … … 64 65 [StorableConstructor] 65 66 protected BinPacking(bool deserializing) : base(deserializing) { } 66 protected BinPacking(BinPacking<D, B,I> original, Cloner cloner)67 protected BinPacking(BinPacking<D, B, I> original, Cloner cloner) 67 68 : base(original, cloner) { 68 69 this.ItemPositions = new ObservableDictionary<int, D>(original.ItemPositions); 69 70 this.ItemMeasures = new ObservableDictionary<int, I>(original.ItemMeasures); 70 71 71 this.BinMeasures = (B)original.BinMeasures.Clone(cloner); 72 this.OccupationLayers = new Dictionary<int, List<int>>(original.OccupationLayers); 72 73 } 73 74 74 75 protected abstract void GenerateNewExtremePointsForNewItem(I measures, D position); 75 76 … … 77 78 public abstract D FindPositionBySliding(I measures, bool rotated); 78 79 79 public abstract void SlidingBasedPacking(ref List<int> sequence, ItemList<I> itemMeasures);80 public abstract void SlidingBasedPacking(ref List<int> sequence, ItemList<I> itemMeasures, Dictionary<int, bool> rotationArray);81 public abstract void ExtremePointBasedPacking(ref List<int> sequence, ItemList<I> itemMeasures, bool stackingConstraints);82 public abstract void ExtremePointBasedPacking(ref List<int> sequence, ItemList<I> itemMeasures, bool stackingConstraints, Dictionary<int, bool> rotationArray);80 public abstract void SlidingBasedPacking(ref IList<int> sequence, IList<I> itemMeasures); 81 public abstract void SlidingBasedPacking(ref IList<int> sequence, IList<I> itemMeasures, Dictionary<int, bool> rotationArray); 82 public abstract void ExtremePointBasedPacking(ref IList<int> sequence, IList<I> itemMeasures, bool stackingConstraints); 83 public abstract void ExtremePointBasedPacking(ref IList<int> sequence, IList<I> itemMeasures, bool stackingConstraints, Dictionary<int, bool> rotationArray); 83 84 84 85 public void PackItem(int itemID, I measures, D position) { … … 88 89 foreach (int id in ItemMeasures.Select(x => x.Key)) 89 90 GenerateNewExtremePointsForNewItem(ItemMeasures[id], ItemPositions[id]); 90 91 92 //GenerateNewExtremePointsForNewItem(measures, position);93 //OccupiedPoints.OccupyPoints(measures, position, itemID);94 91 95 92 AddNewItemToOccupationLayers(itemID, measures, position); 96 93 } 97 94 98 public double PackingDensity { 95 public double PackingDensity { 99 96 get { 100 97 double result = 0; … … 108 105 109 106 public int PointOccupation(D position) { 110 //foreach (var ipEntry in ItemPositions) {111 // if (ItemMeasures[ipEntry.Key].EnclosesPoint(ipEntry.Value, position))112 // return ipEntry.Key;113 //}114 107 foreach (var id in GetLayerItemIDs(position)) { 115 108 if (ItemMeasures[id].EnclosesPoint(ItemPositions[id], position)) … … 120 113 121 114 public bool IsPointOccupied(D position) { 122 //foreach (var ipEntry in ItemPositions) {123 // if (ItemMeasures[ipEntry.Key].EnclosesPoint(ipEntry.Value, position))124 // return true;125 //}126 115 foreach (var id in GetLayerItemIDs(position)) { 127 116 if (ItemMeasures[id].EnclosesPoint(ItemPositions[id], position)) … … 135 124 return false; 136 125 137 //foreach (var ipEntry in ItemPositions) {138 // if (ItemMeasures[ipEntry.Key].Overlaps(ipEntry.Value, position, measures))139 // return false;140 //}141 126 foreach (var id in GetLayerItemIDs(measures, position)) { 142 127 if (ItemMeasures[id].Overlaps(ItemPositions[id], position, measures)) … … 146 131 return true; 147 132 } 148 public abstract int ShortestPossibleSideFromPoint 149 public abstract bool IsStaticStable 133 public abstract int ShortestPossibleSideFromPoint(D position); 134 public abstract bool IsStaticStable(I measures, D position); 150 135 151 136 … … 154 139 protected abstract List<int> GetLayerItemIDs(D position); 155 140 protected abstract List<int> GetLayerItemIDs(I measures, D position); 156 } 141 } 157 142 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/PackingPlan.cs
r14128 r14146 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Linq; 25 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 28 27 using HeuristicLab.Data; 29 28 using HeuristicLab.Collections; 30 using HeuristicLab.Encodings.IntegerVectorEncoding;31 29 using HeuristicLab.Problems.BinPacking; 32 using HeuristicLab.Encodings.PermutationEncoding;33 30 34 31 namespace HeuristicLab.Encodings.PackingEncoding { -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj
r14128 r14146 158 158 </ItemGroup> 159 159 <ItemGroup> 160 <Compile Include="Analyzers\BestBinPackingSolutionAnalyzer.cs" />161 <Compile Include="Analyzers\BinPackingAnalyzer.cs" />162 160 <Compile Include="Encodings\PackingPlans\BinPacking.cs" /> 163 161 <Compile Include="Encodings\PackingPlans\PackingPlan.cs" /> … … 165 163 <Compile Include="Encodings\PackingSolutionCrossover.cs" /> 166 164 <Compile Include="Encodings\PackingSolutionManipulator.cs" /> 167 <Compile Include="Evaluators\BinUtilizationEvaluator.cs" />168 <Compile Include="Evaluators\DecodingEvaluator.cs" />169 <Compile Include="Evaluators\EvaluatorBase.cs" />170 <Compile Include="Evaluators\PackingRatioEvaluator.cs" />171 165 <Compile Include="Interfaces\IDecodingEvaluator.cs" /> 172 <Compile Include="Interfaces\IEvaluator.cs" />173 166 <Compile Include="Interfaces\IPackingPosition.cs" /> 174 167 <Compile Include="Interfaces\IPackingSequenceMoveOperator.cs" /> … … 188 181 <Compile Include="Interfaces\IPackingShape.cs" /> 189 182 <Compile Include="PackingDimensions.cs" /> 190 <Compile Include="PackingMoveEvaluator.cs" />191 183 <Compile Include="Interfaces\IPackingItem.cs" /> 192 184 <Compile Include="Interfaces\IPackingPlan.cs" /> … … 194 186 <Compile Include="PackingSolutionDecoder.cs" /> 195 187 <Compile Include="Plugin.cs" /> 196 <Compile Include="PackingSequenceProblem.cs" />197 188 <Compile Include="Properties\AssemblyInfo.cs" /> 198 189 </ItemGroup> … … 202 193 <None Include="Plugin.cs.frame" /> 203 194 </ItemGroup> 204 <ItemGroup /> 195 <ItemGroup> 196 <Folder Include="Evaluators\" /> 197 </ItemGroup> 205 198 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 206 199 <PropertyGroup> -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Interfaces/IEvaluator.cs
r14051 r14146 24 24 25 25 namespace HeuristicLab.Problems.BinPacking { 26 public interface IEvaluator : I SingleObjectiveEvaluator{27 ILookupParameter<IPackingPlan> PackingPlanParameter { get; }26 public interface IEvaluator : IItem { 27 double Evaluate(Solution ) 28 28 } 29 29 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingMoveEvaluator.cs
r14128 r14146 103 103 return base.Apply(); 104 104 } 105 106 105 107 } 106 108 }
Note: See TracChangeset
for help on using the changeset viewer.