1 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
2 | public class VectorAverage : BenchmarkSuiteDataDescriptor {
|
---|
3 | private const string name = "Vector Average - Medium";
|
---|
4 | private const string fileName = "VectorAverage.csv";
|
---|
5 | private const string description = "Given a vector of floats, return the average of those floats. Results are rounded to 4 decimal places.";
|
---|
6 |
|
---|
7 | protected override string FileName { get { return fileName; } }
|
---|
8 | public override string Name { get { return name; } }
|
---|
9 | public override string Description { get { return description; } }
|
---|
10 | protected override int InputArgumentCount { get { return 1; } }
|
---|
11 | protected override int OutputArgumentCount { get { return 1; } }
|
---|
12 |
|
---|
13 | public override ProblemData CreateProblemData() {
|
---|
14 | return new ProblemData(ProblemType.VectorAverage) {
|
---|
15 | Name = Name,
|
---|
16 | Description = Description,
|
---|
17 | ProgramExecutionBudget = 30000000,
|
---|
18 | Examples = CloneExamples(),
|
---|
19 | BestResult = 0,
|
---|
20 | WorstResult = 1000000,
|
---|
21 | InputArgumentTypes = new[] { ExampleArgumentType.FloatVector },
|
---|
22 | OutputArgumentTypes = new[] { ExampleArgumentType.Float },
|
---|
23 | TrainingCount = 100,
|
---|
24 | TestCount = 1000,
|
---|
25 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Float | DataTypes.FloatVector,
|
---|
26 | MaxSize = 400,
|
---|
27 | EvalLimit = 800,
|
---|
28 | };
|
---|
29 | }
|
---|
30 |
|
---|
31 | protected override Example ParseExample(string[] input, string[] output) {
|
---|
32 | return new Example {
|
---|
33 | InputArgs = input,
|
---|
34 | OutputArgs = output,
|
---|
35 | InputFloatVector = new[] { ExampleArgumentConverter.ConvertDoubles(input[0]) },
|
---|
36 | OutputFloat = ExampleArgumentConverter.ConvertDoubles(output[0]),
|
---|
37 | OutputFloatPrecision = 4
|
---|
38 | };
|
---|
39 | }
|
---|
40 | }
|
---|
41 | }
|
---|