Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/ISOContainerBinPackingProblem.cs @ 13608

Last change on this file since 13608 was 13608, checked in by gkronber, 7 years ago

#1966 refactoring (moved 3d-specific classes into separate project)

File size: 5.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 Joseph Helm and 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
22using HeuristicLab.Problems.BinPacking.Interfaces;
23using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
24using HeuristicLab.Core;
25using HeuristicLab.Common;
26using HeuristicLab.Problems.BinPacking.Decoders;
27using HeuristicLab.Problems.Instances;
28using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
29
30namespace HeuristicLab.Problems.BinPacking.Problem {
31  [Item("Bin Packing Problem (3D, ISO containers) (BPP)", "Represents a three-dimensional bin-packing problem using two different bin sizes.")]
32  [StorableClass]
33  [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 320)]
34  public class ISOContainerBinPackingProblem : CuboidIdenticalBinPackingProblem {
35
36
37    #region Default Instance
38    private static readonly RealBPPData DefaultInstance = new RealBPPData() { 
39      Name = "3D BPP with weigthed items Default Instance",
40      Description = "The default instance for 3D Bin Packing Problem with weighted items.",
41      BinMeasures = new int[] {25,25,35},
42      ItemMeasures = new int[][] {
43        new int[] {12,5,10},
44        new int[] {10,18,20},
45        new int[] {9,7,7},
46        new int[] {21,12,4},
47        new int[] {8,8,12},
48        new int[] {3,6,14},
49        new int[] {20,4,9},
50        new int[] {5,9,8},
51        new int[] {7,17,3},
52        new int[] {13,20,15},
53        new int[] {9,11,9},
54        new int[] {10,18,20},
55        new int[] {9,7,7},
56        new int[] {21,12,4},
57        new int[] {8,8,12},
58        new int[] {3,6,14},
59        new int[] {20,4,9},
60        new int[] {5,9,8},
61        new int[] {7,17,3},
62        new int[] {13,20,15},
63        new int[] {9,11,9},
64        new int[] {10,18,20},
65        new int[] {9,7,7},
66        new int[] {21,12,4},
67        new int[] {8,8,12},
68        new int[] {3,6,14},
69        new int[] {20,4,9},
70        new int[] {5,9,8},
71        new int[] {7,17,3},
72        new int[] {13,20,15},
73        new int[] {9,11,9},
74        new int[] {10,18,20},
75        new int[] {9,7,7},
76        new int[] {21,12,4},
77        new int[] {8,8,12},
78        new int[] {3,6,14},
79        new int[] {20,4,9},
80        new int[] {5,9,8},
81        new int[] {7,17,3},
82        new int[] {13,20,15},
83        new int[] {9,11,9}
84      },
85      Items = 30,
86      ItemWeights = new double[] {
87        12*5*10,
88        10*18*20,
89        9*7*7,
90        21*12*4,
91        8*8*12,
92        3*6*14,
93        20*4*9,
94        5*9*8,
95        7*17*3,
96        13*20*15,
97        9*11*9,
98        10*18*20,
99        9*7*7,
100        21*12*4,
101        8*8*12,
102        3*6*14,
103        20*4*9,
104        5*9*8,
105        7*17*3,
106        13*20*15,
107        9*11*9,
108        10*18*20,
109        9*7*7,
110        21*12*4,
111        8*8*12,
112        3*6*14,
113        20*4*9,
114        5*9*8,
115        7*17*3,
116        13*20*15,
117        9*11*9
118      },
119      ItemMaterials = new int[] {
120        1,
121        0,
122        0,
123        1,
124        0,
125        0,
126        1,
127        1,
128        0,
129        1,
130        1,
131        0,
132        0,
133        1,
134        0,
135        0,
136        1,
137        1,
138        0,
139        1,
140        1,
141        0,
142        0,
143        1,
144        0,
145        0,
146        1,
147        1,
148        0,
149        1,
150        1,
151
152      }
153    };
154    #endregion
155   
156    [StorableConstructor]
157    protected ISOContainerBinPackingProblem(bool deserializing) : base(deserializing) { }
158    protected ISOContainerBinPackingProblem(ISOContainerBinPackingProblem original, Cloner cloner)
159      : base(original, cloner) {
160    }
161    public override IDeepCloneable Clone(Cloner cloner) {
162      return new ISOContainerBinPackingProblem(this, cloner);
163    }
164    public ISOContainerBinPackingProblem()
165      : base() {
166    }
167
168
169
170    #region Helpers
171    protected override void InitializeDecoder() {
172      // Operators.RemoveAll(op => op is I2DOperator); TODO
173
174      PackingSolutionDecoderParameter.ValidValues.Clear();
175      if (SolutionCreator is MultiComponentVectorRandomCreator) {
176        PackingSolutionDecoderParameter.ValidValues.Add(new ISOContainerMultiComponentVectorDecoder3D());
177      } else {
178        string error = "The given problem does not support the selected solution-creator.";
179        PluginInfrastructure.ErrorHandling.ShowErrorDialog(error, null);
180      }
181    }
182
183    protected override void InitializeProblemData() {
184      Load(DefaultInstance);
185    }
186    #endregion
187  }
188}
Note: See TracBrowser for help on using the repository browser.