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