#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.Persistence.Default.CompositeSerializers.Storable;
namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
[Item("GQAPAssignmentArchive", "Stores the pareto front of assignments.")]
[StorableClass]
public sealed class GQAPAssignmentArchive : Item, INotifyPropertyChanged {
[Storable]
private ItemList solutions;
public ItemList Solutions {
get { return solutions; }
set {
bool changed = (solutions != value);
solutions = value;
if (changed) OnPropertyChanged("Solutions");
}
}
[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 GQAPAssignmentArchive(bool deserializing) : base(deserializing) { }
private GQAPAssignmentArchive(GQAPAssignmentArchive original, Cloner cloner)
: base(original, cloner) {
solutions = cloner.Clone(original.solutions);
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 GQAPAssignmentArchive()
: base() {
this.solutions = new ItemList();
}
public GQAPAssignmentArchive(StringArray equipmentNames, StringArray locationNames, DoubleMatrix distances, DoubleMatrix weights, DoubleMatrix installationCosts, DoubleArray demands, DoubleArray capacities, DoubleValue transportationCosts, DoubleValue expectedRandomQuality, IGQAPEvaluator evaluator)
: this() {
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 GQAPAssignmentArchive(this, cloner);
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName) {
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}