Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/30/20 22:00:12 (5 years ago)
Author:
mkommend
Message:

#2971: Merged branch into trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs

    r17180 r17579  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Data;
    2829using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    29 using HEAL.Attic;
    3030using HeuristicLab.Parameters;
    3131
     
    8080    }
    8181
    82     public Interval GetSymbolicExpressionTreeInterval(ISymbolicExpressionTree tree, IDictionary<string, Interval> variableRanges) {
     82    public Interval GetSymbolicExpressionTreeInterval(ISymbolicExpressionTree tree, IReadOnlyDictionary<string, Interval> variableRanges) {
    8383      lock (syncRoot) {
    8484        EvaluatedSolutions++;
     
    9797
    9898    public Interval GetSymbolicExpressionTreeIntervals(ISymbolicExpressionTree tree,
    99       IDictionary<string, Interval> variableRanges, out IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals) {
     99      IReadOnlyDictionary<string, Interval> variableRanges, out IDictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals) {
    100100      lock (syncRoot) {
    101101        EvaluatedSolutions++;
     
    124124
    125125
    126     private static Instruction[] PrepareInterpreterState(ISymbolicExpressionTree tree, IDictionary<string, Interval> variableRanges) {
     126    private static Instruction[] PrepareInterpreterState(ISymbolicExpressionTree tree, IReadOnlyDictionary<string, Interval> variableRanges) {
    127127      if (variableRanges == null)
    128128        throw new ArgumentNullException("No variablew ranges are present!", nameof(variableRanges));
     
    234234            break;
    235235          }
    236         case OpCodes.Power: {
    237             result = Evaluate(instructions, ref instructionCounter, nodeIntervals);
    238             for (int i = 1; i < currentInstr.nArguments; i++) {
    239               var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
    240               result = Interval.Power(result, argumentInterval);
    241             }
    242             break;
    243           }
    244236        case OpCodes.Square: {
    245237            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
     
    247239            break;
    248240          }
    249         case OpCodes.Root: {
    250             result = Evaluate(instructions, ref instructionCounter, nodeIntervals);
    251             for (int i = 1; i < currentInstr.nArguments; i++) {
    252               var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
    253               result = Interval.Root(result, argumentInterval);
    254             }
    255             break;
    256           }
    257241        case OpCodes.SquareRoot: {
    258242            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
    259243            result = Interval.SquareRoot(argumentInterval);
     244            break;
     245          }
     246        case OpCodes.Cube: {
     247            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
     248            result = Interval.Cube(argumentInterval);
     249            break;
     250          }
     251        case OpCodes.CubeRoot: {
     252            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
     253            result = Interval.CubicRoot(argumentInterval);
     254            break;
     255          }
     256        case OpCodes.Absolute: {
     257            var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
     258            result = Interval.Absolute(argumentInterval);
     259            break;
     260          }
     261        case OpCodes.AnalyticQuotient: {
     262            result = Evaluate(instructions, ref instructionCounter, nodeIntervals);
     263            for (var i = 1; i < currentInstr.nArguments; i++) {
     264              var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals);
     265              result = Interval.AnalyticalQuotient(result, argumentInterval);
     266            }
     267
    260268            break;
    261269          }
     
    274282        from n in tree.Root.GetSubtree(0).IterateNodesPrefix()
    275283        where
     284          !(n.Symbol is Problems.DataAnalysis.Symbolic.Variable) &&
     285          !(n.Symbol is Constant) &&
    276286          !(n.Symbol is StartSymbol) &&
    277287          !(n.Symbol is Addition) &&
     
    284294          !(n.Symbol is Logarithm) &&
    285295          !(n.Symbol is Exponential) &&
    286           !(n.Symbol is Power) &&
    287296          !(n.Symbol is Square) &&
    288           !(n.Symbol is Root) &&
    289297          !(n.Symbol is SquareRoot) &&
    290           !(n.Symbol is Problems.DataAnalysis.Symbolic.Variable) &&
    291           !(n.Symbol is Constant)
     298          !(n.Symbol is Cube) &&
     299          !(n.Symbol is CubeRoot) &&
     300          !(n.Symbol is Absolute) &&
     301          !(n.Symbol is AnalyticQuotient)
    292302        select n).Any();
    293303      return !containsUnknownSyumbol;
Note: See TracChangeset for help on using the changeset viewer.