Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/21/17 11:33:53 (7 years ago)
Author:
pkimmesw
Message:

#2665 Testet Problems, Testet error functions, Small fixes, Created HL files

Location:
branches/PushGP/HeuristicLab.PushGP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP

    • Property svn:ignore
      •  

        old new  
        11*.user
         2packages
         3TestResults
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Problems/Syllables.cs

    r15017 r15334  
    11namespace HeuristicLab.BenchmarkSuite.Problems {
     2  using System;
     3
    24  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Char;
    35  using HeuristicLab.Problems.ProgramSynthesis.Base.Erc.Integer;
     
    1921        Name = Name,
    2022        Description = Description,
     23        ProgramExecutionBudget = 30000000,
    2124        Examples = CloneExamples(),
    2225        BestResult = 0,
    23         WorstResult = 100,
     26        WorstResult = 5000,
    2427        InputArgumentTypes = new[] { ExampleArgumentType.String },
    2528        OutputArgumentTypes = new[] { ExampleArgumentType.Print },
     
    5053
    5154    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
    5259      return new Example {
    5360        InputArgs = input,
     
    5562        InputString = input,
    5663        OutputPrint = output[0],
     64
     65        // help
     66        OutputInteger = new[] { numberOfSyllables }
    5767      };
     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);
    5880    }
    5981  }
Note: See TracChangeset for help on using the changeset viewer.