Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/CuboidIdenticalBinPackingProblem.cs @ 9440

Last change on this file since 9440 was 9440, checked in by jhelm, 11 years ago

#1966: Implemented new encoding (MultiComponentVector/MCV); Implemented move-operators for MCV and GV encodings; Implemented new decoding-methods for PS, GV and MCV encodings (ExtremePoint-based packing);

File size: 5.3 KB
Line 
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
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Text;
26using HeuristicLab.Problems.BinPacking.Dimensions;
27using HeuristicLab.Problems.BinPacking.Interfaces;
28using HeuristicLab.Problems.BinPacking.Shapes;
29using HeuristicLab.Problems.BinPacking.PackingBin;
30using HeuristicLab.Problems.BinPacking.PackingItem;
31using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
32using HeuristicLab.Core;
33using HeuristicLab.Common;
34using HeuristicLab.Optimization;
35using HeuristicLab.Problems.BinPacking.Evaluators;
36using HeuristicLab.Encodings.PermutationEncoding;
37using HeuristicLab.Data;
38using HeuristicLab.Problems.BinPacking.Decoders;
39using System.Reflection;
40using System.IO;
41using HeuristicLab.Parameters;
42using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
43using HeuristicLab.Encodings.PackingEncoding.GroupingVector;
44using HeuristicLab.Problems.Instances;
45using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
46
47namespace HeuristicLab.Problems.BinPacking.Problem {
48  [Item("CuboidIdenticalBinPackingProblem", "Represents a three-dimensional bin-packing problem using only bins with identical measures and bins/items with cuboidic shapes.")]
49  [StorableClass]
50  [Creatable("Problems")]
51  public class CuboidIdenticalBinPackingProblem : RegularIdenticalBinPackingProblem<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> {
52
53    #region Default Instance
54    private static readonly BPPData DefaultInstance = new BPPData() { 
55      Name = "3D BPP Default Instance",
56      Description = "The default instance for 3D Bin Packing.",
57      BinMeasures = new int[] {25,25,35},
58      ItemMeasures = new int[][] {
59        new int[] {12,5,10},
60        new int[] {10,18,20},
61        new int[] {9,7,7},
62        new int[] {21,12,4},
63        new int[] {8,8,12},
64        new int[] {3,6,14},
65        new int[] {20,4,9},
66        new int[] {5,9,8},
67        new int[] {7,17,3},
68        new int[] {13,20,15},
69        new int[] {9,11,9},
70        new int[] {10,18,20},
71        new int[] {9,7,7},
72        new int[] {21,12,4},
73        new int[] {8,8,12},
74        new int[] {3,6,14},
75        new int[] {20,4,9},
76        new int[] {5,9,8},
77        new int[] {7,17,3},
78        new int[] {13,20,15},
79        new int[] {9,11,9},
80        new int[] {10,18,20},
81        new int[] {9,7,7},
82        new int[] {21,12,4},
83        new int[] {8,8,12},
84        new int[] {3,6,14},
85        new int[] {20,4,9},
86        new int[] {5,9,8},
87        new int[] {7,17,3},
88        new int[] {13,20,15},
89        new int[] {9,11,9},
90        new int[] {10,18,20},
91        new int[] {9,7,7},
92        new int[] {21,12,4},
93        new int[] {8,8,12},
94        new int[] {3,6,14},
95        new int[] {20,4,9},
96        new int[] {5,9,8},
97        new int[] {7,17,3},
98        new int[] {13,20,15},
99        new int[] {9,11,9}
100      },
101      Items = 30
102    };
103    #endregion
104   
105    [StorableConstructor]
106    protected CuboidIdenticalBinPackingProblem(bool deserializing) : base(deserializing) { }
107    protected CuboidIdenticalBinPackingProblem(CuboidIdenticalBinPackingProblem original, Cloner cloner)
108      : base(original, cloner) {
109    }
110    public override IDeepCloneable Clone(Cloner cloner) {
111      return new CuboidIdenticalBinPackingProblem(this, cloner);
112    }
113    public CuboidIdenticalBinPackingProblem() : base(
114      new PackingPlanEvaluationAlgorithm<PackingSequenceEncoding, ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>()) {
115    }
116
117
118
119    #region Helpers
120    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();
127      } else {
128        string error = "The given problem does not support the selected solution-creator.";
129        PluginInfrastructure.ErrorHandling.ShowErrorDialog(error, null);
130      }
131    }
132
133    protected override IPackingPlanEvaluator CreateDefaultEvaluator() {
134      return new PackingRatioCuboidIdenticalBinEvaluator();
135    }
136
137    protected override void InitializeProblemData() {
138      Load(DefaultInstance);
139    }
140    #endregion
141  }
142}
Note: See TracBrowser for help on using the repository browser.