#region License Information /* HeuristicLab * Copyright (C) 2002-2015 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.Persistence.Default.CompositeSerializers.Storable; using HeuristicLab.Problems.VehicleRouting.Encodings.General; namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { [Item("PotvinTwoOptStarMoveAttribute", "Two opt star move attribute")] [StorableType("AE168A83-DCF1-4D59-BB11-8460D5E3CA78")] public class PotvinTwoOptStarMoveAttribute : VRPMoveAttribute { [Storable] public int Tour { get; private set; } [Storable] public int City { get; private set; } [Storable] public double Distance { get; private set; } [Storable] public double Overload { get; private set; } [Storable] public double Tardiness { get; private set; } [StorableConstructor] protected PotvinTwoOptStarMoveAttribute(bool deserializing) : base(deserializing) { } protected PotvinTwoOptStarMoveAttribute(PotvinTwoOptStarMoveAttribute original, Cloner cloner) : base(original, cloner) { this.Tour = original.Tour; this.City = original.City; this.Distance = original.Distance; this.Overload = original.Overload; this.Tardiness = original.Tardiness; } public PotvinTwoOptStarMoveAttribute(double moveQuality, int tour, int city, double distance, double overload, double tardiness) : base(moveQuality) { Tour = tour; City = city; Distance = distance; Overload = overload; Tardiness = tardiness; } public override IDeepCloneable Clone(Cloner cloner) { return new PotvinTwoOptStarMoveAttribute(this, cloner); } public override int GetHashCode() { return Tour.GetHashCode() + City.GetHashCode(); } public override bool Equals(object obj) { if (obj is PotvinTwoOptStarMoveAttribute) { PotvinTwoOptStarMoveAttribute other = obj as PotvinTwoOptStarMoveAttribute; return Tour == other.Tour && City == other.City; } else { return base.Equals(obj); } } } }