Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/ProblemData.cs @ 14897

Last change on this file since 14897 was 14897, checked in by pkimmesw, 7 years ago

#2665 Dynamic ErcValues, Separate Push from BenchmarkSuite Push

File size: 2.5 KB
Line 
1namespace HeuristicLab.BenchmarkSuite.Problems {
2  using System.Linq;
3  using Common;
4  using Core;
5  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc;
6
7  using Persistence.Default.CompositeSerializers.Storable;
8
9  [StorableClass]
10  public class ProblemData : NamedItem {
11
12    public ProblemData() {
13      ErcOptions = new ErcOptions(); // default does nothing
14    }
15
16    [StorableConstructor]
17    protected ProblemData(bool deserializing) : base(deserializing) { }
18
19    public ProblemData(ProblemData origin, Cloner cloner) : base(origin, cloner) {
20      TrainingCount = origin.TrainingCount;
21      TestCount = origin.TestCount;
22      BestResult = origin.BestResult;
23      WorstResult = origin.WorstResult;
24      InputArgumentTypes = origin.InputArgumentTypes;
25      OutputArgumentTypes = origin.OutputArgumentTypes;
26
27      if (origin.Examples != null)
28        Examples = origin.Examples.Select(cloner.Clone).ToArray();
29
30      EnabledDataTypes = origin.EnabledDataTypes;
31      ErcOptions = cloner.Clone(origin.ErcOptions);
32    }
33
34    [Storable]
35    public int TrainingCount { get; set; }
36    [Storable]
37    public int TestCount { get; set; }
38    [Storable]
39    public double BestResult { get; set; }
40    [Storable]
41    public double WorstResult { get; set; }
42    [Storable]
43    public ExampleArgumentType[] InputArgumentTypes { get; set; }
44    [Storable]
45    public ExampleArgumentType[] OutputArgumentTypes { get; set; }
46    public int TotalArgumentCount { get { return InputArgumentTypes.Length + OutputArgumentTypes.Length; } }
47    [Storable]
48    public Example[] Examples { get; set; }
49    [Storable]
50    public DataTypes EnabledDataTypes { get; set; }
51
52    /// <summary>
53    /// Max Size” gives the maximum number of instructions that can appear in an individual’s genome
54    /// </summary>
55    [Storable]
56    public int MaxSize { get; set; }
57
58    /// <summary>
59    /// “Eval Limit” is the number of steps of the Push interpreter that are executed before stopping a
60    /// program’s execution; programs halted in this way may still achieve good results if they print or
61    /// return results before they are stopped
62    /// </summary>
63    [Storable]
64    public int EvalLimit { get; set; }
65
66    /// <summary>
67    /// Specifies constant values and value ranges required to solve a certain problem
68    /// </summary>
69    [Storable]
70    public ErcOptions ErcOptions { get; set; }
71
72    public override IDeepCloneable Clone(Cloner cloner) {
73      return new ProblemData(this, cloner);
74    }
75  }
76}
Note: See TracBrowser for help on using the repository browser.