1 | namespace HeuristicLab.BenchmarkSuite.Problems {
|
---|
2 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
|
---|
3 | using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.String;
|
---|
4 |
|
---|
5 | public class Grades : BenchmarkSuiteDataDescriptor {
|
---|
6 | private const string name = "Grades";
|
---|
7 | private const string fileName = "Grades.csv";
|
---|
8 | private const string description = "Given 5 integers, the first four represent the lower numeric thresholds for achieving an A, B, C, and D, and will be distinct and in descending order.The fifth represents the student’s numeric grade.The program must print Student has a X grade., where X is A, B, C, D, or F depending on the thresholds and the numeric grade.";
|
---|
9 |
|
---|
10 | protected override string FileName { get { return fileName; } }
|
---|
11 | public override string Name { get { return name; } }
|
---|
12 | public override string Description { get { return description; } }
|
---|
13 | protected override int InputArgumentCount { get { return 5; } }
|
---|
14 | protected override int OutputArgumentCount { get { return 1; } }
|
---|
15 |
|
---|
16 | public override ProblemData CreateProblemData() {
|
---|
17 | return new ProblemData {
|
---|
18 | Name = Name,
|
---|
19 | Description = Description,
|
---|
20 | Examples = CloneExamples(),
|
---|
21 | BestResult = 0,
|
---|
22 | WorstResult = 25,
|
---|
23 | InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer },
|
---|
24 | OutputArgumentTypes = new[] { ExampleArgumentType.Print },
|
---|
25 | TrainingCount = 200,
|
---|
26 | TestCount = 2000,
|
---|
27 | EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.String | DataTypes.Print,
|
---|
28 | MaxSize = 400,
|
---|
29 | EvalLimit = 800,
|
---|
30 | ErcOptions = {
|
---|
31 | ErcProbability = 0.05,
|
---|
32 | IntegerErcOptions = new IntegerErcOptions(
|
---|
33 | new IntegerRangeErcValue(0, 100)),
|
---|
34 | StringErcOptions = new StringErcOptions(
|
---|
35 | new StringConstantErcValue("Student has a ", " grade", "A", "B", "C", "D", "F"))
|
---|
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),
|
---|
45 | OutputPrint = output[0],
|
---|
46 | };
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|