1 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
2 | using System.Linq;
|
---|
3 |
|
---|
4 | public class EvenSquares : BenchmarkSuiteDataDescriptor {
|
---|
5 | private const string name = "Even Sqaures - Hard";
|
---|
6 | private const string fileName = "EvenSquares.csv";
|
---|
7 | private const string description = " Given an integer n, print all of the positive even perfect squares less than n on separate lines.";
|
---|
8 |
|
---|
9 | protected override string FileName { get { return fileName; } }
|
---|
10 | public override string Name { get { return name; } }
|
---|
11 | public override string Description { get { return description; } }
|
---|
12 | protected override int InputArgumentCount { get { return 1; } }
|
---|
13 | protected override int OutputArgumentCount { get { return 1; } }
|
---|
14 |
|
---|
15 | public override ProblemData CreateProblemData() {
|
---|
16 | return new ProblemData(ProblemType.EvenSquares) {
|
---|
17 | Name = Name,
|
---|
18 | Description = Description,
|
---|
19 | ProgramExecutionBudget = 30000000,
|
---|
20 | Examples = CloneExamples(),
|
---|
21 | BestResult = 0,
|
---|
22 | WorstResult = 5000,
|
---|
23 | InputArgumentTypes = new[] { ExampleArgumentType.Integer },
|
---|
24 | OutputArgumentTypes = new[] { ExampleArgumentType.Print },
|
---|
25 | TrainingCount = 100,
|
---|
26 | TestCount = 1000,
|
---|
27 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Print,
|
---|
28 | MaxSize = 400,
|
---|
29 | EvalLimit = 2000,
|
---|
30 | };
|
---|
31 | }
|
---|
32 |
|
---|
33 | protected override Example ParseExample(string[] input, string[] output) {
|
---|
34 | return new Example {
|
---|
35 | InputArgs = input,
|
---|
36 | OutputArgs = output,
|
---|
37 | InputInteger = ExampleArgumentConverter.ConvertIntegers(input),
|
---|
38 | OutputPrint = output[0],
|
---|
39 |
|
---|
40 | // helper
|
---|
41 | OutputIntegerVector = new [] { output[0].Split('\n').Select(ExampleArgumentConverter.ConvertInteger).ToArray() }
|
---|
42 | };
|
---|
43 | }
|
---|
44 | }
|
---|
45 | }
|
---|