Changeset 17510
- Timestamp:
- 04/14/20 14:55:23 (5 years ago)
- Location:
- branches/2971_named_intervals
- Files:
-
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj
r17501 r17510 199 199 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveConstraintConstOptEvaluator.cs" /> 200 200 <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveConstraintPearsonRSquaredEvaluator.cs" /> 201 <Compile Include="S ingleObjective\SymbolicRegressionConstraintAnalyzer.cs" />201 <Compile Include="SymbolicRegressionConstraintAnalyzer.cs" /> 202 202 <Compile Include="SingleObjective\SymbolicRegressionSolutionsAnalyzer.cs" /> 203 203 <Compile Include="SymbolicRegressionPhenotypicDiversityAnalyzer.cs" /> -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionConstraintAnalyzer.cs
r17509 r17510 38 38 private const string ConstraintViolationsResultName = "Constraint Violations"; 39 39 private const string ProblemDataParameterName = "ProblemData"; 40 private const string ConstraintViolationParameterName = "ConstraintViolations"; 40 41 41 42 #region parameter properties … … 43 44 get { return (ILookupParameter<IRegressionProblemData>) Parameters[ProblemDataParameterName]; } 44 45 } 46 47 public IResultParameter<DataTable> ConstraintViolationParameter => 48 (IResultParameter<DataTable>) Parameters[ConstraintViolationParameterName]; 45 49 #endregion 46 50 … … 60 64 public SymbolicRegressionConstraintAnalyzer() : base(){ 61 65 Parameters.Add(new LookupParameter<IRegressionProblemData>(ProblemDataParameterName, "The problem data of the symbolic data analysis problem.")); 66 Parameters.Add(new ResultParameter<DataTable>(ConstraintViolationParameterName, "Shows the number of constraint violations!")); 67 ConstraintViolationParameter.DefaultValue = new DataTable(ConstraintViolationParameterName) { 68 VisualProperties = { 69 XAxisTitle = "Generations", 70 YAxisTitle = "Constraint Violations", 71 } 72 }; 62 73 } 63 74 … … 73 84 var constraints = problemData.IntervalConstraints.EnabledConstraints; 74 85 var variableRanges = problemData.VariableRanges.GetIntervals(); 86 var newDataTable = ConstraintViolationParameter.ActualValue; 75 87 76 if (!results.ContainsKey(ConstraintViolationsResultName)) { 77 var newDataTable = new DataTable(ConstraintViolationsResultName); 78 foreach (var constraint in constraints) { 79 newDataTable.Rows.Add(new DataRow(constraint.Expression)); 88 if(newDataTable.Rows.Count == 0) { 89 foreach (var constraint in constraints) { 90 newDataTable.Rows.Add(new DataRow(constraint.Expression)); 80 91 } 81 results.Add(new Result(ConstraintViolationsResultName, "Chart displaying the constraint violations.", newDataTable));82 92 } 83 var dataTable = (DataTable)results[ConstraintViolationsResultName].Value;84 93 85 94 var interpreter = new IntervalInterpreter(); 86 95 foreach (var constraint in constraints) { 87 int violations = 0; 88 foreach (var tree in trees) { 89 var satisfied = SymbolicRegressionConstraintAnalyzer.ConstraintSatisfied(constraint, interpreter, variableRanges, tree); 90 if (!satisfied) violations++; 91 } 92 dataTable.Rows[constraint.Expression].Values.Add(violations); 96 var violations = trees.Select(tree => SymbolicRegressionConstraintAnalyzer.ConstraintSatisfied(constraint, interpreter, variableRanges, tree)).Count(satisfied => !satisfied); 97 newDataTable.Rows[constraint.Expression].Values.Add(violations); 93 98 } 94 99 95 96 100 return base.Apply(); 97 101 } … … 110 114 var tree = solution; 111 115 for (var i = 0; i < constraint.NumberOfDerivations; ++i) { 112 tree = DerivativeCalculator.Derive(tree, constraint.Variable);116 tree = DerivativeCalculator.Derive(tree, constraint.Variable); 113 117 } 114 118 resultInterval = intervalInterpreter.GetSymbolicExpressionTreeInterval(tree, variableRanges); -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
r17509 r17510 176 176 177 177 //Check if the tree contains unknown symbols for the interval calculation 178 if (IntervalInterpreter.IsCompatible(Model.SymbolicExpressionTree) )178 if (IntervalInterpreter.IsCompatible(Model.SymbolicExpressionTree) && DerivativeCalculator.IsCompatible(Model.SymbolicExpressionTree)) 179 179 ModelBoundsCollection = CalculateModelIntervals(this); 180 180 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r17509 r17510 211 211 } 212 212 213 if (IntervalInterpreter.IsCompatible(tree) ) {213 if (IntervalInterpreter.IsCompatible(tree) && DerivativeCalculator.IsCompatible(tree)) { 214 214 var regressionProblemData = Content.ProblemData as IRegressionProblemData; 215 215 if (regressionProblemData != null) { -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
r17509 r17510 308 308 !(n.Symbol is Logarithm) && 309 309 !(n.Symbol is Exponential) && 310 //!(n.Symbol is Power) && //Interval Contains the symbol power, but the DerivativeCalculator does not!310 !(n.Symbol is Power) && //Interval Contains the symbol power, but the DerivativeCalculator does not! 311 311 !(n.Symbol is Square) && 312 //!(n.Symbol is Root) && //Interval Contains the symbol root, but the DerivativeCalculator does not!312 !(n.Symbol is Root) && //Interval Contains the symbol root, but the DerivativeCalculator does not! 313 313 !(n.Symbol is SquareRoot) && 314 314 !(n.Symbol is Problems.DataAnalysis.Symbolic.Variable) &&
Note: See TracChangeset
for help on using the changeset viewer.