Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/06/19 16:16:50 (6 years ago)
Author:
chaider
Message:

#2971

  • Added ContainsInterval method in Interval
  • Some renaming
  • Added ConstraintAnalyzer to SymbolicRegressionProblem
  • Added Counter for constraint violations in analyzer
Location:
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
Files:
4 edited

Legend:

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

    r16548 r16592  
    4343    public bool Contains(double value) {
    4444      return LowerBound <= value && value <= UpperBound;
     45    }
     46
     47    public bool Contains(Interval other, bool lowerBoundInclusive = true, bool upperBoundInclusive = false) {
     48      if (double.IsNegativeInfinity(this.LowerBound) && double.IsPositiveInfinity(this.UpperBound))
     49        return true;
     50      //Left-unbounded and right-bounded:
     51      if (double.IsNegativeInfinity(this.LowerBound)) {
     52        if (upperBoundInclusive)
     53          return other.LowerBound <= this.UpperBound && other.UpperBound <= this.UpperBound;
     54        return other.LowerBound < this.UpperBound && other.UpperBound < this.UpperBound;
     55      }
     56
     57      //Left-bounded and right-unbounded:
     58      if (double.IsPositiveInfinity(this.UpperBound)) {
     59        if (lowerBoundInclusive)
     60          return other.LowerBound >= this.LowerBound && other.UpperBound >= this.LowerBound;
     61        return other.LowerBound > this.LowerBound && other.UpperBound > this.LowerBound;
     62      }
     63
     64      //Proper and bounded:
     65      //Closed:
     66      if (lowerBoundInclusive && upperBoundInclusive) {
     67        return this.LowerBound <= other.LowerBound && other.UpperBound <= this.UpperBound;
     68      }
     69
     70      //Open:
     71      if (!lowerBoundInclusive && !upperBoundInclusive) {
     72        return this.LowerBound < other.LowerBound && other.UpperBound < this.UpperBound;
     73      }
     74
     75      //Left-closed, right-open:
     76      if (lowerBoundInclusive) {
     77        return this.LowerBound <= other.LowerBound && other.UpperBound < this.UpperBound;
     78      }
     79
     80      //Left-open, right-closed:
     81      return this.LowerBound < other.LowerBound && other.UpperBound <= this.UpperBound;
    4582    }
    4683
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraint.cs

    r16590 r16592  
    77namespace HeuristicLab.Problems.DataAnalysis {
    88  public class IntervalConstraint {
    9     public string Derivaiton { get; set; }
     9    public string Expression { get; set; }
    1010    public string Definition { get; set; }
    1111    public Interval Interval { get; set; }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraintsParser.cs

    r16590 r16592  
    4040            intervalConstraint.IsDerivation = false;
    4141          }
    42           intervalConstraint.Derivaiton = matches[i].Groups[0].Value;
     42          intervalConstraint.Expression = matches[i].Groups[0].Value;
    4343          intervalConstraint.InclusiveLowerBound = (matches[i].Groups[2].Value == "[");
    4444          intervalConstraint.InclusiveUpperBound = (matches[i].Groups[6].Value == "]");
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs

    r16586 r16592  
    105105    }
    106106
    107     public IFixedValueParameter<NamedIntervals> VariableRangesParameter {
    108       get { return (IFixedValueParameter<NamedIntervals>)Parameters[VariableRangesParameterName]; }
    109     }
     107    public IFixedValueParameter<NamedIntervals> VariableRangesParameter => (IFixedValueParameter<NamedIntervals>)Parameters[VariableRangesParameterName];
     108
     109    public NamedIntervals VariableRanges => VariableRangesParameter.Value;
    110110
    111111    public IFixedValueParameter<TextValue> IntervalConstraintsParameter => (IFixedValueParameter<TextValue>) Parameters[IntervalConstraintsParameterName];
     112    public TextValue IntervalConstraints => IntervalConstraintsParameter.Value;
    112113
    113114    public string TargetVariable {
Note: See TracChangeset for help on using the changeset viewer.