Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMSolution.cs @ 16811

Last change on this file since 16811 was 16734, checked in by msemenki, 6 years ago

#2988: Add Model Symbol Frequency Analyzer and Model's Clusters Frequency Analyzer. Fix Bag's with Keys. Fix changing during mutation for Variables Types in SubModels .

File size: 3.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2019 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 HEAL.Attic;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using DoubleValue = HeuristicLab.Data.DoubleValue;
26// Can be deleted potnetinaly
27namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
28  [StorableType("AB38211D-5F52-4420-A606-1C3CB58BA27C")]
29  public interface IEMMSolution : IItem {
30    IItem Individual { get; set; }
31    DoubleValue Qualities { get; set; }
32  }
33  [Item("EMMSolution", "Represents a solution inside the EMM population")]
34  [StorableType("C0E63430-5000-4592-BBE4-2D3E0EE1AE3F")]
35  public class EMMSolution : Item, IEMMSolution {
36    [Storable]
37    public IItem Individual { get; set; }
38
39    [Storable]
40    public DoubleValue Qualities { get; set; }
41
42    public EMMSolution() { }
43
44    public EMMSolution(IItem individual) : this() {
45      Individual = individual;
46    }
47
48    public EMMSolution(IItem individual, DoubleValue qualities) {
49      Individual = individual;
50      Qualities = qualities;
51    }
52
53    public EMMSolution(DoubleValue qualities) {
54      Qualities = qualities;
55    }
56
57    public int Dimensions = 1;
58
59    public override IDeepCloneable Clone(Cloner cloner) {
60      return new EMMSolution(this, cloner);
61    }
62
63    protected EMMSolution(EMMSolution original, Cloner cloner) : base(original, cloner) {
64      Qualities = original.Qualities;
65      Individual = (IItem)original.Individual.Clone(cloner);
66    }
67
68    [StorableConstructor]
69    protected EMMSolution(StorableConstructorFlag _) : base(_) { }
70  }
71  [Item("EMMSolution", "Represents a solution inside the EMM population")]
72  [StorableType("559EA31B-2263-4233-900C-EC62120EE580")]
73  public class EMMSolution<T> : EMMSolution where T : class, IItem {
74    public new T Individual {
75      get { return (T)base.Individual; }
76      set { base.Individual = value; }
77    }
78
79    public EMMSolution(T individual) : base(individual) { }
80
81    protected EMMSolution(EMMSolution<T> original, Cloner cloner) : base(original, cloner) { }
82
83    public override IDeepCloneable Clone(Cloner cloner) {
84      return new EMMSolution<T>(this, cloner);
85    }
86
87    [StorableConstructor]
88    protected EMMSolution(StorableConstructorFlag _) : base(_) { }
89  }
90}
Note: See TracBrowser for help on using the repository browser.