Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17773


Ignore:
Timestamp:
10/08/20 15:39:46 (4 years ago)
Author:
chaider
Message:

#3073 Fixed error calculation in IABoundsEstimator

Location:
branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IABoundsEstimator.cs

    r17768 r17773  
    474474        var modelBound = Evaluate(instructions, ref instructionCounter, variableIntervals: occuringVariableRanges);
    475475        if (constraint.Interval.Contains(modelBound)) return 0.0;
    476         return Math.Abs(modelBound.LowerBound - constraint.Interval.LowerBound) +
    477                Math.Abs(modelBound.UpperBound - constraint.Interval.UpperBound);
     476
     477
     478        var error = 0.0;
     479
     480        if (!constraint.Interval.Contains(modelBound.LowerBound)) {
     481            error += Math.Abs(modelBound.LowerBound - constraint.Interval.LowerBound);
     482        }
     483
     484        if (!constraint.Interval.Contains(modelBound.UpperBound)) {
     485            error += Math.Abs(modelBound.UpperBound - constraint.Interval.UpperBound);
     486        }
     487
     488        return error;
     489        // return Math.Abs(modelBound.LowerBound - constraint.Interval.LowerBound) +
     490        //Math.Abs(modelBound.UpperBound - constraint.Interval.UpperBound);
    478491      }
    479492
  • branches/3073_IA_constraint_splitting/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/IntervalUtil.cs

    r17768 r17773  
    2222      var regionRanges = new IntervalCollection();
    2323      foreach (var kvp in variableRanges) {
    24         if (kvp.Key != constraint.Target && constraint.Regions.GetReadonlyDictionary().TryGetValue(kvp.Key, out Interval val)) {
     24        if (kvp.Key != constraint.Target && constraint.Regions.GetReadonlyDictionary().TryGetValue(kvp.Key, out var val)) {
    2525          regionRanges.AddInterval(kvp.Key, val);
    2626        } else {
     
    8080      IEnumerable<IntervalConstraint> constraints, IBoundsEstimator estimator, IntervalCollection intervalCollection,
    8181      ISymbolicExpressionTree solution) {
    82       return constraints
    83             .Select(constraint => IntervalConstraintViolation(constraint, estimator, intervalCollection, solution))
    84             .ToList();
     82      return constraints.Select(constraint => IntervalConstraintViolation(constraint, estimator, intervalCollection, solution)).ToList();
    8583    }
    8684  }
Note: See TracChangeset for help on using the changeset viewer.