[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;
|
---|
[15771] | 7 | using HeuristicLab.Problems.ProgramSynthesis;
|
---|
[14907] | 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 |
|
---|
[15334] | 28 | InputArgumentTypes = (ExampleArgumentType[])origin.InputArgumentTypes.Clone();
|
---|
| 29 | OutputArgumentTypes = (ExampleArgumentType[])origin.OutputArgumentTypes.Clone();
|
---|
| 30 |
|
---|
[14907] | 31 | if (origin.Examples != null)
|
---|
| 32 | Examples = origin.Examples.Select(cloner.Clone).ToArray();
|
---|
| 33 |
|
---|
| 34 | EnabledDataTypes = origin.EnabledDataTypes;
|
---|
| 35 | ErcOptions = cloner.Clone(origin.ErcOptions);
|
---|
[15017] | 36 | FloatStringFormat = origin.FloatStringFormat;
|
---|
[15189] | 37 | ProblemType = origin.ProblemType;
|
---|
[15334] | 38 | ProgramExecutionBudget = origin.ProgramExecutionBudget;
|
---|
[14907] | 39 | }
|
---|
| 40 |
|
---|
| 41 | [Storable]
|
---|
[15017] | 42 | public readonly ProblemType ProblemType;
|
---|
| 43 |
|
---|
| 44 | [Storable]
|
---|
[14907] | 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; }
|
---|
[15189] | 56 |
|
---|
[15273] | 57 | public int TotalInputArgumentCount { get { return InputArgumentTypes.Length; } }
|
---|
[15189] | 58 | public int TotalOutputArgumentCount { get { return OutputArgumentTypes.Length; } }
|
---|
[14907] | 59 | public int TotalArgumentCount { get { return InputArgumentTypes.Length + OutputArgumentTypes.Length; } }
|
---|
[15189] | 60 |
|
---|
[14907] | 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 |
|
---|
[15334] | 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>
|
---|
[15017] | 89 | [Storable]
|
---|
[15334] | 90 | public int ProgramExecutionBudget { get; set; }
|
---|
| 91 |
|
---|
| 92 | [Storable]
|
---|
[15017] | 93 | public string FloatStringFormat { get; set; }
|
---|
| 94 |
|
---|
[14907] | 95 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 96 | return new ProblemData(this, cloner);
|
---|
| 97 | }
|
---|
| 98 | }
|
---|
| 99 | }
|
---|