source: branches/2936_GQAPIntegration/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GQAPAssignmentArchive.cs @ 16077

Last change on this file since 16077 was 16077, checked in by abeham, 12 months ago

#2936: Added integration branch

File size: 2.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 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.Persistence.Default.CompositeSerializers.Storable;
26
27namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
28  [Item("GQAPAssignmentArchive", "Stores the pareto front of assignments.")]
29  [StorableClass]
30  public sealed class GQAPAssignmentArchive : Item, INotifyPropertyChanged {
31
32    [Storable]
33    private ItemList<GQAPSolution> solutions;
34    public ItemList<GQAPSolution> Solutions {
35      get { return solutions; }
36      set {
37        if (solutions == value) return;
38        solutions = value;
39        OnPropertyChanged(nameof(Solutions));
40      }
41    }
42
43    [Storable]
44    private GQAPInstance problemInstance;
45    public GQAPInstance ProblemInstance {
46      get { return problemInstance; }
47      set {
48        if (problemInstance == value) return;
49        problemInstance = value;
50        OnPropertyChanged(nameof(ProblemInstance));
51      }
52    }
53
54    [StorableConstructor]
55    private GQAPAssignmentArchive(bool deserializing) : base(deserializing) { }
56    private GQAPAssignmentArchive(GQAPAssignmentArchive original, Cloner cloner)
57      : base(original, cloner) {
58      solutions = cloner.Clone(original.solutions);
59      problemInstance = cloner.Clone(original.problemInstance);
60    }
61    public GQAPAssignmentArchive()
62      : base() {
63      this.solutions = new ItemList<GQAPSolution>();
64    }
65    public GQAPAssignmentArchive(GQAPInstance problemInstance)
66      : this() {
67      this.problemInstance = problemInstance;
68    }
69
70    public override IDeepCloneable Clone(Cloner cloner) {
71      return new GQAPAssignmentArchive(this, cloner);
72    }
73
74    public event PropertyChangedEventHandler PropertyChanged;
75    private void OnPropertyChanged(string propertyName) {
76      var handler = PropertyChanged;
77      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
78    }
79  }
80}
Note: See TracBrowser for help on using the repository browser.