#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("Generalized QAP Assignment", "Represents the solution as well as the problem parameters of a GQAP instance.")] [StorableClass] public sealed class GQAPAssignment : 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"); } } [Storable] private StringArray equipmentNames; public StringArray EquipmentNames { get { return equipmentNames; } set { bool changed = (equipmentNames != value); equipmentNames = value; if (changed) OnPropertyChanged("EquipmentNames"); } } [Storable] private StringArray locationNames; public StringArray LocationNames { get { return locationNames; } set { bool changed = (locationNames != value); locationNames = value; if (changed) OnPropertyChanged("LocationNames"); } } [Storable] private DoubleMatrix distances; public DoubleMatrix Distances { get { return distances; } set { bool changed = (distances != value); distances = value; if (changed) OnPropertyChanged("Distances"); } } [Storable] private DoubleMatrix weights; public DoubleMatrix Weights { get { return weights; } set { bool changed = (weights != value); weights = value; if (changed) OnPropertyChanged("Weights"); } } [Storable] private DoubleMatrix installationCosts; public DoubleMatrix InstallationCosts { get { return installationCosts; } set { bool changed = (installationCosts != value); installationCosts = value; if (changed) OnPropertyChanged("InstallationCosts"); } } [Storable] private DoubleArray demands; public DoubleArray Demands { get { return demands; } set { bool changed = (demands != value); demands = value; if (changed) OnPropertyChanged("Demands"); } } [Storable] private DoubleArray capacities; public DoubleArray Capacities { get { return capacities; } set { bool changed = (capacities != value); capacities = value; if (changed) OnPropertyChanged("Capacities"); } } [Storable] private DoubleValue transportationCosts; public DoubleValue TransportationCosts { get { return transportationCosts; } set { bool changed = (transportationCosts != value); transportationCosts = value; if (changed) OnPropertyChanged("TransportationCosts"); } } [Storable] private DoubleValue expectedRandomQuality; public DoubleValue ExpectedRandomQuality { get { return expectedRandomQuality; } set { bool changed = (expectedRandomQuality != value); expectedRandomQuality = value; if (changed) OnPropertyChanged("ExpectedRandomQuality"); } } [Storable] private IGQAPEvaluator evaluator; public IGQAPEvaluator Evaluator { get { return evaluator; } set { bool changed = (evaluator != value); evaluator = value; if (changed) OnPropertyChanged("Evaluator"); } } [StorableConstructor] private GQAPAssignment(bool deserializing) : base(deserializing) { } private GQAPAssignment(GQAPAssignment 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); equipmentNames = cloner.Clone(original.equipmentNames); locationNames = cloner.Clone(original.locationNames); distances = cloner.Clone(original.distances); weights = cloner.Clone(original.weights); installationCosts = cloner.Clone(original.installationCosts); demands = cloner.Clone(original.demands); capacities = cloner.Clone(original.capacities); transportationCosts = cloner.Clone(original.transportationCosts); expectedRandomQuality = cloner.Clone(original.expectedRandomQuality); evaluator = cloner.Clone(original.evaluator); } public GQAPAssignment(IntegerVector assignment, DoubleValue quality, DoubleValue flowDistanceQuality, DoubleValue installationQuality, DoubleValue overbookedCapacity, StringArray equipmentNames, StringArray locationNames, DoubleMatrix distances, DoubleMatrix weights, DoubleMatrix installationCosts, DoubleArray demands, DoubleArray capacities, DoubleValue transportationCosts, DoubleValue expectedRandomQuality, IGQAPEvaluator evaluator) : base() { this.assignment = assignment; this.quality = quality; this.flowDistanceQuality = flowDistanceQuality; this.installationQuality = installationQuality; this.overbookedCapacity = overbookedCapacity; this.equipmentNames = equipmentNames; this.locationNames = locationNames; this.distances = distances; this.weights = weights; this.installationCosts = installationCosts; this.demands = demands; this.capacities = capacities; this.transportationCosts = transportationCosts; this.expectedRandomQuality = expectedRandomQuality; this.evaluator = evaluator; } public override IDeepCloneable Clone(Cloner cloner) { return new GQAPAssignment(this, cloner); } public event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged(string propertyName) { var handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } } }