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.Common;
|
---|
27 | using HeuristicLab.Core;
|
---|
28 | using HeuristicLab.Data;
|
---|
29 | using HeuristicLab.Operators;
|
---|
30 | using HeuristicLab.Optimization;
|
---|
31 | using HeuristicLab.Parameters;
|
---|
32 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
33 | using HeuristicLab.Problems.BinPacking.Interfaces;
|
---|
34 | using HeuristicLab.Encodings.PackingEncoding.PackingPlan;
|
---|
35 | using HeuristicLab.Problems.BinPacking.Shapes;
|
---|
36 |
|
---|
37 | namespace HeuristicLab.Problems.BinPacking.Analyzers {
|
---|
38 | [Item("BinPackingAnalyzer", "Represents the generalized form of Analyzers for BinPacking Problems.")]
|
---|
39 | [StorableClass]
|
---|
40 | public abstract class BinPackingAnalyzer<D, B, I> : SingleSuccessorOperator, IAnalyzer
|
---|
41 | where D : class, IPackingDimensions
|
---|
42 | where B : PackingShape<D>, IPackingBin
|
---|
43 | where I : PackingShape<D>, IPackingItem {
|
---|
44 | public virtual bool EnabledByDefault {
|
---|
45 | get { return true; }
|
---|
46 | }
|
---|
47 |
|
---|
48 | protected BinPackingAnalyzer(BinPackingAnalyzer<D,B,I> original, Cloner cloner)
|
---|
49 | : base(original, cloner) {
|
---|
50 | }
|
---|
51 |
|
---|
52 | #region Parameter Properties
|
---|
53 | public LookupParameter<BoolValue> MaximizationParameter {
|
---|
54 | get { return (LookupParameter<BoolValue>)Parameters["Maximization"]; }
|
---|
55 | }
|
---|
56 | public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
|
---|
57 | get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; }
|
---|
58 | }
|
---|
59 | public LookupParameter<PackingPlan<D, B, I>> BestSolutionParameter {
|
---|
60 | get { return (LookupParameter<PackingPlan<D, B, I>>)Parameters["BestSolution"]; }
|
---|
61 | }
|
---|
62 | public ValueLookupParameter<ResultCollection> ResultsParameter {
|
---|
63 | get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }
|
---|
64 | }
|
---|
65 | public LookupParameter<DoubleValue> BestKnownQualityParameter {
|
---|
66 | get { return (LookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
|
---|
67 | }
|
---|
68 | public LookupParameter<PackingPlan<D, B, I>> BestKnownSolutionParameter {
|
---|
69 | get { return (LookupParameter<PackingPlan<D, B, I>>)Parameters["BestKnownSolution"]; }
|
---|
70 | }
|
---|
71 | public ScopeTreeLookupParameter<PackingPlan<D, B, I>> PackingPlanParameter {
|
---|
72 | get { return (ScopeTreeLookupParameter<PackingPlan<D,B,I>>)Parameters["PackingPlan"]; }
|
---|
73 | }
|
---|
74 | #endregion
|
---|
75 |
|
---|
76 | public BinPackingAnalyzer()
|
---|
77 | : base() {
|
---|
78 | Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem."));
|
---|
79 | Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the packing solutions which should be analyzed."));
|
---|
80 | Parameters.Add(new ScopeTreeLookupParameter<PackingPlan<D, B, I>>("PackingPlan", "The solutions from which the best solution has to be chosen from."));
|
---|
81 | Parameters.Add(new LookupParameter<PackingPlan<D, B, I>>("BestSolution", "The best performing packing plan."));
|
---|
82 | Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best packing solution should be stored."));
|
---|
83 | Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this packing-problem instance."));
|
---|
84 | Parameters.Add(new LookupParameter<PackingPlan<D, B, I>>("BestKnownSolution", "The best known solution of this packing-problem instance."));
|
---|
85 | }
|
---|
86 | }
|
---|
87 | } |
---|