[7418] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
| 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using System.ComponentModel;
|
---|
| 23 | using HeuristicLab.Common;
|
---|
| 24 | using HeuristicLab.Core;
|
---|
| 25 | using HeuristicLab.Data;
|
---|
| 26 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 27 |
|
---|
| 28 | namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
|
---|
| 29 | [Item("GQAPAssignmentArchive", "Stores the pareto front of assignments.")]
|
---|
| 30 | [StorableClass]
|
---|
[7935] | 31 | public sealed class GQAPAssignmentArchive : Item, INotifyPropertyChanged {
|
---|
[7418] | 32 |
|
---|
| 33 | [Storable]
|
---|
| 34 | private ItemList<GQAPSolution> solutions;
|
---|
| 35 | public ItemList<GQAPSolution> Solutions {
|
---|
| 36 | get { return solutions; }
|
---|
| 37 | set {
|
---|
| 38 | bool changed = (solutions != value);
|
---|
| 39 | solutions = value;
|
---|
| 40 | if (changed) OnPropertyChanged("Solutions");
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | [Storable]
|
---|
| 45 | private StringArray equipmentNames;
|
---|
| 46 | public StringArray EquipmentNames {
|
---|
| 47 | get { return equipmentNames; }
|
---|
| 48 | set {
|
---|
| 49 | bool changed = (equipmentNames != value);
|
---|
| 50 | equipmentNames = value;
|
---|
| 51 | if (changed) OnPropertyChanged("EquipmentNames");
|
---|
| 52 | }
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | [Storable]
|
---|
| 56 | private StringArray locationNames;
|
---|
| 57 | public StringArray LocationNames {
|
---|
| 58 | get { return locationNames; }
|
---|
| 59 | set {
|
---|
| 60 | bool changed = (locationNames != value);
|
---|
| 61 | locationNames = value;
|
---|
| 62 | if (changed) OnPropertyChanged("LocationNames");
|
---|
| 63 | }
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | [Storable]
|
---|
| 67 | private DoubleMatrix distances;
|
---|
| 68 | public DoubleMatrix Distances {
|
---|
| 69 | get { return distances; }
|
---|
| 70 | set {
|
---|
| 71 | bool changed = (distances != value);
|
---|
| 72 | distances = value;
|
---|
| 73 | if (changed) OnPropertyChanged("Distances");
|
---|
| 74 | }
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | [Storable]
|
---|
| 78 | private DoubleMatrix weights;
|
---|
| 79 | public DoubleMatrix Weights {
|
---|
| 80 | get { return weights; }
|
---|
| 81 | set {
|
---|
| 82 | bool changed = (weights != value);
|
---|
| 83 | weights = value;
|
---|
| 84 | if (changed) OnPropertyChanged("Weights");
|
---|
| 85 | }
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | [Storable]
|
---|
| 89 | private DoubleMatrix installationCosts;
|
---|
| 90 | public DoubleMatrix InstallationCosts {
|
---|
| 91 | get { return installationCosts; }
|
---|
| 92 | set {
|
---|
| 93 | bool changed = (installationCosts != value);
|
---|
| 94 | installationCosts = value;
|
---|
| 95 | if (changed) OnPropertyChanged("InstallationCosts");
|
---|
| 96 | }
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | [Storable]
|
---|
| 100 | private DoubleArray demands;
|
---|
| 101 | public DoubleArray Demands {
|
---|
| 102 | get { return demands; }
|
---|
| 103 | set {
|
---|
| 104 | bool changed = (demands != value);
|
---|
| 105 | demands = value;
|
---|
| 106 | if (changed) OnPropertyChanged("Demands");
|
---|
| 107 | }
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | [Storable]
|
---|
| 111 | private DoubleArray capacities;
|
---|
| 112 | public DoubleArray Capacities {
|
---|
| 113 | get { return capacities; }
|
---|
| 114 | set {
|
---|
| 115 | bool changed = (capacities != value);
|
---|
| 116 | capacities = value;
|
---|
| 117 | if (changed) OnPropertyChanged("Capacities");
|
---|
| 118 | }
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | [Storable]
|
---|
| 122 | private DoubleValue transportationCosts;
|
---|
| 123 | public DoubleValue TransportationCosts {
|
---|
| 124 | get { return transportationCosts; }
|
---|
| 125 | set {
|
---|
| 126 | bool changed = (transportationCosts != value);
|
---|
| 127 | transportationCosts = value;
|
---|
| 128 | if (changed) OnPropertyChanged("TransportationCosts");
|
---|
| 129 | }
|
---|
| 130 | }
|
---|
| 131 |
|
---|
| 132 | [Storable]
|
---|
[7970] | 133 | private DoubleValue expectedRandomQuality;
|
---|
| 134 | public DoubleValue ExpectedRandomQuality {
|
---|
| 135 | get { return expectedRandomQuality; }
|
---|
[7418] | 136 | set {
|
---|
[7970] | 137 | bool changed = (expectedRandomQuality != value);
|
---|
| 138 | expectedRandomQuality = value;
|
---|
| 139 | if (changed) OnPropertyChanged("ExpectedRandomQuality");
|
---|
[7418] | 140 | }
|
---|
| 141 | }
|
---|
| 142 |
|
---|
[7970] | 143 | [Storable]
|
---|
| 144 | private IGQAPEvaluator evaluator;
|
---|
| 145 | public IGQAPEvaluator Evaluator {
|
---|
| 146 | get { return evaluator; }
|
---|
| 147 | set {
|
---|
| 148 | bool changed = (evaluator != value);
|
---|
| 149 | evaluator = value;
|
---|
| 150 | if (changed) OnPropertyChanged("Evaluator");
|
---|
| 151 | }
|
---|
| 152 | }
|
---|
| 153 |
|
---|
[7418] | 154 | [StorableConstructor]
|
---|
| 155 | private GQAPAssignmentArchive(bool deserializing) : base(deserializing) { }
|
---|
| 156 | private GQAPAssignmentArchive(GQAPAssignmentArchive original, Cloner cloner)
|
---|
| 157 | : base(original, cloner) {
|
---|
[7432] | 158 | solutions = cloner.Clone(original.solutions);
|
---|
[7418] | 159 | equipmentNames = cloner.Clone(original.equipmentNames);
|
---|
| 160 | locationNames = cloner.Clone(original.locationNames);
|
---|
| 161 | distances = cloner.Clone(original.distances);
|
---|
| 162 | weights = cloner.Clone(original.weights);
|
---|
| 163 | installationCosts = cloner.Clone(original.installationCosts);
|
---|
| 164 | demands = cloner.Clone(original.demands);
|
---|
| 165 | capacities = cloner.Clone(original.capacities);
|
---|
| 166 | transportationCosts = cloner.Clone(original.transportationCosts);
|
---|
[7970] | 167 | expectedRandomQuality = cloner.Clone(original.expectedRandomQuality);
|
---|
| 168 | evaluator = cloner.Clone(original.evaluator);
|
---|
[7418] | 169 | }
|
---|
| 170 | public GQAPAssignmentArchive()
|
---|
| 171 | : base() {
|
---|
| 172 | this.solutions = new ItemList<GQAPSolution>();
|
---|
| 173 | }
|
---|
[7970] | 174 | public GQAPAssignmentArchive(StringArray equipmentNames, StringArray locationNames, DoubleMatrix distances, DoubleMatrix weights, DoubleMatrix installationCosts, DoubleArray demands, DoubleArray capacities, DoubleValue transportationCosts, DoubleValue expectedRandomQuality, IGQAPEvaluator evaluator)
|
---|
[7418] | 175 | : this() {
|
---|
| 176 | this.distances = distances;
|
---|
| 177 | this.weights = weights;
|
---|
| 178 | this.installationCosts = installationCosts;
|
---|
| 179 | this.demands = demands;
|
---|
| 180 | this.capacities = capacities;
|
---|
| 181 | this.transportationCosts = transportationCosts;
|
---|
[7970] | 182 | this.expectedRandomQuality = expectedRandomQuality;
|
---|
| 183 | this.evaluator = evaluator;
|
---|
[7418] | 184 | }
|
---|
| 185 |
|
---|
| 186 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 187 | return new GQAPAssignmentArchive(this, cloner);
|
---|
| 188 | }
|
---|
| 189 |
|
---|
| 190 | public event PropertyChangedEventHandler PropertyChanged;
|
---|
| 191 | private void OnPropertyChanged(string propertyName) {
|
---|
| 192 | var handler = PropertyChanged;
|
---|
| 193 | if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
---|
| 194 | }
|
---|
| 195 | }
|
---|
| 196 | }
|
---|