Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/XWordLines.cs @ 17724

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

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

File size: 2.2 KB
Line 
1namespace HeuristicLab.BenchmarkSuite.Problems {
2  using System.Linq;
3
4  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Char;
5  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
6
7  public class XWordLines : BenchmarkSuiteDataDescriptor {
8    private const string name = "X-Word Lines - Hard";
9    private const string fileName = "XWordLines.csv";
10    private const string description = "Given an integer X and a string that can contains spaces and newlines, print the string with exactly X words per line. The last line may have fewer than X words.";
11
12    protected override string FileName { get { return fileName; } }
13    public override string Name { get { return name; } }
14    public override string Description { get { return description; } }
15    protected override int InputArgumentCount { get { return 2; } }
16    protected override int OutputArgumentCount { get { return 1; } }
17
18    public override ProblemData CreateProblemData() {
19      return new ProblemData(ProblemType.XWordLines) {
20        Name = Name,
21        Description = Description,
22        ProgramExecutionBudget = 45000000,
23        Examples = CloneExamples(),
24        BestResult = 0,
25        WorstResult = 5000,
26        InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.String },
27        OutputArgumentTypes = new[] { ExampleArgumentType.Print },
28        TrainingCount = 150,
29        TestCount = 2000,
30        EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Char | DataTypes.String | DataTypes.Print,
31        MaxSize = 800,
32        EvalLimit = 1600,
33        ErcOptions = {
34          ErcProbability = 0.05,
35          CharErcOptions = new CharErcOptions(
36            new IntegerConstantErc(' ', '\n')),
37        }
38      };
39    }
40
41    protected override Example ParseExample(string[] input, string[] output) {
42      return new Example {
43        InputArgs = input,
44        OutputArgs = output,
45        InputInteger = ExampleArgumentConverter.ConvertIntegers(input[1]),
46        InputString = new[] { input[0] },
47        OutputPrint = output[0],
48        // Helper
49        OutputInteger = new[] { input[0].Split(' ', '\n').LongCount(x => !string.IsNullOrWhiteSpace(x)) }
50      };
51    }
52  }
53}
Note: See TracBrowser for help on using the repository browser.