Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2895_PushGP_GenealogyAnalysis/HeuristicLab.Problems.ProgramSynthesis/Push/BenchmarkSuite/Problems/XWordLines.cs @ 18183

Last change on this file since 18183 was 15771, checked in by bburlacu, 7 years ago

#2895: Add solution skeleton for PushGP with genealogy analysis.

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