Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2665 Run Hl General, Essential tests and applied fixes for errors

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