Changeset 15334 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems
- Timestamp:
- 08/21/17 11:33:53 (7 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP
- Property svn:ignore
-
old new 1 1 *.user 2 packages 3 TestResults
-
- Property svn:ignore
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Checksum.cs
r15189 r15334 19 19 Name = Name, 20 20 Description = Description, 21 ProgramExecutionBudget = 30000000, 21 22 Examples = CloneExamples(), 22 23 BestResult = 0, 23 WorstResult = char.MaxValue,24 WorstResult = 1000, 24 25 InputArgumentTypes = new[] { ExampleArgumentType.String }, 25 26 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/CollatzNumbers.cs
r15017 r15334 17 17 Name = Name, 18 18 Description = Description, 19 ProgramExecutionBudget = 60000000, 19 20 Examples = CloneExamples(), 20 21 BestResult = 0, 21 WorstResult = 300,22 WorstResult = 1000000, 22 23 InputArgumentTypes = new[] { ExampleArgumentType.Integer }, 23 24 OutputArgumentTypes = new[] { ExampleArgumentType.Integer }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/CompareStringLengths.cs
r15017 r15334 17 17 Name = Name, 18 18 Description = Description, 19 ProgramExecutionBudget = 30000000, 19 20 Examples = CloneExamples(), 20 21 BestResult = 0, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/CountOdds.cs
r15017 r15334 17 17 Name = Name, 18 18 Description = Description, 19 ProgramExecutionBudget = 60000000, 19 20 Examples = CloneExamples(), 20 21 BestResult = 0, 21 WorstResult = 50,22 WorstResult = 1000, 22 23 InputArgumentTypes = new[] { ExampleArgumentType.IntegerVector }, 23 24 OutputArgumentTypes = new[] { ExampleArgumentType.Integer }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Digits.cs
r15017 r15334 18 18 Name = Name, 19 19 Description = Description, 20 ProgramExecutionBudget = 30000000, 20 21 Examples = CloneExamples(), 21 22 BestResult = 0, 22 WorstResult = 20,23 WorstResult = 5000, 23 24 InputArgumentTypes = new[] { ExampleArgumentType.Integer }, 24 25 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/DoubleLetters.cs
r15017 r15334 18 18 Name = Name, 19 19 Description = Description, 20 ProgramExecutionBudget = 30000000, 20 21 Examples = CloneExamples(), 21 22 BestResult = 0, 22 WorstResult = 100,23 WorstResult = 5000, 23 24 InputArgumentTypes = new[] { ExampleArgumentType.String }, 24 25 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/EvenSquares.cs
r15017 r15334 1 1 namespace HeuristicLab.BenchmarkSuite.Problems { 2 using System.Linq; 3 2 4 public class EvenSquares : BenchmarkSuiteDataDescriptor { 3 5 private const string name = "Even Sqaures - Hard"; … … 15 17 Name = Name, 16 18 Description = Description, 19 ProgramExecutionBudget = 30000000, 17 20 Examples = CloneExamples(), 18 21 BestResult = 0, 19 WorstResult = 400,22 WorstResult = 5000, 20 23 InputArgumentTypes = new[] { ExampleArgumentType.Integer }, 21 24 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, … … 34 37 InputInteger = ExampleArgumentConverter.ConvertIntegers(input), 35 38 OutputPrint = output[0], 39 40 // helper 41 OutputIntegerVector = new [] { output[0].Split('\n').Select(ExampleArgumentConverter.ConvertInteger).ToArray() } 36 42 }; 37 43 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/ForLoopIndex.cs
r15017 r15334 19 19 Name = Name, 20 20 Description = Description, 21 ProgramExecutionBudget = 30000000, 21 22 Examples = CloneExamples(), 22 23 BestResult = 0, 23 WorstResult = 1000,24 WorstResult = 5000, 24 25 InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer }, 25 26 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Grades.cs
r15017 r15334 1 1 namespace HeuristicLab.BenchmarkSuite.Problems { 2 using System; 3 2 4 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer; 3 5 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.String; … … 6 8 private const string name = "Grades - Hard"; 7 9 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.";10 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 11 10 12 protected override string FileName { get { return fileName; } } … … 18 20 Name = Name, 19 21 Description = Description, 22 ProgramExecutionBudget = 60000000, 20 23 Examples = CloneExamples(), 21 24 BestResult = 0, 22 WorstResult = 25,25 WorstResult = 5000, 23 26 InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer }, 24 27 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, … … 39 42 40 43 protected override Example ParseExample(string[] input, string[] output) { 44 char grade; 45 if (!GetGrade(output[0], out grade)) 46 throw new InvalidOperationException("Unable to parse grade."); 47 41 48 return new Example { 42 49 InputArgs = input, … … 44 51 InputInteger = ExampleArgumentConverter.ConvertIntegers(input), 45 52 OutputPrint = output[0], 53 54 // help 55 OutputChar = new[] { grade } 46 56 }; 57 } 58 59 public static bool GetGrade(string str, out char grade) { 60 const string start = "Student has a "; 61 62 if (str.StartsWith(start) && str.Length > start.Length) { 63 grade = str[start.Length]; 64 return true; 65 } 66 67 grade = default(char); 68 return false; 47 69 } 48 70 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/LastIndexOfZero.cs
r15017 r15334 17 17 Name = Name, 18 18 Description = Description, 19 ProgramExecutionBudget = 45000000, 19 20 Examples = CloneExamples(), 20 21 BestResult = 0, 21 WorstResult = 50,22 WorstResult = 1000000, 22 23 InputArgumentTypes = new[] { ExampleArgumentType.IntegerVector }, 23 24 OutputArgumentTypes = new[] { ExampleArgumentType.Integer }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Median.cs
r15017 r15334 17 17 Name = Name, 18 18 Description = Description, 19 ProgramExecutionBudget = 20000000, 19 20 Examples = CloneExamples(), 20 21 BestResult = 0, 21 WorstResult = 1 00,22 WorstResult = 1, 22 23 InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer }, 23 24 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/MirrorImage.cs
r15017 r15334 17 17 Name = Name, 18 18 Description = Description, 19 ProgramExecutionBudget = 30000000, 19 20 Examples = CloneExamples(), 20 21 BestResult = 0, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/NegativeToZero.cs
r15017 r15334 18 18 Name = Name, 19 19 Description = Description, 20 ProgramExecutionBudget = 60000000, 20 21 Examples = CloneExamples(), 21 22 BestResult = 0, 22 WorstResult = 5000 0,23 WorstResult = 5000, 23 24 InputArgumentTypes = new[] { ExampleArgumentType.IntegerVector }, 24 25 OutputArgumentTypes = new[] { ExampleArgumentType.IntegerVector }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/NumberIo.cs
r15189 r15334 20 20 Name = Name, 21 21 Description = Description, 22 ProgramExecutionBudget = 5000000, 22 23 Examples = CloneExamples(), 23 24 BestResult = 0, 24 WorstResult = 400,25 WorstResult = 5000, 25 26 InputArgumentTypes = new[] { ExampleArgumentType.Float, ExampleArgumentType.Integer }, 26 27 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/PigLatin.cs
r15017 r15334 19 19 Name = Name, 20 20 Description = Description, 21 ProgramExecutionBudget = 60000000, 21 22 Examples = CloneExamples(), 22 23 BestResult = 0, 23 WorstResult = 100,24 WorstResult = 5000, 24 25 InputArgumentTypes = new[] { ExampleArgumentType.String }, 25 26 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/ReplaceSpaceWithNewline.cs
r15017 r15334 19 19 Name = Name, 20 20 Description = Description, 21 ProgramExecutionBudget = 30000000, 21 22 Examples = CloneExamples(), 22 23 BestResult = 0, 23 WorstResult = 20,24 WorstResult = 5000, 24 25 InputArgumentTypes = new[] { ExampleArgumentType.String }, 25 26 OutputArgumentTypes = new[] { ExampleArgumentType.Print, ExampleArgumentType.Integer }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/ScrabbleScore.cs
r15017 r15334 48 48 Name = Name, 49 49 Description = Description, 50 ProgramExecutionBudget = 60000000, 50 51 Examples = CloneExamples(), 51 52 BestResult = 0, 52 WorstResult = 500,53 WorstResult = 1000, 53 54 InputArgumentTypes = new[] { ExampleArgumentType.String }, 54 55 OutputArgumentTypes = new[] { ExampleArgumentType.Integer }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/SmallOrLarge.cs
r15017 r15334 19 19 Name = Name, 20 20 Description = Description, 21 ProgramExecutionBudget = 30000000, 21 22 Examples = CloneExamples(), 22 23 BestResult = 0, 23 WorstResult = 5 ,24 WorstResult = 5000, 24 25 InputArgumentTypes = new[] { ExampleArgumentType.Integer }, 25 26 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Smallest.cs
r15017 r15334 17 17 Name = Name, 18 18 Description = Description, 19 ProgramExecutionBudget = 20000000, 19 20 Examples = CloneExamples(), 20 21 BestResult = 0, 21 WorstResult = 1 00,22 WorstResult = 1, 22 23 InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer, ExampleArgumentType.Integer }, 23 OutputArgumentTypes = new[] { ExampleArgumentType. Integer},24 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, 24 25 TrainingCount = 100, 25 26 TestCount = 1000, 26 EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean ,27 EnabledDataTypes = DataTypes.Exec | DataTypes.Integer | DataTypes.Boolean | DataTypes.Print, 27 28 MaxSize = 200, 28 29 EvalLimit = 200, … … 40 41 OutputArgs = output, 41 42 InputInteger = ExampleArgumentConverter.ConvertIntegers(input), 43 OutputPrint = output[0], 44 // Helper 42 45 OutputInteger = ExampleArgumentConverter.ConvertIntegers(output[0]), 43 46 }; -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/StringDifferences.cs
r15017 r15334 6 6 private const string name = "String Differences - Hard"; 7 7 private const string fileName = "StringDifferences.csv"; 8 private const string description = "Given 2 strings (without whitespace) as input, find the indices at which the strings have different characters, stopping at the end of the shorter one. For each such index, print a line containing the index as well as the character in each string. For example, if the strings are “dealer” and “dollars”, the program should print: 1 e o, 2 a l, 4 e a";8 private const string description = "Given 2 strings (without whitespace) as input, find the indices at which the strings have different characters, stopping at the end of the shorter one. For each such index, print a line containing the index as well as the character in each string. For example, if the strings are “dealer” and “dollars”, the program should print: 1 e o, 2 a l, 4 e a"; 9 9 10 10 protected override string FileName { get { return fileName; } } … … 18 18 Name = Name, 19 19 Description = Description, 20 ProgramExecutionBudget = 60000000, 20 21 Examples = CloneExamples(), 21 22 BestResult = 0, 22 WorstResult = 100,23 WorstResult = 5000, 23 24 InputArgumentTypes = new[] { ExampleArgumentType.String, ExampleArgumentType.String }, 24 25 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/StringLengthsBackwards.cs
r15017 r15334 14 14 15 15 public override ProblemData CreateProblemData() { 16 return new ProblemData(ProblemType.String Differences) {16 return new ProblemData(ProblemType.StringLengthsBackwards) { 17 17 Name = Name, 18 18 Description = Description, 19 ProgramExecutionBudget = 30000000, 19 20 Examples = CloneExamples(), 20 21 BestResult = 0, 21 WorstResult = 200,22 WorstResult = 5000, 22 23 InputArgumentTypes = new[] { ExampleArgumentType.StringVector }, 23 24 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/SumOfSquares.cs
r15017 r15334 17 17 Name = Name, 18 18 Description = Description, 19 ProgramExecutionBudget = 15000000, 19 20 Examples = CloneExamples(), 20 21 BestResult = 0, 21 WorstResult = 338350,22 WorstResult = 1000000000, // 338350, 22 23 InputArgumentTypes = new[] { ExampleArgumentType.Integer }, 23 24 OutputArgumentTypes = new[] { ExampleArgumentType.Integer }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/SuperAnagrams.cs
r15017 r15334 19 19 Name = Name, 20 20 Description = Description, 21 ProgramExecutionBudget = 60000000, 21 22 Examples = CloneExamples(), 22 23 BestResult = 0, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Syllables.cs
r15017 r15334 1 1 namespace HeuristicLab.BenchmarkSuite.Problems { 2 using System; 3 2 4 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Char; 3 5 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer; … … 19 21 Name = Name, 20 22 Description = Description, 23 ProgramExecutionBudget = 30000000, 21 24 Examples = CloneExamples(), 22 25 BestResult = 0, 23 WorstResult = 100,26 WorstResult = 5000, 24 27 InputArgumentTypes = new[] { ExampleArgumentType.String }, 25 28 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, … … 50 53 51 54 protected override Example ParseExample(string[] input, string[] output) { 55 long numberOfSyllables; 56 if (!GetNumberOfSyllables(output[0], out numberOfSyllables)) 57 throw new InvalidOperationException("Unable to parse number of syllables."); 58 52 59 return new Example { 53 60 InputArgs = input, … … 55 62 InputString = input, 56 63 OutputPrint = output[0], 64 65 // help 66 OutputInteger = new[] { numberOfSyllables } 57 67 }; 68 } 69 70 public static bool GetNumberOfSyllables(string str, out long numberOfSyllables) { 71 if (str.Length == 0) { 72 numberOfSyllables = 0; 73 return false; 74 } 75 76 var lastIndex = str.Length - 1; 77 var lastCharStr = str[lastIndex].ToString(); 78 79 return long.TryParse(lastCharStr, out numberOfSyllables); 58 80 } 59 81 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/VectorAverage.cs
r15017 r15334 15 15 Name = Name, 16 16 Description = Description, 17 ProgramExecutionBudget = 30000000, 17 18 Examples = CloneExamples(), 18 19 BestResult = 0, 19 WorstResult = 1000 ,20 WorstResult = 1000000, 20 21 InputArgumentTypes = new[] { ExampleArgumentType.FloatVector }, 21 22 OutputArgumentTypes = new[] { ExampleArgumentType.Float }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/VectorSummed.cs
r15017 r15334 18 18 Name = Name, 19 19 Description = Description, 20 ProgramExecutionBudget = 45000000, 20 21 Examples = CloneExamples(), 21 22 BestResult = 0, 22 WorstResult = 100000 ,23 WorstResult = 1000000000, 23 24 InputArgumentTypes = new[] { ExampleArgumentType.IntegerVector, ExampleArgumentType.IntegerVector }, 24 25 OutputArgumentTypes = new[] { ExampleArgumentType.IntegerVector }, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/WallisPi.cs
r15017 r15334 6 6 private const string name = "Wallis Pi - Hard"; 7 7 private const string fileName = "WallisPi.csv"; 8 private const string description = " John Wallis gave a infinite product that converges to π/4. Given an integer input n, compute an approximation of this product out to n terms. Results are rounded to 5 decimal place";8 private const string description = " John Wallis gave a infinite product that converges to π/4. Given an integer input n, compute an approximation of this product out to n terms. Results are rounded to 5 decimal places."; 9 9 10 10 protected override string FileName { get { return fileName; } } … … 18 18 Name = Name, 19 19 Description = Description, 20 ProgramExecutionBudget = 45000000, 20 21 Examples = CloneExamples(), 21 22 BestResult = 0, 22 WorstResult = 1 ,23 WorstResult = 1000000, 23 24 InputArgumentTypes = new[] { ExampleArgumentType.Integer }, 24 25 OutputArgumentTypes = new[] { ExampleArgumentType.Float }, … … 28 29 MaxSize = 600, 29 30 EvalLimit = 8000, 31 FloatStringFormat = "N5", 30 32 ErcOptions = { 31 33 ErcProbability = 0.05, -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/WordStats.cs
r15017 r15334 1 1 namespace HeuristicLab.BenchmarkSuite.Problems { 2 using System; 3 using System.Linq; 4 2 5 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Char; 3 6 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer; … … 20 23 Name = Name, 21 24 Description = Description, 25 ProgramExecutionBudget = 30000000, 22 26 Examples = CloneExamples(), 23 27 BestResult = 0, 24 WorstResult = 1000 ,28 WorstResult = 10000, 25 29 InputArgumentTypes = new[] { ExampleArgumentType.String }, 26 30 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, … … 30 34 MaxSize = 1000, 31 35 EvalLimit = 6000, 36 FloatStringFormat = "0.0#########", 32 37 ErcOptions = { 33 38 ErcProbability = 0.05, 34 39 IntegerErcOptions = new IntegerErcOptions( 35 40 new IntegerRangeErc(-100, 100)), … … 45 50 46 51 protected override Example ParseExample(string[] input, string[] output) { 52 long numberOfSentences; 53 if (!GetNumberOfSentences(output[0], out numberOfSentences)) 54 throw new InvalidOperationException("Unable to find or parse line with number of sentences."); 55 56 double averageSentenceLength; 57 if (!GetAverageSentenceLength(output[0], out averageSentenceLength)) 58 throw new InvalidOperationException("Unable to find line or parse with average sentence length."); 59 47 60 return new Example { 48 61 InputArgs = input, 49 62 OutputArgs = output, 50 63 InputString = input, 51 OutputPrint = output[0] 64 OutputPrint = output[0], 65 66 // help 67 OutputInteger = new[] { numberOfSentences }, 68 OutputFloat = new[] { averageSentenceLength } 52 69 }; 70 } 71 72 public static bool GetNumberOfSentences(string str, out long numberOfSentences) { 73 var lines = str.Split('\n'); 74 var requiredLineIndex = lines.Length - 2; 75 numberOfSentences = 0; 76 77 if (requiredLineIndex < 0) 78 return false; 79 80 var line = lines[requiredLineIndex]; 81 var numberOfSentencesStr = line.Split(' ').Last(); 82 83 84 if (!long.TryParse(numberOfSentencesStr, out numberOfSentences)) 85 return false; 86 87 return true; 88 } 89 90 public static bool GetAverageSentenceLength(string str, out double averageSentenceLength) { 91 var lines = str.Split('\n'); 92 var requiredLineIndex = lines.Length - 1; 93 averageSentenceLength = 0; 94 95 if (requiredLineIndex < 0) 96 return false; 97 98 var line = lines[requiredLineIndex]; 99 var averageSentenceLengthStr = line.Split(' ').Last(); 100 101 if (!double.TryParse(averageSentenceLengthStr, out averageSentenceLength)) 102 return false; 103 104 return true; 53 105 } 54 106 } -
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/XWordLines.cs
r15017 r15334 1 1 namespace HeuristicLab.BenchmarkSuite.Problems { 2 using System.Linq; 3 2 4 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Char; 3 5 using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer; … … 6 8 private const string name = "X-Word Lines - Hard"; 7 9 private const string fileName = "XWordLines.csv"; 8 private const string description = "Given an integer X and a string that can contain spaces and newlines, print the string with exactly X words per line.The last line may have fewer than X words.";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."; 9 11 10 12 protected override string FileName { get { return fileName; } } … … 18 20 Name = Name, 19 21 Description = Description, 22 ProgramExecutionBudget = 45000000, 20 23 Examples = CloneExamples(), 21 24 BestResult = 0, 22 WorstResult = 100,25 WorstResult = 5000, 23 26 InputArgumentTypes = new[] { ExampleArgumentType.Integer, ExampleArgumentType.String }, 24 27 OutputArgumentTypes = new[] { ExampleArgumentType.Print }, … … 43 46 InputString = new[] { input[0] }, 44 47 OutputPrint = output[0], 48 // Helper 49 OutputInteger = new[] { input[0].Split(' ', '\n').LongCount(x => !string.IsNullOrWhiteSpace(x)) } 45 50 }; 46 51 }
Note: See TracChangeset
for help on using the changeset viewer.