Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/12/19 10:50:02 (5 years ago)
Author:
gkronber
Message:

#2994 implemented checking of autodiff with numeric differentials and fixed a bug in IntervalEvaluator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/Interpreter.cs

    r17131 r17200  
    788788    [DebuggerBrowsable(DebuggerBrowsableState.Never)]
    789789    public AlgebraicInterval Zero => new AlgebraicInterval(0.0, 0.0);
     790    [DebuggerBrowsable(DebuggerBrowsableState.Never)]
    790791    public AlgebraicInterval One => new AlgebraicInterval(1.0, 1.0);
     792
    791793    public AlgebraicInterval Add(AlgebraicInterval a) {
    792794      low.Add(a.low);
     
    818820    public AlgebraicInterval Div(AlgebraicInterval a) {
    819821      if (a.Contains(0.0)) {
    820         if (a.low.Value.Value.IsAlmost(0.0) && a.high.Value.Value.IsAlmost(0.0)) {
     822        if (a.low.Value.Value == 0 && a.high.Value.Value == 0) {
    821823          low = new MultivariateDual<AlgebraicDouble>(double.NegativeInfinity);
    822824          high = new MultivariateDual<AlgebraicDouble>(double.PositiveInfinity);
    823         } else if (a.low.Value.Value.IsAlmost(0.0))
     825        } else if (a.low.Value.Value == 0)
    824826          Mul(new AlgebraicInterval(a.Clone().high.Inv(), new MultivariateDual<AlgebraicDouble>(double.PositiveInfinity)));
    825827        else
     
    945947      //divide the interval by PI/2 so that the optima lie at x element of N (0,1,2,3,4,...)
    946948      double Pihalf = Math.PI / 2;
    947       var scaled = this.Clone().Scale(1.0 / Pihalf);
     949      var scaled = a.Clone().Scale(1.0 / Pihalf);
    948950      //move to positive scale
    949951      if (scaled.LowerBound.Value.Value < 0) {
     
    965967      }
    966968
    967       low = new MultivariateDual<AlgebraicDouble>(sinValues.Min());
     969      low = new MultivariateDual<AlgebraicDouble>(sinValues.Min()); // TODO, XXX FIX CALCULATION TO SUPPORT GRADIENTS!
    968970      high = new MultivariateDual<AlgebraicDouble>(sinValues.Max());
    969971      return this;
Note: See TracChangeset for help on using the changeset viewer.