Changeset 14834 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/BenchmarkSuiteDataDescriptor.cs
- Timestamp:
- 04/10/17 00:27:31 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/BenchmarkSuiteDataDescriptor.cs
r14777 r14834 6 6 using System.Reflection; 7 7 using System.Text.RegularExpressions; 8 9 using HeuristicLab.BenchmarkSuite.ERC;10 8 using HeuristicLab.BenchmarkSuite.Problems; 11 9 … … 19 17 20 18 private Example[] examples; 21 public Example[] Examples 22 { 23 get 24 { 25 return this.examples ?? (this.examples = this.ParseData().ToArray()); 26 } 19 20 protected Example[] CloneExamples() { 21 if (examples == null) examples = ParseData().ToArray(); 22 return examples.Select(e => (Example)e.Clone()).ToArray(); 27 23 } 28 24 29 public Data CreateProblemData() { 30 return new Data { 31 Name = Name, 32 Description = Description, 33 Examples = Examples.ToArray(), 34 BestResult = BestResult, 35 WorstResult = WorstResult, 36 InputArgumentTypes = InputArgumentTypes, 37 OutputArgumentTypes = OutputArgumentTypes, 38 OriginalTestCount = OriginalTestCount, 39 OriginalTrainingCount = OriginalTrainingCount, 40 EnabledDataTypes = EnabledDataTypes, 41 EvalLimit = EvalLimit, 42 MaxGenerations = MaxGenerations, 43 MaxSize = MaxSize, 44 ProgEvalBudget = ProgEvalBudget, 45 ProblemErcOptions = ProblemErcOptions, 46 }; 47 } 25 public abstract Data CreateProblemData(); 48 26 27 protected abstract string FileName { get; } 49 28 public abstract string Name { get; } 50 29 public abstract string Description { get; } 51 protected abstract string FileName { get; } 52 public abstract int OriginalTrainingCount { get; } 53 public abstract int OriginalTestCount { get; } 54 public abstract int BestResult { get; } 55 public abstract int WorstResult { get; } 56 public abstract ExampleArgumentType[] InputArgumentTypes { get; } 57 public abstract ExampleArgumentType[] OutputArgumentTypes { get; } 58 public abstract ProblemErcOptions ProblemErcOptions { get; } 59 public abstract DataTypes EnabledDataTypes { get; } 60 public abstract int MaxSize { get; } 61 public abstract int EvalLimit { get; } 62 public abstract int MaxGenerations { get; } 63 public abstract int ProgEvalBudget { get; } 30 protected abstract int InputArgumentCount { get; } 31 protected abstract int OutputArgumentCount { get; } 64 32 65 p ublicabstract Example ParseExample(string[] input, string[] output);33 protected abstract Example ParseExample(string[] input, string[] output); 66 34 67 35 private IEnumerable<Example> ParseData() { … … 79 47 var fields = parser.ReadFields(); 80 48 81 if (fields.Length != InputArgument Types.Length + OutputArgumentTypes.Length)49 if (fields.Length != InputArgumentCount + OutputArgumentCount) 82 50 throw new InvalidDataException("Number of values do not fit"); 83 51 84 var input = fields.Take(InputArgument Types.Length).ToArray();85 var output = fields.Skip( OutputArgumentTypes.Length).ToArray();52 var input = fields.Take(InputArgumentCount).ToArray(); 53 var output = fields.Skip(InputArgumentCount).ToArray(); 86 54 87 55 yield return ParseExample(input, output);
Note: See TracChangeset
for help on using the changeset viewer.