Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17506


Ignore:
Timestamp:
04/10/20 14:04:59 (5 years ago)
Author:
mkommend
Message:

#2971: Further minor refactorings and renaming of members.

Location:
branches/2971_named_intervals
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintConstOptEvaluator.cs

    r17504 r17506  
    9191        if (constraint.Variable != null && !variableRanges.ContainsKey(constraint.Variable))
    9292          throw new ArgumentException($"The given variable {constraint.Variable} in the constraint does not exists in the model.", nameof(IntervalConstraintsParser));
    93         if (!constraint.IsDerivation) {
     93        if (!constraint.IsDerivative) {
    9494          var res = intervalInterpreter.GetSymbolicExpressionTreeInterval(solution, variableRanges);
    9595          if (!constraint.Interval.Contains(res)) {
     
    9898        } else {
    9999          var tree = solution;
    100           for (var i = 0; i < constraint.NumberOfDerivation; ++i) {
     100          for (var i = 0; i < constraint.NumberOfDerivations; ++i) {
    101101            tree = DerivativeCalculator.Derive(tree, constraint.Variable);
    102102          }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionConstraintAnalyzer.cs

    r17504 r17506  
    105105      Interval resultInterval;
    106106
    107       if (!constraint.IsDerivation) {
     107      if (!constraint.IsDerivative) {
    108108        resultInterval = intervalInterpreter.GetSymbolicExpressionTreeInterval(solution, variableRanges);
    109109      } else {
    110110        var tree = solution;
    111         for (var i = 0; i < constraint.NumberOfDerivation; ++i) {
     111        for (var i = 0; i < constraint.NumberOfDerivations; ++i) {
    112112          tree = DerivativeCalculator.Derive(tree, constraint.Variable);
    113113        }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.cs

    r17370 r17506  
    105105
    106106      variableInput.Text = Content.Variable;
    107       if (!Content.IsDerivation) {
     107      if (!Content.IsDerivative) {
    108108        numberderivationInput.Enabled = false;
    109109        numberderivationInput.SelectedItem = null;
     
    113113        numberderivationInput.Visible = true;
    114114        numberderivationInput.Enabled = true;
    115         numberderivationInput.SelectedItem = Content.NumberOfDerivation;
     115        numberderivationInput.SelectedItem = Content.NumberOfDerivations;
    116116      }
    117117
     
    178178    private void numberderivationInput_SelectedIndexChanged(object sender, EventArgs e) {
    179179      if (numberderivationInput.SelectedItem == null) {
    180         Content.NumberOfDerivation = 0;
     180        Content.NumberOfDerivations = 0;
    181181        numberderivationInput.Enabled = false;
    182182        return;
    183183      }
    184184      if ((int)numberderivationInput.SelectedItem == 1)
    185         Content.NumberOfDerivation = 1;
     185        Content.NumberOfDerivations = 1;
    186186      else if ((int)numberderivationInput.SelectedItem == 2)
    187         Content.NumberOfDerivation = 2;
     187        Content.NumberOfDerivations = 2;
    188188      else if ((int)numberderivationInput.SelectedItem == 3)
    189         Content.NumberOfDerivation = 3;
     189        Content.NumberOfDerivations = 3;
    190190    }
    191191
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalCollection.cs

    r17145 r17506  
    3333      get => HeuristicLab.Common.Resources.VSImageLibrary.Object;
    3434    }
    35     private IDictionary<string, Interval> VariableIntervals { get; } = new Dictionary<string, Interval>();
     35    private IDictionary<string, Interval> intervals { get; } = new Dictionary<string, Interval>();
    3636
    3737    [Storable(Name = "StorableIntervalInformation")]
     
    3939      get {
    4040        var l = new List<KeyValuePair<string, double[]>>();
    41         foreach (var varInt in VariableIntervals)
     41        foreach (var varInt in intervals)
    4242
    4343          l.Add(new KeyValuePair<string, double[]>(varInt.Key,
     
    4848      set {
    4949        foreach (var varInt in value)
    50           VariableIntervals.Add(varInt.Key, new Interval(varInt.Value[0], varInt.Value[1]));
     50          intervals.Add(varInt.Key, new Interval(varInt.Value[0], varInt.Value[1]));
    5151      }
    5252    }
     
    5757
    5858    protected IntervalCollection(IntervalCollection original, Cloner cloner) : base(original, cloner) {
    59       foreach (var keyValuePair in original.VariableIntervals) {
    60         VariableIntervals.Add(keyValuePair.Key, new Interval(keyValuePair.Value.LowerBound, keyValuePair.Value.UpperBound));
     59      foreach (var keyValuePair in original.intervals) {
     60        intervals.Add(keyValuePair.Key, new Interval(keyValuePair.Value.LowerBound, keyValuePair.Value.UpperBound));
    6161      }
    6262    }
     
    6565    }
    6666
    67     public IntervalCollection(IDictionary<string, Interval> variableIntervals) {
    68       this.VariableIntervals = variableIntervals;
     67    public IntervalCollection(IDictionary<string, Interval> intervals) {
     68      this.intervals = intervals;
    6969    }
    7070
    71     public Interval GetInterval(string variable) {
    72       if (!VariableIntervals.ContainsKey(variable)) throw new ArgumentException($"The given variable:{ variable } is not present!");
     71    public Interval GetInterval(string identifier) {
     72      if (!intervals.ContainsKey(identifier)) throw new ArgumentException($"The given identifier:{ identifier } is not present!");
    7373
    74       return VariableIntervals[variable];
     74      return intervals[identifier];
    7575    }
    7676
    77     public void SetInterval(string key, Interval interval) {
    78       VariableIntervals[key] = interval;
     77    public void SetInterval(string identifier, Interval interval) {
     78      intervals[identifier] = interval;
    7979    }
    8080
    81     public void AddInterval(string key, Interval interval) {
    82       VariableIntervals.Add(key, interval);
     81    public void AddInterval(string identifier, Interval interval) {
     82      intervals.Add(identifier, interval);
    8383    }
    8484
    85     public void DeleteInterval(string key) {
    86       VariableIntervals.Remove(key);
     85    public void DeleteInterval(string identifier) {
     86      intervals.Remove(identifier);
    8787    }
    8888
    8989    public IDictionary<string, Interval> GetIntervals() {
    90       return VariableIntervals;
     90      return intervals;
    9191    }
    9292  }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalConstraint.cs

    r17370 r17506  
    2020#endregion
    2121using System;
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    24 using HEAL.Attic;
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
     
    6060    public string Target {
    6161      get => target;
    62       set {
     62      private set {
    6363        if (target == value) return;
    6464        target = value;
     
    6868    }
    6969
    70     public bool IsDerivation {
    71       get => numberOfDerivation > 0;
     70    public bool IsDerivative {
     71      get => NumberOfDerivations > 0;
    7272    }
    7373
    7474    [Storable]
    75     private int numberOfDerivation;
    76     public int NumberOfDerivation {
    77       get => numberOfDerivation;
     75    private int numberOfDerivations;
     76    public int NumberOfDerivations {
     77      get => numberOfDerivations;
    7878      set {
    7979        if (value < 0 || value > 3) throw new ArgumentException("Number of derivation has to be between 0 - 3.");
    80         if (numberOfDerivation == value) return;
    81         numberOfDerivation = value;
     80        if (numberOfDerivations == value) return;
     81        numberOfDerivations = value;
    8282        UpdateExpression();
    8383        OnChanged();
     
    111111    private IntervalConstraint(StorableConstructorFlag _) : base(_) { }
    112112
    113     public IntervalConstraint(string expression, string variable, string target, int numberOfDerivation, Interval interval, bool enabled) : base(){
     113    public IntervalConstraint(string expression, string variable, string target, int numberOfDerivations, Interval interval, bool enabled) : base(){
    114114      this.expression = expression;
    115115      this.variable = variable;
    116116      this.target = target;
    117       this.numberOfDerivation = numberOfDerivation;
     117      this.numberOfDerivations = numberOfDerivations;
    118118      this.interval = interval;
    119119      this.enabled = enabled;
     
    129129      this.Variable = original.Variable;
    130130      this.Target = original.Target;
    131       this.NumberOfDerivation = original.NumberOfDerivation;
     131      this.NumberOfDerivations = original.NumberOfDerivations;
    132132      this.Interval = original.Interval;
    133133      this.Enabled = original.Enabled;
     
    157157      var expression = "";
    158158
    159       if (!IsDerivation) {
     159      if (!IsDerivative) {
    160160        expression = string.Format("Target:{0} in {1}{2} .. {3}{4}",
    161161          Variable,
     
    174174        Interval?.UpperBound,
    175175        "]",
    176         GetDerivationString(numberOfDerivation));
     176        GetDerivationString(numberOfDerivations));
    177177        Expression = expression;
    178178    }
    179179
    180180    private string GetDefinitionString() {
    181       if (!IsDerivation) {
     181      if (!IsDerivative) {
    182182        return "Target " + Variable;
    183183      }
    184       var definition = $"∂{GetDerivationString(numberOfDerivation)}Target/∂{Variable}{GetDerivationString(numberOfDerivation)}";
     184      var definition = $"∂{GetDerivationString(numberOfDerivations)}Target/∂{Variable}{GetDerivationString(numberOfDerivations)}";
    185185      return definition;
    186186    }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs

    r17210 r17506  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HEAL.Attic;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    2728using HeuristicLab.Data;
    2829using HeuristicLab.Parameters;
    29 using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Problems.DataAnalysis {
     
    9494      problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>()));
    9595      problemData.Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, "", new IntervalCollection()));
    96       problemData.Parameters.Add(new FixedValueParameter<ProblemDataConstraint>(IntervalConstraintsParameterName, "", new ProblemDataConstraint()));
     96      problemData.Parameters.Add(new FixedValueParameter<ProblemDataConstraint>(IntervalConstraintsParameterName, "", new ProblemDataConstraint(problemData)));
    9797      emptyProblemData = problemData;
    9898    }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/ProblemDataConstraint.cs

    r17504 r17506  
    3535    private static readonly string exampleInput = "# Example for a target variable constraint:" + Environment.NewLine +
    3636                                                  "Target:'y' in [0 .. 100]" + Environment.NewLine + Environment.NewLine +
    37                                                   "# Example for constraint on model parameter: " + Environment.NewLine +
     37                                                  "# Example for constraints on model parameters: " + Environment.NewLine +
    3838                                                  "d'y'/d'x' in [0 .. 10]" + Environment.NewLine +
    3939                                                  "∂²'y'/∂'x'² in [-1 .. inf.]";
Note: See TracChangeset for help on using the changeset viewer.