#region License Information /* HeuristicLab * Copyright (C) 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.Parameters; using HEAL.Attic; namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { [Item("PotvinPDShiftMoveEvaluator", "Evaluates a shift move for a PDP representation. ")] [StorableType("30977D1E-28BA-459A-98EA-D6BEEDB872A4")] public sealed class PotvinPDShiftMoveEvaluator : PotvinMoveEvaluator, IPotvinPDShiftMoveOperator { public ILookupParameter PDShiftMoveParameter { get { return (ILookupParameter)Parameters["PotvinPDShiftMove"]; } } public override ILookupParameter VRPMoveParameter { get { return PDShiftMoveParameter; } } public ILookupParameter MemoriesParameter { get { return (ILookupParameter)Parameters["Memories"]; } } public IValueParameter AdditionFrequencyMemoryKeyParameter { get { return (IValueParameter)Parameters["AdditionFrequencyMemoryKey"]; } } public IValueParameter LambdaParameter { get { return (IValueParameter)Parameters["Lambda"]; } } [StorableConstructor] private PotvinPDShiftMoveEvaluator(StorableConstructorFlag _) : base(_) { } public PotvinPDShiftMoveEvaluator() : base() { Parameters.Add(new LookupParameter("PotvinPDShiftMove", "The move that should be evaluated.")); Parameters.Add(new LookupParameter("Memories", "The TS memory collection.")); Parameters.Add(new ValueParameter("AdditionFrequencyMemoryKey", "The key that is used for the addition frequency in the TS memory.", new StringValue("AdditionFrequency"))); Parameters.Add(new ValueParameter("Lambda", "The lambda parameter.", new DoubleValue(0.015))); } public override IDeepCloneable Clone(Cloner cloner) { return new PotvinPDShiftMoveEvaluator(this, cloner); } private PotvinPDShiftMoveEvaluator(PotvinPDShiftMoveEvaluator original, Cloner cloner) : base(original, cloner) { } protected override void EvaluateMove() { PotvinPDShiftMove move = PDShiftMoveParameter.ActualValue; PotvinEncodedSolution newSolution = PDShiftMoveParameter.ActualValue.Individual.Clone() as PotvinEncodedSolution; PotvinPDShiftMoveMaker.Apply(newSolution, move, ProblemInstance); UpdateEvaluation(newSolution); } } }