[14907] | 1 | namespace 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 |
|
---|
[15017] | 12 | public ProblemData(ProblemType problemType) {
|
---|
[14907] | 13 | Name = "BenchmarkSuite Problem Data";
|
---|
| 14 | ErcOptions = new ErcOptions(); // default does nothing
|
---|
[15017] | 15 | FloatStringFormat = "R";
|
---|
| 16 | ProblemType = problemType;
|
---|
[14907] | 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);
|
---|
[15017] | 35 | FloatStringFormat = origin.FloatStringFormat;
|
---|
[15189] | 36 | ProblemType = origin.ProblemType;
|
---|
[14907] | 37 | }
|
---|
| 38 |
|
---|
| 39 | [Storable]
|
---|
[15017] | 40 | public readonly ProblemType ProblemType;
|
---|
| 41 |
|
---|
| 42 | [Storable]
|
---|
[14907] | 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; }
|
---|
[15189] | 54 |
|
---|
[15273] | 55 | public int TotalInputArgumentCount { get { return InputArgumentTypes.Length; } }
|
---|
[15189] | 56 | public int TotalOutputArgumentCount { get { return OutputArgumentTypes.Length; } }
|
---|
[14907] | 57 | public int TotalArgumentCount { get { return InputArgumentTypes.Length + OutputArgumentTypes.Length; } }
|
---|
[15189] | 58 |
|
---|
[14907] | 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 |
|
---|
[15017] | 84 | [Storable]
|
---|
| 85 | public string FloatStringFormat { get; set; }
|
---|
| 86 |
|
---|
[14907] | 87 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 88 | return new ProblemData(this, cloner);
|
---|
| 89 | }
|
---|
| 90 | }
|
---|
| 91 | }
|
---|