Changeset 16713 for branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators
- Timestamp:
- 03/26/19 11:37:29 (6 years ago)
- Location:
- branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintConstOptEvaluator.cs
r16645 r16713 22 22 using System; 23 23 using System.Collections.Generic; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HEAL.Attic;29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { … … 59 59 OnlineCalculatorError errorState = OnlineCalculatorError.None; 60 60 61 IntervalConstraintsParser parser = new IntervalConstraintsParser(); 62 var constraints = parser.Parse(((RegressionProblemData)problemData).IntervalConstraintsParameter.Value.Value); 61 var constraints = IntervalConstraintsParser.Parse(((RegressionProblemData)problemData).IntervalConstraintsParameter.Value.Value); 63 62 var intervalInterpreter = new IntervalInterpreter(); 64 63 var variableRanges = ((RegressionProblemData)problemData).VariableRangesParameter.Value.VariableIntervals; … … 90 89 } 91 90 92 private static bool HasConstraintVioluations( List<IntervalConstraint> constraints, IntervalInterpreter intervalInterpreter,91 private static bool HasConstraintVioluations(IEnumerable<IntervalConstraint> constraints, IntervalInterpreter intervalInterpreter, 93 92 Dictionary<string, Interval> variableRanges, ISymbolicExpressionTree solution) { 94 93 foreach (var constraint in constraints) { … … 96 95 throw new ArgumentException($"The given variable {constraint.Variable} in the constraint does not exists in the model.", nameof(IntervalConstraintsParser)); 97 96 if (!constraint.IsDerivation) { 98 var res = intervalInterpreter.GetSymbolicEx ressionTreeInterval(solution, variableRanges);97 var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(solution, variableRanges); 99 98 if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound, 100 99 constraint.InclusiveUpperBound)) { … … 106 105 tree = DerivativeCalculator.Derive(tree, constraint.Variable); 107 106 } 108 var res = intervalInterpreter.GetSymbolicEx ressionTreeInterval(tree, variableRanges);107 var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(tree, variableRanges); 109 108 if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound, 110 109 constraint.InclusiveUpperBound)) { -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintPearsonRSquaredEvaluator.cs
r16644 r16713 22 22 using System; 23 23 using System.Collections.Generic; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using HEAL.Attic;29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { … … 59 59 OnlineCalculatorError errorState = OnlineCalculatorError.None; 60 60 61 IntervalConstraintsParser parser = new IntervalConstraintsParser(); 62 var constraints = parser.Parse(((RegressionProblemData) problemData).IntervalConstraintsParameter.Value.Value); 61 var constraints = IntervalConstraintsParser.Parse(((RegressionProblemData)problemData).IntervalConstraintsParameter.Value.Value); 63 62 var intervalInterpreter = new IntervalInterpreter(); 64 var variableRanges = ((RegressionProblemData) 63 var variableRanges = ((RegressionProblemData)problemData).VariableRangesParameter.Value.VariableIntervals; 65 64 66 65 … … 92 91 // var e = m.GetEstimatedValues (TRAINING) 93 92 // OnlinePearsonCalc.Calculate(e, TARGET_TRAIING) 94 93 95 94 // scaledTree = model.Tree; 96 95 … … 120 119 } 121 120 if (errorState != OnlineCalculatorError.None) return double.NaN; 122 return r *r;121 return r * r; 123 122 } 124 123 … … 141 140 } 142 141 143 private static bool CheckConstraintsViolations( List<IntervalConstraint> constraints, IntervalInterpreter intervalInterpreter,142 private static bool CheckConstraintsViolations(IEnumerable<IntervalConstraint> constraints, IntervalInterpreter intervalInterpreter, 144 143 Dictionary<string, Interval> variableRanges, ISymbolicExpressionTree solution, out double r) { 145 144 foreach (var constraint in constraints) { … … 147 146 throw new ArgumentException($"The given variable {constraint.Variable} in the constraint does not exists in the model.", nameof(IntervalConstraintsParser)); 148 147 if (!constraint.IsDerivation) { 149 var res = intervalInterpreter.GetSymbolicEx ressionTreeInterval(solution, variableRanges);148 var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(solution, variableRanges); 150 149 if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound, 151 150 constraint.InclusiveUpperBound)) { … … 158 157 tree = DerivativeCalculator.Derive(tree, constraint.Variable); 159 158 } 160 var res = intervalInterpreter.GetSymbolicEx ressionTreeInterval(tree, variableRanges);159 var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(tree, variableRanges); 161 160 if (!constraint.Interval.Contains(res, constraint.InclusiveLowerBound, 162 161 constraint.InclusiveUpperBound)) {
Note: See TracChangeset
for help on using the changeset viewer.