[7418] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[16077] | 3 | * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[7418] | 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.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 26 |
|
---|
| 27 | namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
|
---|
| 28 | [Item("GQAPAssignmentArchive", "Stores the pareto front of assignments.")]
|
---|
| 29 | [StorableClass]
|
---|
[7935] | 30 | public sealed class GQAPAssignmentArchive : Item, INotifyPropertyChanged {
|
---|
[7418] | 31 |
|
---|
| 32 | [Storable]
|
---|
| 33 | private ItemList<GQAPSolution> solutions;
|
---|
| 34 | public ItemList<GQAPSolution> Solutions {
|
---|
| 35 | get { return solutions; }
|
---|
| 36 | set {
|
---|
[15504] | 37 | if (solutions == value) return;
|
---|
[7418] | 38 | solutions = value;
|
---|
[15504] | 39 | OnPropertyChanged(nameof(Solutions));
|
---|
[7418] | 40 | }
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | [Storable]
|
---|
[15504] | 44 | private GQAPInstance problemInstance;
|
---|
| 45 | public GQAPInstance ProblemInstance {
|
---|
| 46 | get { return problemInstance; }
|
---|
[7418] | 47 | set {
|
---|
[15504] | 48 | if (problemInstance == value) return;
|
---|
| 49 | problemInstance = value;
|
---|
| 50 | OnPropertyChanged(nameof(ProblemInstance));
|
---|
[7418] | 51 | }
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | [StorableConstructor]
|
---|
| 55 | private GQAPAssignmentArchive(bool deserializing) : base(deserializing) { }
|
---|
| 56 | private GQAPAssignmentArchive(GQAPAssignmentArchive original, Cloner cloner)
|
---|
| 57 | : base(original, cloner) {
|
---|
[7432] | 58 | solutions = cloner.Clone(original.solutions);
|
---|
[15504] | 59 | problemInstance = cloner.Clone(original.problemInstance);
|
---|
[7418] | 60 | }
|
---|
| 61 | public GQAPAssignmentArchive()
|
---|
| 62 | : base() {
|
---|
| 63 | this.solutions = new ItemList<GQAPSolution>();
|
---|
| 64 | }
|
---|
[15504] | 65 | public GQAPAssignmentArchive(GQAPInstance problemInstance)
|
---|
[7418] | 66 | : this() {
|
---|
[15504] | 67 | this.problemInstance = problemInstance;
|
---|
[7418] | 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 | }
|
---|