#region License Information /* HeuristicLab * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Data; using HeuristicLab.Encodings.BinaryVectorEncoding; using HeuristicLab.Operators; using HeuristicLab.Optimization; using HeuristicLab.Parameters; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Problems.Knapsack { /// /// A base class for operators which evaluate Knapsack moves. /// [Item("KnapsackMoveEvaluator", "A base class for operators which evaluate Knapsack moves.")] [StorableClass] public abstract class KnapsackMoveEvaluator : SingleSuccessorOperator, IKnapsackMoveEvaluator, IMoveOperator, IBinaryVectorMoveOperator { public ILookupParameter QualityParameter { get { return (ILookupParameter)Parameters["Quality"]; } } public ILookupParameter MoveQualityParameter { get { return (ILookupParameter)Parameters["MoveQuality"]; } } public ILookupParameter BinaryVectorParameter { get { return (ILookupParameter)Parameters["BinaryVector"]; } } public ILookupParameter KnapsackCapacityParameter { get { return (ILookupParameter)Parameters["KnapsackCapacity"]; } } public ILookupParameter PenaltyParameter { get { return (ILookupParameter)Parameters["Penalty"]; } } public ILookupParameter WeightsParameter { get { return (ILookupParameter)Parameters["Weights"]; } } public ILookupParameter ValuesParameter { get { return (ILookupParameter)Parameters["Values"]; } } [StorableConstructor] protected KnapsackMoveEvaluator(bool deserializing) : base(deserializing) { } protected KnapsackMoveEvaluator(KnapsackMoveEvaluator original, Cloner cloner) : base(original, cloner) { } protected KnapsackMoveEvaluator() : base() { Parameters.Add(new LookupParameter("Quality", "The quality of a Knapsack solution.")); Parameters.Add(new LookupParameter("MoveQuality", "The evaluated quality of a move on a Knapsack solution.")); Parameters.Add(new LookupParameter("BinaryVector", "The solution as BinaryVector.")); Parameters.Add(new LookupParameter("KnapsackCapacity", "Capacity of the Knapsack.")); Parameters.Add(new LookupParameter("Weights", "The weights of the items.")); Parameters.Add(new LookupParameter("Values", "The values of the items.")); Parameters.Add(new LookupParameter("Penalty", "The penalty value for each unit of overweight.")); } } }