#region License Information /* HeuristicLab * Copyright (C) 2002-2018 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.ComponentModel; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Encodings.IntegerVectorEncoding; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { [Item("GQAPSolution", "A solution to the Generalized Quadratic Assignment Problem.")] [StorableClass] public class GQAPSolution : Item, INotifyPropertyChanged { [Storable] private IntegerVector assignment; public IntegerVector Assignment { get { return assignment; } set { if (assignment == value) return; assignment = value; OnPropertyChanged(nameof(Assignment)); } } [Storable] private Evaluation evaluation; public Evaluation Evaluation { get { return evaluation; } set { if (evaluation == value) return; evaluation = value; OnPropertyChanged(nameof(Evaluation)); } } [StorableConstructor] protected GQAPSolution(bool deserializing) : base(deserializing) { } protected GQAPSolution(GQAPSolution original, Cloner cloner) : base(original, cloner) { assignment = cloner.Clone(original.assignment); evaluation = cloner.Clone(original.evaluation); } public GQAPSolution(IntegerVector assignment, Evaluation evaluation) : base() { this.assignment = assignment; this.evaluation = evaluation; } public override IDeepCloneable Clone(Cloner cloner) { return new GQAPSolution(this, cloner); } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { var handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } } }