Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 9760 was 9440, checked in by jhelm, 12 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: 4.7 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.Optimization;
27using HeuristicLab.Problems.BinPacking.Interfaces;
28using HeuristicLab.Problems.BinPacking.Shapes;
29using HeuristicLab.Core;
30using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
31using HeuristicLab.Common;
32using HeuristicLab.Parameters;
33using HeuristicLab.Encodings.PackingEncoding.PackingPlan;
34using HeuristicLab.Problems.BinPacking.Evaluators;
35using HeuristicLab.Problems.BinPacking.Analyzers;
36using HeuristicLab.Encodings.PermutationEncoding;
37using HeuristicLab.PluginInfrastructure;
38using HeuristicLab.Data;
39
40namespace HeuristicLab.Problems.BinPacking.Problem {
41  [Item("BinPackingProblem", "Abstract class that represents a BinPacking Problem")]
42  [StorableClass]
43  public abstract class BinPackingProblem<D, B, I> : SingleObjectiveHeuristicOptimizationProblem<IPackingPlanEvaluationAlgorithm, IPackingSolutionCreator>
44    where D : class, IPackingDimensions
45    where B : PackingShape<D>, IPackingBin, new()
46    where I : PackingShape<D>, IPackingItem, new () {
47
48
49    #region Parameter Properties
50    public OptionalValueParameter<PackingPlan<D,B,I>> BestKnownSolutionParameter {
51      get { return (OptionalValueParameter<PackingPlan<D, B, I>>)Parameters["BestKnownSolution"]; }
52    }
53    public ValueParameter<ItemList<I>> PackingItemMeasuresParameter {
54      get { return (ValueParameter<ItemList<I>>)Parameters["PackingItemMeasures"]; }
55    }
56    public IFixedValueParameter<IntValue> PackingItemsParameter {
57      get { return (IFixedValueParameter<IntValue>)Parameters["PackingItems"]; }
58    }
59    public IFixedValueParameter<IntValue> LowerBoundParameter {
60      get { return (IFixedValueParameter<IntValue>)Parameters["LowerBound"]; }
61    }
62    public ValueParameter<IPackingPlanEvaluator> PackingPlanEvaluatorParameter {
63      get { return (ValueParameter<IPackingPlanEvaluator>)Parameters["PackingPlanEvaluator"]; }
64    }
65    #endregion
66
67    #region Properties
68    public PackingPlan<D, B, I> BestKnownSolution {
69      get { return BestKnownSolutionParameter.Value; }
70      set { BestKnownSolutionParameter.Value = value; }
71    }
72    public ItemList<I> PackingItemMeasures {
73      get { return PackingItemMeasuresParameter.Value; }
74      set { PackingItemMeasuresParameter.Value = value; }
75    }
76    public IPackingPlanEvaluator PackingPlanEvaluator {
77      get { return PackingPlanEvaluatorParameter.Value; }
78      set { PackingPlanEvaluatorParameter.Value = value; }
79    }
80    #endregion
81
82
83    [StorableConstructor]
84    protected BinPackingProblem(bool deserializing) : base(deserializing) { }
85    protected BinPackingProblem(BinPackingProblem<D,B,I> original, Cloner cloner)
86      : base(original, cloner) {
87    }                 
88    protected BinPackingProblem(IPackingPlanEvaluationAlgorithm e, IPackingSolutionCreator c) : base (e, c){
89      Parameters.Add(new OptionalValueParameter<PackingPlan<D, B, I>>("BestKnownSolution", "The best known solution of this bin-packing instance."));
90      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>()));
91
92      Parameters.Add(new FixedValueParameter<IntValue>("PackingItems", "The number of packing-items used in this bin packing instance.", new IntValue()));
93      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()));
94    }
95
96
97
98
99    #region Helpers         
100    protected abstract void InitializeDecoder();
101    protected abstract void InitializeProblemInstance();
102    protected abstract void InitializeOperators();
103    protected abstract void InitializeEventHandlers();
104    #endregion
105  }
106}
Note: See TracBrowser for help on using the repository browser.