Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 16722 was 16722, checked in by msemenki, 5 years ago

#2988: Add first version of GP for Evolvment models of models.

File size: 2.9 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  public interface IEMMSolution : IItem {
29    IItem Individual { get; set; }
30    DoubleValue Qualities { get; set; }
31  }
32  [Item("EMMSolution", "Represents a solution inside the EMM population")]
33  [StorableType("708BDF29-AD3F-4AFC-83AE-551A27FF45A0")]
34  public class EMMSolution : Item, IEMMSolution {
35    [Storable]
36    public IItem Individual { get; set; }
37
38    [Storable]
39    public DoubleValue Qualities { get; set; }
40
41    public EMMSolution() { }
42
43    public EMMSolution(IItem individual) : this() {
44      Individual = individual;
45    }
46
47    public EMMSolution(IItem individual, DoubleValue qualities) {
48      Individual = individual;
49      Qualities = qualities;
50    }
51
52    public EMMSolution(DoubleValue qualities) {
53      Qualities = qualities;
54    }
55
56    public int Dimensions = 1;
57
58    public override IDeepCloneable Clone(Cloner cloner) {
59      return new EMMSolution(this, cloner);
60    }
61
62    protected EMMSolution(EMMSolution original, Cloner cloner) : base(original, cloner) {
63      Qualities = original.Qualities;
64      Individual = (IItem)original.Individual.Clone(cloner);
65    }
66
67    [StorableConstructor]
68    protected EMMSolution(StorableConstructorFlag _) : base(_) { }
69  }
70  [Item("EMMSolution", "Represents a solution inside the EMM population")]
71  [StorableType("36929CD1-63A5-4270-8C65-2A8177BCA0AE")]
72  public class EMMSolution<T> : EMMSolution where T : class, IItem {
73    public new T Individual {
74      get { return (T)base.Individual; }
75      set { base.Individual = value; }
76    }
77
78    public EMMSolution(T individual) : base(individual) { }
79
80    protected EMMSolution(EMMSolution<T> original, Cloner cloner) : base(original, cloner) { }
81
82    public override IDeepCloneable Clone(Cloner cloner) {
83      return new EMMSolution<T>(this, cloner);
84    }
85
86    [StorableConstructor]
87    protected EMMSolution(StorableConstructorFlag _) : base(_) { }
88  }
89}
Note: See TracBrowser for help on using the repository browser.