Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/01/17 09:28:34 (7 years ago)
Author:
pkimmesw
Message:

#2665 Fixed Benchmark Problem Definition, Converted LoopExpressions to stateless expressions, Added several unit test to ensure funcionality, Fixed UI bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/ExampleArgumentConverter.cs

    r14897 r15017  
    1515
    1616    public static double[] ConvertDoubles(string input) {
    17       return ConvertMultiple(input, str => double.Parse(str, CultureInfo.InvariantCulture));
     17      return ConvertMultiple(input, str => double.Parse(str, NumberStyles.Float, CultureInfo.InvariantCulture));
    1818    }
    1919
     
    3636
    3737    public static string[] ConvertStringVector(string input) {
    38       return ConvertMultiple(input, s => s.Trim('\"'));
     38      var length = input.Length - 1;
     39      var strs = new List<string>();
     40
     41      for (var i = 1; i < length; i++) {
     42        // collect string
     43        var c = input[i];
     44
     45        if (c == ' ') continue;
     46        if (c != '\"') throw new InvalidDataException("Unable to parse string vector");
     47
     48        var start = i + 1;
     49        do {
     50          i++;
     51          c = input[i];
     52        } while (i < length - 1  &&
     53               !(c == '\"' && input[i + 1] == ' ') &&
     54               !(i == length - 2 && c == '\"' && input[i + 1] == ']'));
     55
     56
     57        var str = input.Substring(start, i - start);
     58        strs.Add(str);
     59      }
     60
     61      return strs.ToArray();
    3962    }
    4063
Note: See TracChangeset for help on using the changeset viewer.