- Timestamp:
- 06/02/13 04:26:26 (11 years ago)
- Location:
- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/CuboidIdenticalBinPackingProblem.cs
r9495 r9563 44 44 using HeuristicLab.Problems.Instances; 45 45 using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector; 46 using HeuristicLab.PluginInfrastructure; 46 47 47 48 namespace HeuristicLab.Problems.BinPacking.Problem { … … 112 113 } 113 114 public CuboidIdenticalBinPackingProblem() : base( 114 new PackingPlanEvaluationAlgorithm<P ackingSequenceEncoding, ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>()) {115 new PackingPlanEvaluationAlgorithm<Permutation, ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>()) { 115 116 } 116 117 … … 121 122 Operators.RemoveAll(op => typeof(I2DOperator).IsAssignableFrom(op.GetType())); 122 123 123 if (SolutionCreator is PackingSequenceRandomCreator) { 124 PackingSolutionDecoder = new ExtremePointPackingSequenceDecoder3D(); 125 } else if (SolutionCreator is GroupingVectorRandomCreator) { 126 PackingSolutionDecoder = new ExtremePointGroupingVectorDecoder3D(); 127 } else if (SolutionCreator is MultiComponentVectorRandomCreator) { 128 PackingSolutionDecoder = new ExtremePointMultiComponentVectorDecoder3D(); 124 PackingSolutionDecoderParameter.ValidValues.Clear(); 125 if (SolutionCreator is PackingSequenceRandomCreator) { 126 PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I3DPSDecoder>()); 127 //PackingSolutionDecoder = new ExtremePointPackingSequenceDecoder3D(); 128 } else if (SolutionCreator is GroupingVectorRandomCreator) { 129 PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I3DGVDecoder>()); 130 //PackingSolutionDecoder = new ExtremePointGroupingVectorDecoder3D(); 131 } else if (SolutionCreator is MultiComponentVectorRandomCreator) { 132 PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I3DMCVDecoder>()); 133 //PackingSolutionDecoder = ApplicationManager.Manager.GetInstances<ExtremePointMultiComponentVectorDecoder3D>().First(); 129 134 } else { 130 135 string error = "The given problem does not support the selected solution-creator."; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/ISOContainerBinPackingProblem.cs
r9495 r9563 49 49 [StorableClass] 50 50 [Creatable("Problems")] 51 public class ISOContainerBinPackingProblem : RegularIdenticalBinPackingProblem<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> { 51 public class ISOContainerBinPackingProblem : CuboidIdenticalBinPackingProblem { 52 52 53 53 54 #region Default Instance 54 private static readonly BPPData DefaultInstance = newBPPData() {55 Name = "3D BPP Default Instance",56 Description = "The default instance for 3D Bin Packing .",55 private static readonly RealBPPData DefaultInstance = new RealBPPData() { 56 Name = "3D BPP with weigthed items Default Instance", 57 Description = "The default instance for 3D Bin Packing Problem with weighted items.", 57 58 BinMeasures = new int[] {25,25,35}, 58 59 ItemMeasures = new int[][] { … … 99 100 new int[] {9,11,9} 100 101 }, 101 Items = 30 102 Items = 30, 103 ItemWeights = new double[] { 104 12*5*10, 105 10*18*20, 106 9*7*7, 107 21*12*4, 108 8*8*12, 109 3*6*14, 110 20*4*9, 111 5*9*8, 112 7*17*3, 113 13*20*15, 114 9*11*9, 115 10*18*20, 116 9*7*7, 117 21*12*4, 118 8*8*12, 119 3*6*14, 120 20*4*9, 121 5*9*8, 122 7*17*3, 123 13*20*15, 124 9*11*9, 125 10*18*20, 126 9*7*7, 127 21*12*4, 128 8*8*12, 129 3*6*14, 130 20*4*9, 131 5*9*8, 132 7*17*3, 133 13*20*15, 134 9*11*9 135 }, 136 ItemMaterials = new int[] { 137 1, 138 0, 139 0, 140 1, 141 0, 142 0, 143 1, 144 1, 145 0, 146 1, 147 1, 148 0, 149 0, 150 1, 151 0, 152 0, 153 1, 154 1, 155 0, 156 1, 157 1, 158 0, 159 0, 160 1, 161 0, 162 0, 163 1, 164 1, 165 0, 166 1, 167 1, 168 169 } 102 170 }; 103 171 #endregion … … 111 179 return new ISOContainerBinPackingProblem(this, cloner); 112 180 } 113 public ISOContainerBinPackingProblem() : base(114 new PackingPlanEvaluationAlgorithm<PackingSequenceEncoding, ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>()) {181 public ISOContainerBinPackingProblem() 182 : base() { 115 183 } 116 184 … … 119 187 #region Helpers 120 188 protected override void InitializeDecoder() { 121 if (SolutionCreator is PackingSequenceRandomCreator) { 122 PackingSolutionDecoder = new ExtremePointPackingSequenceDecoder3D(); 123 } else if (SolutionCreator is GroupingVectorRandomCreator) { 124 PackingSolutionDecoder = new ExtremePointGroupingVectorDecoder3D(); 125 } else if (SolutionCreator is MultiComponentVectorRandomCreator) { 126 PackingSolutionDecoder = new ExtremePointMultiComponentVectorDecoder3D(); 189 Operators.RemoveAll(op => typeof(I2DOperator).IsAssignableFrom(op.GetType())); 190 191 PackingSolutionDecoderParameter.ValidValues.Clear(); 192 if (SolutionCreator is MultiComponentVectorRandomCreator) { 193 PackingSolutionDecoderParameter.ValidValues.Add(new ISOContainerMultiComponentVectorDecoder3D()); 127 194 } else { 128 195 string error = "The given problem does not support the selected solution-creator."; … … 131 198 } 132 199 133 protected override IPackingPlanEvaluator CreateDefaultEvaluator() {134 return new PackingRatioCuboidIdenticalBinEvaluator();135 }136 137 200 protected override void InitializeProblemData() { 138 201 Load(DefaultInstance); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/RectangularIdenticalBinPackingProblem.cs
r9495 r9563 108 108 } 109 109 public RectangularIdenticalBinPackingProblem() : base( 110 new PackingPlanEvaluationAlgorithm<P ackingSequenceEncoding, TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>()) {110 new PackingPlanEvaluationAlgorithm<Permutation, TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>()) { 111 111 } 112 112 … … 116 116 Operators.RemoveAll(op => typeof(I3DOperator).IsAssignableFrom(op.GetType())); 117 117 118 if (SolutionCreator is PackingSequenceRandomCreator) { 119 PackingSolutionDecoder = new ExtremePointPackingSequenceDecoder2D(); 120 } else if (SolutionCreator is GroupingVectorRandomCreator) { 121 PackingSolutionDecoder = new ExtremePointGroupingVectorDecoder2D(); 122 } else if (SolutionCreator is MultiComponentVectorRandomCreator) { 123 PackingSolutionDecoder = new ExtremePointMultiComponentVectorDecoder2D(); 118 PackingSolutionDecoderParameter.ValidValues.Clear(); 119 if (SolutionCreator is PackingSequenceRandomCreator) { 120 PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I2DPSDecoder>()); 121 //PackingSolutionDecoder = new ExtremePointPackingSequenceDecoder2D(); 122 } else if (SolutionCreator is GroupingVectorRandomCreator) { 123 PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I2DGVDecoder>()); 124 //PackingSolutionDecoder = new ExtremePointGroupingVectorDecoder2D(); 125 } else if (SolutionCreator is MultiComponentVectorRandomCreator) { 126 PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I2DMCVDecoder>()); 127 //PackingSolutionDecoder = new ExtremePointMultiComponentVectorDecoder2D(); 124 128 } else { 125 129 string error = "The given problem does not support the selected solution-creator."; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/RegularIdenticalBinPackingProblem.cs
r9495 r9563 56 56 get { return (ValueParameter<B>)Parameters["PackingBinMeasures"]; } 57 57 } 58 public OptionalValueParameter<IPackingSolutionDecoder> PackingSolutionDecoderParameter {59 get { return ( OptionalValueParameter<IPackingSolutionDecoder>)Parameters["PackingSolutionDecoder"]; }58 public ConstrainedValueParameter<IPackingSolutionDecoder> PackingSolutionDecoderParameter { 59 get { return (ConstrainedValueParameter<IPackingSolutionDecoder>)Parameters["PackingSolutionDecoder"]; } 60 60 } 61 61 #endregion … … 85 85 Parameters.Add(new ValueParameter<B>("PackingBinMeasures", "Packing-bin data defining the measures of the used bins.", new B())); 86 86 Parameters.Add(new ValueParameter<IPackingPlanEvaluator>("PackingPlanEvaluator", "The evaluator is used to determine the quality of a solution.", CreateDefaultEvaluator())); 87 Parameters.Add(new OptionalValueParameter<IPackingSolutionDecoder>("PackingSolutionDecoder", "The operator that decodes the representation and creates a packing plan."));87 Parameters.Add(new ConstrainedValueParameter<IPackingSolutionDecoder>("PackingSolutionDecoder", "The operator that decodes the representation and creates a packing plan.")); 88 88 this.Maximization.Value = true; 89 89 InitializeProblemInstance(); … … 232 232 233 233 #region Problem instance handling 234 public void Load(BPPData data) { 234 public virtual void Load(BPPData data) { 235 var realData = data as RealBPPData; 235 236 var binData = new B(); 236 237 binData.InitializeFromMeasures (data.BinMeasures); … … 241 242 item.InitializeFromMeasures(data.ItemMeasures[j]); 242 243 item.AddTargetBinMeasures(data.BinMeasures); 244 if (realData != null) { 245 item.Weight = realData.ItemWeights[j]; 246 item.Material = realData.ItemMaterials[j]; 247 } 243 248 itemData.Add(item); 244 249 }
Note: See TracChangeset
for help on using the changeset viewer.