1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Linq;
|
---|
25 | using System.Text;
|
---|
26 | using HeuristicLab.Problems.BinPacking.Dimensions;
|
---|
27 | using HeuristicLab.Problems.BinPacking.Interfaces;
|
---|
28 | using HeuristicLab.Problems.BinPacking.Shapes;
|
---|
29 | using HeuristicLab.Problems.BinPacking.PackingBin;
|
---|
30 | using HeuristicLab.Problems.BinPacking.PackingItem;
|
---|
31 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
32 | using HeuristicLab.Core;
|
---|
33 | using HeuristicLab.Common;
|
---|
34 | using HeuristicLab.Optimization;
|
---|
35 | using HeuristicLab.Problems.BinPacking.Evaluators;
|
---|
36 | using HeuristicLab.Encodings.PermutationEncoding;
|
---|
37 | using HeuristicLab.Data;
|
---|
38 | using HeuristicLab.Problems.BinPacking.Decoders;
|
---|
39 | using System.Reflection;
|
---|
40 | using System.IO;
|
---|
41 | using HeuristicLab.Parameters;
|
---|
42 | using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
|
---|
43 | using HeuristicLab.Encodings.PackingEncoding.GroupingVector;
|
---|
44 | using HeuristicLab.Problems.Instances;
|
---|
45 | using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
|
---|
46 |
|
---|
47 | namespace HeuristicLab.Problems.BinPacking.Problem {
|
---|
48 | [Item("ISOContainerBinPackingProblem", "Represents a three-dimensional bin-packing problem using two different bin sizes.")]
|
---|
49 | [StorableClass]
|
---|
50 | [Creatable("Problems")]
|
---|
51 | public class ISOContainerBinPackingProblem : CuboidIdenticalBinPackingProblem {
|
---|
52 |
|
---|
53 |
|
---|
54 | #region Default Instance
|
---|
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.",
|
---|
58 | BinMeasures = new int[] {25,25,35},
|
---|
59 | ItemMeasures = new int[][] {
|
---|
60 | new int[] {12,5,10},
|
---|
61 | new int[] {10,18,20},
|
---|
62 | new int[] {9,7,7},
|
---|
63 | new int[] {21,12,4},
|
---|
64 | new int[] {8,8,12},
|
---|
65 | new int[] {3,6,14},
|
---|
66 | new int[] {20,4,9},
|
---|
67 | new int[] {5,9,8},
|
---|
68 | new int[] {7,17,3},
|
---|
69 | new int[] {13,20,15},
|
---|
70 | new int[] {9,11,9},
|
---|
71 | new int[] {10,18,20},
|
---|
72 | new int[] {9,7,7},
|
---|
73 | new int[] {21,12,4},
|
---|
74 | new int[] {8,8,12},
|
---|
75 | new int[] {3,6,14},
|
---|
76 | new int[] {20,4,9},
|
---|
77 | new int[] {5,9,8},
|
---|
78 | new int[] {7,17,3},
|
---|
79 | new int[] {13,20,15},
|
---|
80 | new int[] {9,11,9},
|
---|
81 | new int[] {10,18,20},
|
---|
82 | new int[] {9,7,7},
|
---|
83 | new int[] {21,12,4},
|
---|
84 | new int[] {8,8,12},
|
---|
85 | new int[] {3,6,14},
|
---|
86 | new int[] {20,4,9},
|
---|
87 | new int[] {5,9,8},
|
---|
88 | new int[] {7,17,3},
|
---|
89 | new int[] {13,20,15},
|
---|
90 | new int[] {9,11,9},
|
---|
91 | new int[] {10,18,20},
|
---|
92 | new int[] {9,7,7},
|
---|
93 | new int[] {21,12,4},
|
---|
94 | new int[] {8,8,12},
|
---|
95 | new int[] {3,6,14},
|
---|
96 | new int[] {20,4,9},
|
---|
97 | new int[] {5,9,8},
|
---|
98 | new int[] {7,17,3},
|
---|
99 | new int[] {13,20,15},
|
---|
100 | new int[] {9,11,9}
|
---|
101 | },
|
---|
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 | }
|
---|
170 | };
|
---|
171 | #endregion
|
---|
172 |
|
---|
173 | [StorableConstructor]
|
---|
174 | protected ISOContainerBinPackingProblem(bool deserializing) : base(deserializing) { }
|
---|
175 | protected ISOContainerBinPackingProblem(ISOContainerBinPackingProblem original, Cloner cloner)
|
---|
176 | : base(original, cloner) {
|
---|
177 | }
|
---|
178 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
179 | return new ISOContainerBinPackingProblem(this, cloner);
|
---|
180 | }
|
---|
181 | public ISOContainerBinPackingProblem()
|
---|
182 | : base() {
|
---|
183 | }
|
---|
184 |
|
---|
185 |
|
---|
186 |
|
---|
187 | #region Helpers
|
---|
188 | protected override void InitializeDecoder() {
|
---|
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());
|
---|
194 | } else {
|
---|
195 | string error = "The given problem does not support the selected solution-creator.";
|
---|
196 | PluginInfrastructure.ErrorHandling.ShowErrorDialog(error, null);
|
---|
197 | }
|
---|
198 | }
|
---|
199 |
|
---|
200 | protected override void InitializeProblemData() {
|
---|
201 | Load(DefaultInstance);
|
---|
202 | }
|
---|
203 | #endregion
|
---|
204 | }
|
---|
205 | }
|
---|