Free cookie consent management tool by TermsFeed Policy Generator

source: branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GQAPAssignmentArchive.cs @ 7505

Last change on this file since 7505 was 7432, checked in by abeham, 12 years ago

#1614

  • updated gqap (finished path-relinking)
  • fixed some bugs
File size: 6.2 KB
Line 
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
22using System.ComponentModel;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Data;
26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
27
28namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
29  [Item("GQAPAssignmentArchive", "Stores the pareto front of assignments.")]
30  [StorableClass]
31  public class GQAPAssignmentArchive : Item, INotifyPropertyChanged {
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]
133    private DoubleValue overbookedCapacityPenalty;
134    public DoubleValue OverbookedCapacityPenalty {
135      get { return overbookedCapacityPenalty; }
136      set {
137        bool changed = (overbookedCapacityPenalty != value);
138        overbookedCapacityPenalty = value;
139        if (changed) OnPropertyChanged("OverbookedCapacityPenalty");
140      }
141    }
142
143    [StorableConstructor]
144    private GQAPAssignmentArchive(bool deserializing) : base(deserializing) { }
145    private GQAPAssignmentArchive(GQAPAssignmentArchive original, Cloner cloner)
146      : base(original, cloner) {
147      solutions = cloner.Clone(original.solutions);
148      equipmentNames = cloner.Clone(original.equipmentNames);
149      locationNames = cloner.Clone(original.locationNames);
150      distances = cloner.Clone(original.distances);
151      weights = cloner.Clone(original.weights);
152      installationCosts = cloner.Clone(original.installationCosts);
153      demands = cloner.Clone(original.demands);
154      capacities = cloner.Clone(original.capacities);
155      transportationCosts = cloner.Clone(original.transportationCosts);
156      overbookedCapacityPenalty = cloner.Clone(original.overbookedCapacityPenalty);
157    }
158    public GQAPAssignmentArchive()
159      : base() {
160      this.solutions = new ItemList<GQAPSolution>();
161    }
162    public GQAPAssignmentArchive(StringArray equipmentNames, StringArray locationNames, DoubleMatrix distances, DoubleMatrix weights, DoubleMatrix installationCosts, DoubleArray demands, DoubleArray capacities, DoubleValue transportationCosts, DoubleValue overbookedCapacityPenalty)
163      : this() {
164      this.distances = distances;
165      this.weights = weights;
166      this.installationCosts = installationCosts;
167      this.demands = demands;
168      this.capacities = capacities;
169      this.transportationCosts = transportationCosts;
170      this.overbookedCapacityPenalty = overbookedCapacityPenalty;
171    }
172
173    public override IDeepCloneable Clone(Cloner cloner) {
174      return new GQAPAssignmentArchive(this, cloner);
175    }
176
177    public event PropertyChangedEventHandler PropertyChanged;
178    private void OnPropertyChanged(string propertyName) {
179      var handler = PropertyChanged;
180      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
181    }
182  }
183}
Note: See TracBrowser for help on using the repository browser.