Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/06/19 14:37:02 (5 years ago)
Author:
chaider
Message:

#2971
Interval-Parser:

  • Changed Parser ==> after last group there can be now an infinite amount of whitepsaces
  • Save userinput as property
  • Save variable case-sensitive

NamedIntervals

  • Changed Storable attribute from IEnumerable to KeyValuePair, because old Persistance cant handle IEnumerable

Added SymbolicRegressionConstraintAnalyzer
SymbolicRegressionSingleObjectiveConstraintPearsonRSquaredEvaluator

  • Fixed checking if a given interval is in another interval
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraintsParser.cs

    r16587 r16590  
    11using System;
    22using System.Collections.Generic;
     3using System.Globalization;
    34using System.IO;
    45using System.Linq;
     
    1415    public List<IntervalConstraint> Parse(string input) {
    1516      var options = RegexOptions.Multiline | RegexOptions.IgnoreCase;
    16       var matches = Regex.Matches(input, @"^(.*)\bin\b\s*([\[\]])(.*[^\s])(\s*\.\.\s*)([^\s].*)([\[\]])\r?$", options);
     17      var matches = Regex.Matches(input, @"^(.*)\bin\b\s*([\[\]])(.*[^\s])(\s*\.\.\s*)([^\s].*)([\[\]])\r?\s*$", options);
    1718
    1819      for (var i = 0; i < matches.Count; ++i) {
     
    2223          var definition = Regex.Replace(matches[i].Groups[1].Value, @"\s *", "");
    2324          if (Regex.IsMatch(definition, @"\/")) {
    24             var splitted = Regex.Split(definition.ToLower().Replace(" ", string.Empty), @"\/");
     25            var splitted = Regex.Split(definition.Replace(" ", string.Empty), @"\/");
    2526            var match = Regex.Match(splitted[0], @"([d∂])([0-9]|[²³])?(.*[^\s*])");
    2627            if (match.Success) {
     
    2829              intervalConstraint.Definition = match.Groups[3].Value;
    2930              intervalConstraint.IsDerivation = true;
    30               var formulation = Regex.Match(splitted[1], @"([d∂])(.*[^\s*][^²³])([²³])?");
     31              var formulation = Regex.Match(splitted[1], @"([d∂])(.*[^²³])([²³])?");
    3132              if (formulation.Success) {
    3233                intervalConstraint.Variable = formulation.Groups[2].Success ? formulation.Groups[2].Value : "";
     
    3839            intervalConstraint.Definition = Regex.Match(definition, @".*[^.\s]*").Value;
    3940            intervalConstraint.IsDerivation = false;
    40           }     
     41          }
     42          intervalConstraint.Derivaiton = matches[i].Groups[0].Value;
    4143          intervalConstraint.InclusiveLowerBound = (matches[i].Groups[2].Value == "[");
    4244          intervalConstraint.InclusiveUpperBound = (matches[i].Groups[6].Value == "]");
     
    6264          return double.NegativeInfinity;
    6365        default: {
    64           if (double.TryParse(input, out var value)) {
     66          if (double.TryParse(input, NumberStyles.Any, CultureInfo.InvariantCulture, out var value)) {
    6567            return value;
    6668          } else {
Note: See TracChangeset for help on using the changeset viewer.