Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/06/19 14:53:28 (6 years ago)
Author:
chaider
Message:

#2971

  • Added field Target to IntervalConstraint
  • Prefixed Target-Item with Target:
  • Removed prefixed Target: at derivations ==> show target field instead
Location:
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalConstraint.cs

    r16898 r16900  
    5858    }
    5959
     60    private string target;
     61
     62    [Storable]
     63    public string Target {
     64      get => target;
     65      set {
     66        if (target != value) {
     67          target = value;
     68          UpdateExpression();
     69          OnChanged();
     70        }
     71      }
     72    }
     73
    6074    public bool IsDerivation {
    6175      get => numberOfDerivation > 0;
     
    131145    private IntervalConstraint(StorableConstructorFlag _) : base(_) { }
    132146
    133     public IntervalConstraint(string expression, string variable, int numberOfDerivation, Interval interval, bool inclusiveLowerBound,
     147    public IntervalConstraint(string expression, string variable, string target, int numberOfDerivation, Interval interval, bool inclusiveLowerBound,
    134148      bool inclusiveUpperBound, bool enabled) : base(){
    135149      this.expression = expression;
    136150      this.variable = variable;
     151      this.target = target;
    137152      this.numberOfDerivation = numberOfDerivation;
    138153      this.interval = interval;
     
    149164      : base(original, cloner) {
    150165      this.Expression = original.Expression;
     166      this.Variable = original.Variable;
     167      this.Target = original.Target;
     168      this.NumberOfDerivation = original.NumberOfDerivation;
    151169      this.Interval = original.Interval;
    152170      this.InclusiveLowerBound = original.InclusiveLowerBound;
    153171      this.InclusiveUpperBound = original.InclusiveUpperBound;
    154       this.Variable = original.Variable;
    155       this.NumberOfDerivation = original.NumberOfDerivation;
    156172      this.enabled = original.enabled;
    157173    }
     
    181197
    182198      if (!IsDerivation) {
    183         expression = string.Format("{0} in {1}{2} .. {3}{4}",
     199        expression = string.Format("Target:{0} in {1}{2} .. {3}{4}",
    184200          Variable,
    185201          (InclusiveLowerBound) ? "[" : "]",
     
    190206        return;
    191207      }
    192       expression = string.Format("\u2202{5}Target/\u2202{0}{5} in {1}{2} .. {3}{4}",
     208      expression = string.Format("\u2202{6}{1}/\u2202{0}{6} in {2}{3} .. {4}{5}",
    193209        Variable,
     210        Target,
    194211        (InclusiveLowerBound) ? "[" : "]",
    195212        Interval.LowerBound,
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalConstraintsParser.cs

    r16896 r16900  
    5151              var upperBound = ParseIntervalBounds(match.Groups[6].Value);
    5252              var expression = "Target:" + match.Groups[0].Value;
    53               var definition = "Target " + match.Groups[1].Value.Trim();
     53              var parsedTarget = match.Groups[1].Value.Trim();
    5454              var variable = match.Groups[1].Value.Trim();
    5555              var inclLowerBound = match.Groups[3].Value.Trim() == "[";
     
    5959              var interval = new Interval(lowerBound, upperBound);
    6060
    61               var constraint = new IntervalConstraint(expression, variable, numberOfDerivation, interval, inclLowerBound, inclUpperBound, true);
     61              var constraint = new IntervalConstraint(expression, variable, parsedTarget, numberOfDerivation, interval, inclLowerBound, inclUpperBound, true);
    6262
    6363              yield return constraint;
     
    9696              var upperBound = ParseIntervalBounds(match.Groups[11].Value);
    9797              var expression = match.Groups[0].Value;
    98               var definition = match.Groups[1].Value + match.Groups[2].Value + match.Groups[3].Value +
    99                                       match.Groups[4].Value + match.Groups[5].Value + match.Groups[6].Value + match.Groups[7].Value;
     98              var parsedTarget = match.Groups[3].Value.Trim();
    10099              var isDerivation = true;
    101100              var inclLowerBound = match.Groups[8].Value.Trim() == "[";
     
    105104              var interval = new Interval(lowerBound, upperBound);
    106105
    107               var constraint = new IntervalConstraint(expression, variable, numberOfDerivation, interval, inclLowerBound, inclUpperBound, true);
     106              var constraint = new IntervalConstraint(expression, variable, parsedTarget, numberOfDerivation, interval, inclLowerBound, inclUpperBound, true);
    108107
    109108              yield return constraint;
Note: See TracChangeset for help on using the changeset viewer.