Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/ProblemData.cs @ 17642

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

#2665 Testet Problems, Testet error functions, Small fixes, Created HL files

File size: 3.5 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
28      InputArgumentTypes = (ExampleArgumentType[])origin.InputArgumentTypes.Clone();
29      OutputArgumentTypes = (ExampleArgumentType[])origin.OutputArgumentTypes.Clone();
30
31      if (origin.Examples != null)
32        Examples = origin.Examples.Select(cloner.Clone).ToArray();
33
34      EnabledDataTypes = origin.EnabledDataTypes;
35      ErcOptions = cloner.Clone(origin.ErcOptions);
36      FloatStringFormat = origin.FloatStringFormat;
37      ProblemType = origin.ProblemType;
38      ProgramExecutionBudget = origin.ProgramExecutionBudget;
39    }
40
41    [Storable]
42    public readonly ProblemType ProblemType;
43
44    [Storable]
45    public int TrainingCount { get; set; }
46    [Storable]
47    public int TestCount { get; set; }
48    [Storable]
49    public double BestResult { get; set; }
50    [Storable]
51    public double WorstResult { get; set; }
52    [Storable]
53    public ExampleArgumentType[] InputArgumentTypes { get; set; }
54    [Storable]
55    public ExampleArgumentType[] OutputArgumentTypes { get; set; }
56
57    public int TotalInputArgumentCount { get { return InputArgumentTypes.Length; } }
58    public int TotalOutputArgumentCount { get { return OutputArgumentTypes.Length; } }
59    public int TotalArgumentCount { get { return InputArgumentTypes.Length + OutputArgumentTypes.Length; } }
60
61    [Storable]
62    public Example[] Examples { get; set; }
63    [Storable]
64    public DataTypes EnabledDataTypes { get; set; }
65
66    /// <summary>
67    /// Max Size” gives the maximum number of instructions that can appear in an individual’s genome
68    /// </summary>
69    [Storable]
70    public int MaxSize { get; set; }
71
72    /// <summary>
73    /// “Eval Limit” is the number of steps of the Push interpreter that are executed before stopping a
74    /// program’s execution; programs halted in this way may still achieve good results if they print or
75    /// return results before they are stopped
76    /// </summary>
77    [Storable]
78    public int EvalLimit { get; set; }
79
80    /// <summary>
81    /// Specifies constant values and value ranges required to solve a certain problem
82    /// </summary>
83    [Storable]
84    public ErcOptions ErcOptions { get; set; }
85
86    /// <summary>
87    /// Represents the maximum number of programs that will be executed before a run is terminated, which is the product of the maximum generations, the population size, and the size of the training set.
88    /// </summary>
89    [Storable]
90    public int ProgramExecutionBudget { get; set; }
91
92    [Storable]
93    public string FloatStringFormat { get; set; }
94
95    public override IDeepCloneable Clone(Cloner cloner) {
96      return new ProblemData(this, cloner);
97    }
98  }
99}
Note: See TracBrowser for help on using the repository browser.