#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.ComponentModel; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Data; 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 { bool changed = (assignment != value); assignment = value; if (changed) OnPropertyChanged("Assignment"); } } [Storable] private DoubleValue quality; public DoubleValue Quality { get { return quality; } set { bool changed = (quality != value); quality = value; if (changed) OnPropertyChanged("Quality"); } } [Storable] private DoubleValue flowDistanceQuality; public DoubleValue FlowDistanceQuality { get { return flowDistanceQuality; } set { bool changed = (flowDistanceQuality != value); flowDistanceQuality = value; if (changed) OnPropertyChanged("FlowDistanceQuality"); } } [Storable] private DoubleValue installationQuality; public DoubleValue InstallationQuality { get { return installationQuality; } set { bool changed = (installationQuality != value); installationQuality = value; if (changed) OnPropertyChanged("InstallationQuality"); } } [Storable] private DoubleValue overbookedCapacity; public DoubleValue OverbookedCapacity { get { return overbookedCapacity; } set { bool changed = (overbookedCapacity != value); overbookedCapacity = value; if (changed) OnPropertyChanged("OverbookedCapacity"); } } [StorableConstructor] protected GQAPSolution(bool deserializing) : base(deserializing) { } protected GQAPSolution(GQAPSolution original, Cloner cloner) : base(original, cloner) { assignment = cloner.Clone(original.assignment); quality = cloner.Clone(original.quality); flowDistanceQuality = cloner.Clone(original.flowDistanceQuality); installationQuality = cloner.Clone(original.installationQuality); overbookedCapacity = cloner.Clone(original.overbookedCapacity); } public GQAPSolution(IntegerVector assignment, DoubleValue quality, DoubleValue flowDistanceQuality, DoubleValue installationQuality, DoubleValue overbookedCapacity) : base() { this.assignment = assignment; this.quality = quality; this.flowDistanceQuality = flowDistanceQuality; this.installationQuality = installationQuality; this.overbookedCapacity = overbookedCapacity; } 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)); } } }