Free cookie consent management tool by TermsFeed Policy Generator

source: branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GQAPSolution.cs @ 13397

Last change on this file since 13397 was 7418, checked in by abeham, 13 years ago

#1614

  • Added shaking operator based on n-moves
  • Added pareto analyzer regarding flowdistance and installation qualities
File size: 4.1 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.Encodings.IntegerVectorEncoding;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28
29namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
30  [Item("GQAPSolution", "A solution to the Generalized Quadratic Assignment Problem.")]
31  [StorableClass]
32  public class GQAPSolution : Item, INotifyPropertyChanged {
33
34    [Storable]
35    private IntegerVector assignment;
36    public IntegerVector Assignment {
37      get { return assignment; }
38      set {
39        bool changed = (assignment != value);
40        assignment = value;
41        if (changed) OnPropertyChanged("Assignment");
42      }
43    }
44
45    [Storable]
46    private DoubleValue quality;
47    public DoubleValue Quality {
48      get { return quality; }
49      set {
50        bool changed = (quality != value);
51        quality = value;
52        if (changed) OnPropertyChanged("Quality");
53      }
54    }
55
56    [Storable]
57    private DoubleValue flowDistanceQuality;
58    public DoubleValue FlowDistanceQuality {
59      get { return flowDistanceQuality; }
60      set {
61        bool changed = (flowDistanceQuality != value);
62        flowDistanceQuality = value;
63        if (changed) OnPropertyChanged("FlowDistanceQuality");
64      }
65    }
66
67    [Storable]
68    private DoubleValue installationQuality;
69    public DoubleValue InstallationQuality {
70      get { return installationQuality; }
71      set {
72        bool changed = (installationQuality != value);
73        installationQuality = value;
74        if (changed) OnPropertyChanged("InstallationQuality");
75      }
76    }
77
78    [Storable]
79    private DoubleValue overbookedCapacity;
80    public DoubleValue OverbookedCapacity {
81      get { return overbookedCapacity; }
82      set {
83        bool changed = (overbookedCapacity != value);
84        overbookedCapacity = value;
85        if (changed) OnPropertyChanged("OverbookedCapacity");
86      }
87    }
88
89    [StorableConstructor]
90    protected GQAPSolution(bool deserializing) : base(deserializing) { }
91    protected GQAPSolution(GQAPSolution original, Cloner cloner)
92      : base(original, cloner) {
93      assignment = cloner.Clone(original.assignment);
94      quality = cloner.Clone(original.quality);
95      flowDistanceQuality = cloner.Clone(original.flowDistanceQuality);
96      installationQuality = cloner.Clone(original.installationQuality);
97      overbookedCapacity = cloner.Clone(original.overbookedCapacity);
98    }
99    public GQAPSolution(IntegerVector assignment, DoubleValue quality, DoubleValue flowDistanceQuality, DoubleValue installationQuality, DoubleValue overbookedCapacity)
100      : base() {
101      this.assignment = assignment;
102      this.quality = quality;
103      this.flowDistanceQuality = flowDistanceQuality;
104      this.installationQuality = installationQuality;
105      this.overbookedCapacity = overbookedCapacity;
106    }
107
108    public override IDeepCloneable Clone(Cloner cloner) {
109      return new GQAPSolution(this, cloner);
110    }
111
112    public event PropertyChangedEventHandler PropertyChanged;
113    protected virtual void OnPropertyChanged(string propertyName) {
114      var handler = PropertyChanged;
115      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
116    }
117  }
118}
Note: See TracBrowser for help on using the repository browser.