Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2665 Fixed small issues, testet benchmark suite, added INX Expressions

File size: 3.1 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(ProblemType problemType) {
13      Name = "BenchmarkSuite Problem Data";
14      ErcOptions = new ErcOptions(); // default does nothing
15      FloatStringFormat = "R";
16      ProblemType = problemType;
17    }
18
19    [StorableConstructor]
20    protected ProblemData(bool deserializing) : base(deserializing) { }
21
22    public ProblemData(ProblemData origin, Cloner cloner) : base(origin, cloner) {
23      TrainingCount = origin.TrainingCount;
24      TestCount = origin.TestCount;
25      BestResult = origin.BestResult;
26      WorstResult = origin.WorstResult;
27      InputArgumentTypes = origin.InputArgumentTypes;
28      OutputArgumentTypes = origin.OutputArgumentTypes;
29
30      if (origin.Examples != null)
31        Examples = origin.Examples.Select(cloner.Clone).ToArray();
32
33      EnabledDataTypes = origin.EnabledDataTypes;
34      ErcOptions = cloner.Clone(origin.ErcOptions);
35      FloatStringFormat = origin.FloatStringFormat;
36      ProblemType = origin.ProblemType;
37    }
38
39    [Storable]
40    public readonly ProblemType ProblemType;
41
42    [Storable]
43    public int TrainingCount { get; set; }
44    [Storable]
45    public int TestCount { get; set; }
46    [Storable]
47    public double BestResult { get; set; }
48    [Storable]
49    public double WorstResult { get; set; }
50    [Storable]
51    public ExampleArgumentType[] InputArgumentTypes { get; set; }
52    [Storable]
53    public ExampleArgumentType[] OutputArgumentTypes { get; set; }
54
55    public int TotalIntputArgumentCount { get { return InputArgumentTypes.Length; } }
56    public int TotalOutputArgumentCount { get { return OutputArgumentTypes.Length; } }
57    public int TotalArgumentCount { get { return InputArgumentTypes.Length + OutputArgumentTypes.Length; } }
58
59    [Storable]
60    public Example[] Examples { get; set; }
61    [Storable]
62    public DataTypes EnabledDataTypes { get; set; }
63
64    /// <summary>
65    /// Max Size” gives the maximum number of instructions that can appear in an individual’s genome
66    /// </summary>
67    [Storable]
68    public int MaxSize { get; set; }
69
70    /// <summary>
71    /// “Eval Limit” is the number of steps of the Push interpreter that are executed before stopping a
72    /// program’s execution; programs halted in this way may still achieve good results if they print or
73    /// return results before they are stopped
74    /// </summary>
75    [Storable]
76    public int EvalLimit { get; set; }
77
78    /// <summary>
79    /// Specifies constant values and value ranges required to solve a certain problem
80    /// </summary>
81    [Storable]
82    public ErcOptions ErcOptions { get; set; }
83
84    [Storable]
85    public string FloatStringFormat { get; set; }
86
87    public override IDeepCloneable Clone(Cloner cloner) {
88      return new ProblemData(this, cloner);
89    }
90  }
91}
Note: See TracBrowser for help on using the repository browser.