Changeset 15345 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Evaluator/PushBenchmarkSuiteEvaluator.cs
- Timestamp:
- 08/31/17 18:59:39 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Evaluator/PushBenchmarkSuiteEvaluator.cs
r15344 r15345 149 149 case ProblemType.Smallest: 150 150 case ProblemType.Median: return PrintedStringRight(interpreter, example); 151 case ProblemType.MedianIntegerError: return MedianIntegerError(interpreter, example); 151 152 152 153 // boolean error … … 214 215 } 215 216 217 private double MedianIntegerError(IPushInterpreter interpreter, Example example) { 218 var printResult = interpreter.PrintStack.ToString(); 219 220 long result; 221 if (long.TryParse(printResult, out result)) { 222 var diff = Math.Abs(result - example.OutputInteger[0]); 223 224 return Math.Min(Data.WorstResult, diff); 225 } 226 227 return Data.WorstResult; 228 } 229 216 230 private double NumberIo(IPushInterpreter interpreter, Example example) { 217 231 if (!string.IsNullOrEmpty(example.OutputPrint) && interpreter.PrintStack.IsEmpty) … … 289 303 var printLines = interpreter.PrintStack.AsStrings().ToArray(); 290 304 var lineCountWithCorrectFormat = printLines.Count(line => line.IsNumeric()); 291 var lineCountWithInvalidFormat = example.OutputPrintLineCount - lineCountWithCorrectFormat;305 var lineCountWithInvalidFormat = Math.Max(0, example.OutputPrintLineCount - lineCountWithCorrectFormat); 292 306 293 307 lineCountWithInvalidFormat = Math.Abs(Math.Min(lineCountWithInvalidFormat, example.OutputPrintLineCount));
Note: See TracChangeset
for help on using the changeset viewer.