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 |
|
---|
22 | using System.ComponentModel;
|
---|
23 | using HEAL.Attic;
|
---|
24 | using HeuristicLab.Common;
|
---|
25 | using HeuristicLab.Core;
|
---|
26 | using HeuristicLab.Encodings.IntegerVectorEncoding;
|
---|
27 | using HEAL.Attic;
|
---|
28 |
|
---|
29 | namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
|
---|
30 | [Item("GQAPSolution", "A solution to the Generalized Quadratic Assignment Problem.")]
|
---|
31 | [StorableType("D4CC7924-87BF-4499-9149-D18000AD8151")]
|
---|
32 | public class GQAPSolution : Item, INotifyPropertyChanged {
|
---|
33 |
|
---|
34 | [Storable]
|
---|
35 | private IntegerVector assignment;
|
---|
36 | public IntegerVector Assignment {
|
---|
37 | get { return assignment; }
|
---|
38 | set {
|
---|
39 | if (assignment == value) return;
|
---|
40 | assignment = value;
|
---|
41 | OnPropertyChanged(nameof(Assignment));
|
---|
42 | }
|
---|
43 | }
|
---|
44 |
|
---|
45 | [Storable]
|
---|
46 | private Evaluation evaluation;
|
---|
47 | public Evaluation Evaluation {
|
---|
48 | get { return evaluation; }
|
---|
49 | set {
|
---|
50 | if (evaluation == value) return;
|
---|
51 | evaluation = value;
|
---|
52 | OnPropertyChanged(nameof(Evaluation));
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|
56 | [StorableConstructor]
|
---|
57 | protected GQAPSolution(StorableConstructorFlag _) : base(_) { }
|
---|
58 | protected GQAPSolution(GQAPSolution original, Cloner cloner)
|
---|
59 | : base(original, cloner) {
|
---|
60 | assignment = cloner.Clone(original.assignment);
|
---|
61 | evaluation = cloner.Clone(original.evaluation);
|
---|
62 | }
|
---|
63 | public GQAPSolution(IntegerVector assignment, Evaluation evaluation)
|
---|
64 | : base() {
|
---|
65 | this.assignment = assignment;
|
---|
66 | this.evaluation = evaluation;
|
---|
67 | }
|
---|
68 |
|
---|
69 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
70 | return new GQAPSolution(this, cloner);
|
---|
71 | }
|
---|
72 |
|
---|
73 | public event PropertyChangedEventHandler PropertyChanged;
|
---|
74 | protected virtual void OnPropertyChanged(string propertyName) {
|
---|
75 | var handler = PropertyChanged;
|
---|
76 | if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
---|
77 | }
|
---|
78 | }
|
---|
79 | }
|
---|