#region License Information /* HeuristicLab * Copyright (C) 2002-2012 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 System; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Encodings.IntegerVectorEncoding; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { [Item("n-move", "An n-move describes moving n equipments to n locations.")] [StorableClass] public class NMove : Item { [Storable] public int[] Equipments { get; private set; } [Storable] public int[] Locations { get; private set; } [Storable] public IntegerVector OriginalVector { get; private set; } public int N { get { return Equipments.Length; } } [StorableConstructor] protected NMove(bool deserializing) : base(deserializing) { } protected NMove(NMove original, Cloner cloner) : base(original, cloner) { Equipments = (int[])original.Equipments.Clone(); Locations = (int[])original.Locations.Clone(); if (original.OriginalVector != null) OriginalVector = cloner.Clone(original.OriginalVector); } public NMove() : this(new int[0], new int[0], null) { } public NMove(int[] equipments, int[] locations) : this(equipments, locations, null) { } public NMove(int[] equipments, int[] locations, IntegerVector originalVector) : base() { if (equipments == null) throw new ArgumentNullException("equipments", "NMove: Equipments must not be null."); if (locations == null) throw new ArgumentNullException("locations", "NMove: Locations must not be null."); if (equipments.Length != locations.Length) throw new ArgumentException("NMove: Length of equipments and locations is not identical."); Equipments = equipments; Locations = locations; OriginalVector = originalVector; } public override IDeepCloneable Clone(Cloner cloner) { return new NMove(this, cloner); } } }