Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/BinPackingProblem.cs @ 13620

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

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

File size: 4.4 KB
RevLine 
[9348]1#region License Information
2/* HeuristicLab
[13032]3 * Copyright (C) 2002-2015 Joseph Helm and Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[9348]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.Optimization;
23using HeuristicLab.Problems.BinPacking.Interfaces;
24using HeuristicLab.Problems.BinPacking.Shapes;
25using HeuristicLab.Core;
26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
27using HeuristicLab.Common;
28using HeuristicLab.Parameters;
[9440]29using HeuristicLab.Encodings.PackingEncoding.PackingPlan;
[9348]30using HeuristicLab.Data;
31
32namespace HeuristicLab.Problems.BinPacking.Problem {
33  [Item("BinPackingProblem", "Abstract class that represents a BinPacking Problem")]
34  [StorableClass]
35  public abstract class BinPackingProblem<D, B, I> : SingleObjectiveHeuristicOptimizationProblem<IPackingPlanEvaluationAlgorithm, IPackingSolutionCreator>
36    where D : class, IPackingDimensions
37    where B : PackingShape<D>, IPackingBin, new()
38    where I : PackingShape<D>, IPackingItem, new () {
39
40
41    #region Parameter Properties
42    public OptionalValueParameter<PackingPlan<D,B,I>> BestKnownSolutionParameter {
43      get { return (OptionalValueParameter<PackingPlan<D, B, I>>)Parameters["BestKnownSolution"]; }
44    }
45    public ValueParameter<ItemList<I>> PackingItemMeasuresParameter {
46      get { return (ValueParameter<ItemList<I>>)Parameters["PackingItemMeasures"]; }
47    }
48    public IFixedValueParameter<IntValue> PackingItemsParameter {
49      get { return (IFixedValueParameter<IntValue>)Parameters["PackingItems"]; }
50    }
51    public IFixedValueParameter<IntValue> LowerBoundParameter {
52      get { return (IFixedValueParameter<IntValue>)Parameters["LowerBound"]; }
53    }
54    public ValueParameter<IPackingPlanEvaluator> PackingPlanEvaluatorParameter {
55      get { return (ValueParameter<IPackingPlanEvaluator>)Parameters["PackingPlanEvaluator"]; }
56    }
57    #endregion
58
59    #region Properties
60    public PackingPlan<D, B, I> BestKnownSolution {
61      get { return BestKnownSolutionParameter.Value; }
62      set { BestKnownSolutionParameter.Value = value; }
63    }
64    public ItemList<I> PackingItemMeasures {
65      get { return PackingItemMeasuresParameter.Value; }
66      set { PackingItemMeasuresParameter.Value = value; }
67    }
68    public IPackingPlanEvaluator PackingPlanEvaluator {
69      get { return PackingPlanEvaluatorParameter.Value; }
70      set { PackingPlanEvaluatorParameter.Value = value; }
71    }
72    #endregion
73
74
75    [StorableConstructor]
76    protected BinPackingProblem(bool deserializing) : base(deserializing) { }
77    protected BinPackingProblem(BinPackingProblem<D,B,I> original, Cloner cloner)
78      : base(original, cloner) {
79    }                 
80    protected BinPackingProblem(IPackingPlanEvaluationAlgorithm e, IPackingSolutionCreator c) : base (e, c){
81      Parameters.Add(new OptionalValueParameter<PackingPlan<D, B, I>>("BestKnownSolution", "The best known solution of this bin-packing instance."));
82      Parameters.Add(new ValueParameter<ItemList<I>>("PackingItemMeasures", "Packing-item data defining the measures of the different items that need to be packed.", new ItemList<I>()));
83
84      Parameters.Add(new FixedValueParameter<IntValue>("PackingItems", "The number of packing-items used in this bin packing instance.", new IntValue()));
85      Parameters.Add(new FixedValueParameter<IntValue>("LowerBound", "The lower possible number of bins needed to solve this problem (taken from Dell'Amico, Martello and Vigo; 2002)", new IntValue()));
86    }
87
88    protected abstract void InitializeDecoder();
89    protected abstract void InitializeProblemInstance();
90    protected abstract void InitializeOperators();
91    protected abstract void InitializeEventHandlers();
92  }
93}
Note: See TracBrowser for help on using the repository browser.