source: branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/EvaluatorBase.cs @ 14052

Last change on this file since 14052 was 14052, checked in by gkronber, 5 years ago

#1966: deleted dead code

File size: 3.5 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
[13032]22
[9348]23using HeuristicLab.Core;
24using HeuristicLab.Operators;
25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
26using HeuristicLab.Common;
27using HeuristicLab.Parameters;
28using HeuristicLab.Data;
[14050]29using HeuristicLab.Collections;
[9348]30
[14046]31namespace HeuristicLab.Problems.BinPacking {
[9348]32  [Item("Packingplan Evaluator", "Represents a evaluator class for standard bin-packing problems.")]
33  [StorableClass]
[14050]34  public abstract class EvaluatorBase<D,B,I> : SingleSuccessorOperator, IEvaluator
[14048]35    where D : class, IPackingPosition
[14045]36    where B : PackingShape<D>
[9348]37    where I : PackingShape<D>, IPackingItem {
38
39    #region Parameters
40    public ILookupParameter<IRandom> RandomParameter {
41      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
42    }
43    public ILookupParameter<DoubleValue> QualityParameter {
44      get {
45        if (Parameters.ContainsKey("Quality"))
46          return (ILookupParameter<DoubleValue>)Parameters["Quality"];
47        else
48          return null;
49      }
50    }
51    public ILookupParameter<IPackingPlan> PackingPlanParameter {
52      get { return (ILookupParameter<IPackingPlan>)Parameters["PackingPlan"]; }
53    }
[14050]54    public ILookupParameter<ItemList<I>> PackingItemMeasuresParameter {
55      get { return (ILookupParameter<ItemList<I>>)Parameters["PackingItemMeasures"]; }
56    }
57    public ILookupParameter<B> PackingBinMeasuresParameter {
58      get { return (ILookupParameter<B>)Parameters["PackingBinMeasures"]; }
59    }
[9348]60    #endregion
61
62    [StorableConstructor]
[14050]63    protected EvaluatorBase(bool deserializing) : base(deserializing) { }
64    protected EvaluatorBase(EvaluatorBase<D,B,I> original, Cloner cloner)
[9348]65      : base(original, cloner) {
66    }
[14050]67    public EvaluatorBase()
[9348]68      : base() {
[14050]69      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value of the solution."));
[9348]70      Parameters.Add(new LookupParameter<IPackingPlan>("PackingPlan", "The decoded bin-packing solution represented as generalized packing-plan."));
71      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator."));
[14050]72      Parameters.Add(new LookupParameter<ItemList<I>>("PackingItemMeasures", "Packing-item data taken from the bin-packing problem-instance."));
73      Parameters.Add(new LookupParameter<B>("PackingBinMeasures", "Packing-bin data taken from the bin-packing problem-instance."));
74
[9348]75    }
76
[9495]77    protected abstract DoubleValue Evaluate();                                                                       
[9348]78    public override IOperation Apply() {
79      QualityParameter.ActualValue = Evaluate();
80      return base.Apply();
81    }
82  }
83}
Note: See TracBrowser for help on using the repository browser.