#region License Information /* HeuristicLab * Copyright (C) 2002-2017 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.Collections.Generic; using System.Linq; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { [Item("N-Move", "An N-Move describes the relocation of n equipments to n different locations.")] [StorableClass] public class NMove : Item { [Storable] private int[] reassignments; /// /// Contains for each equipment the newly assigned location. /// /// /// Locations are 1-based. A 0 indicates that this equipment is not reassigned. /// public IReadOnlyList Reassignments { get { return reassignments; } } [Storable] private List indices; /// /// Which indices (=equipments) are reassigned. /// /// /// Equipments are 0-based. /// public IReadOnlyList Indices { get { return indices; } } public int N { get { return Indices.Count; } } [StorableConstructor] protected NMove(bool deserializing) : base(deserializing) { } protected NMove(NMove original, Cloner cloner) : base(original, cloner) { reassignments = original.reassignments.ToArray(); indices = original.indices.ToList(); } public NMove(int[] reassignments, List indices) : base() { this.reassignments = reassignments; this.indices = indices; } public override IDeepCloneable Clone(Cloner cloner) { return new NMove(this, cloner); } } }