Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17510


Ignore:
Timestamp:
04/14/20 14:55:23 (5 years ago)
Author:
chaider
Message:

#2971

  • Changed constraint violation table to ResultParameter
  • Changed symbol check to include DerivativeCalculator symbols
  • Moved SymbolicRegressionConstraintAnalyzer to plugins root
  • Added Power and Root to IntervalInterpreter
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  
    199199    <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveConstraintConstOptEvaluator.cs" />
    200200    <Compile Include="SingleObjective\Evaluators\SymbolicRegressionSingleObjectiveConstraintPearsonRSquaredEvaluator.cs" />
    201     <Compile Include="SingleObjective\SymbolicRegressionConstraintAnalyzer.cs" />
     201    <Compile Include="SymbolicRegressionConstraintAnalyzer.cs" />
    202202    <Compile Include="SingleObjective\SymbolicRegressionSolutionsAnalyzer.cs" />
    203203    <Compile Include="SymbolicRegressionPhenotypicDiversityAnalyzer.cs" />
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionConstraintAnalyzer.cs

    r17509 r17510  
    3838    private const string ConstraintViolationsResultName = "Constraint Violations";
    3939    private const string ProblemDataParameterName = "ProblemData";
     40    private const string ConstraintViolationParameterName = "ConstraintViolations";
    4041
    4142    #region parameter properties
     
    4344      get { return (ILookupParameter<IRegressionProblemData>) Parameters[ProblemDataParameterName]; }
    4445    }
     46
     47    public IResultParameter<DataTable> ConstraintViolationParameter =>
     48      (IResultParameter<DataTable>) Parameters[ConstraintViolationParameterName];
    4549    #endregion
    4650
     
    6064    public SymbolicRegressionConstraintAnalyzer() : base(){
    6165      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      };
    6273    }
    6374
     
    7384      var constraints = problemData.IntervalConstraints.EnabledConstraints;
    7485      var variableRanges = problemData.VariableRanges.GetIntervals();
     86      var newDataTable = ConstraintViolationParameter.ActualValue;
    7587
    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));
    8091        }
    81         results.Add(new Result(ConstraintViolationsResultName, "Chart displaying the constraint violations.", newDataTable));
    8292      }
    83       var dataTable = (DataTable)results[ConstraintViolationsResultName].Value;
    8493
    8594      var interpreter = new IntervalInterpreter();
    8695      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);
    9398      }
    9499     
    95 
    96100      return base.Apply();
    97101    }
     
    110114        var tree = solution;
    111115        for (var i = 0; i < constraint.NumberOfDerivations; ++i) {
    112           tree = DerivativeCalculator.Derive(tree, constraint.Variable);
     116            tree = DerivativeCalculator.Derive(tree, constraint.Variable);
    113117        }
    114118        resultInterval = intervalInterpreter.GetSymbolicExpressionTreeInterval(tree, variableRanges);
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs

    r17509 r17510  
    176176
    177177      //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))
    179179        ModelBoundsCollection = CalculateModelIntervals(this);
    180180    }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r17509 r17510  
    211211        }
    212212
    213         if (IntervalInterpreter.IsCompatible(tree)) {
     213        if (IntervalInterpreter.IsCompatible(tree) && DerivativeCalculator.IsCompatible(tree)) {
    214214          var regressionProblemData = Content.ProblemData as IRegressionProblemData;
    215215          if (regressionProblemData != null) {
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs

    r17509 r17510  
    308308          !(n.Symbol is Logarithm) &&
    309309          !(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!
    311311          !(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!
    313313          !(n.Symbol is SquareRoot) &&
    314314          !(n.Symbol is Problems.DataAnalysis.Symbolic.Variable) &&
Note: See TracChangeset for help on using the changeset viewer.