Changeset 17506 for branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
- Timestamp:
- 04/10/20 14:04:59 (5 years ago)
- Location:
- branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalCollection.cs
r17145 r17506 33 33 get => HeuristicLab.Common.Resources.VSImageLibrary.Object; 34 34 } 35 private IDictionary<string, Interval> VariableIntervals { get; } = new Dictionary<string, Interval>();35 private IDictionary<string, Interval> intervals { get; } = new Dictionary<string, Interval>(); 36 36 37 37 [Storable(Name = "StorableIntervalInformation")] … … 39 39 get { 40 40 var l = new List<KeyValuePair<string, double[]>>(); 41 foreach (var varInt in VariableIntervals)41 foreach (var varInt in intervals) 42 42 43 43 l.Add(new KeyValuePair<string, double[]>(varInt.Key, … … 48 48 set { 49 49 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])); 51 51 } 52 52 } … … 57 57 58 58 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)); 61 61 } 62 62 } … … 65 65 } 66 66 67 public IntervalCollection(IDictionary<string, Interval> variableIntervals) {68 this. VariableIntervals = variableIntervals;67 public IntervalCollection(IDictionary<string, Interval> intervals) { 68 this.intervals = intervals; 69 69 } 70 70 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!"); 73 73 74 return VariableIntervals[variable];74 return intervals[identifier]; 75 75 } 76 76 77 public void SetInterval(string key, Interval interval) {78 VariableIntervals[key] = interval;77 public void SetInterval(string identifier, Interval interval) { 78 intervals[identifier] = interval; 79 79 } 80 80 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); 83 83 } 84 84 85 public void DeleteInterval(string key) {86 VariableIntervals.Remove(key);85 public void DeleteInterval(string identifier) { 86 intervals.Remove(identifier); 87 87 } 88 88 89 89 public IDictionary<string, Interval> GetIntervals() { 90 return VariableIntervals;90 return intervals; 91 91 } 92 92 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalConstraint.cs
r17370 r17506 20 20 #endregion 21 21 using System; 22 using HEAL.Attic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 using HEAL.Attic;25 25 26 26 namespace HeuristicLab.Problems.DataAnalysis { … … 60 60 public string Target { 61 61 get => target; 62 set {62 private set { 63 63 if (target == value) return; 64 64 target = value; … … 68 68 } 69 69 70 public bool IsDerivati on{71 get => numberOfDerivation> 0;70 public bool IsDerivative { 71 get => NumberOfDerivations > 0; 72 72 } 73 73 74 74 [Storable] 75 private int numberOfDerivation ;76 public int NumberOfDerivation {77 get => numberOfDerivation ;75 private int numberOfDerivations; 76 public int NumberOfDerivations { 77 get => numberOfDerivations; 78 78 set { 79 79 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; 82 82 UpdateExpression(); 83 83 OnChanged(); … … 111 111 private IntervalConstraint(StorableConstructorFlag _) : base(_) { } 112 112 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(){ 114 114 this.expression = expression; 115 115 this.variable = variable; 116 116 this.target = target; 117 this.numberOfDerivation = numberOfDerivation;117 this.numberOfDerivations = numberOfDerivations; 118 118 this.interval = interval; 119 119 this.enabled = enabled; … … 129 129 this.Variable = original.Variable; 130 130 this.Target = original.Target; 131 this.NumberOfDerivation = original.NumberOfDerivation;131 this.NumberOfDerivations = original.NumberOfDerivations; 132 132 this.Interval = original.Interval; 133 133 this.Enabled = original.Enabled; … … 157 157 var expression = ""; 158 158 159 if (!IsDerivati on) {159 if (!IsDerivative) { 160 160 expression = string.Format("Target:{0} in {1}{2} .. {3}{4}", 161 161 Variable, … … 174 174 Interval?.UpperBound, 175 175 "]", 176 GetDerivationString(numberOfDerivation ));176 GetDerivationString(numberOfDerivations)); 177 177 Expression = expression; 178 178 } 179 179 180 180 private string GetDefinitionString() { 181 if (!IsDerivati on) {181 if (!IsDerivative) { 182 182 return "Target " + Variable; 183 183 } 184 var definition = $"∂{GetDerivationString(numberOfDerivation )}Target/∂{Variable}{GetDerivationString(numberOfDerivation)}";184 var definition = $"∂{GetDerivationString(numberOfDerivations)}Target/∂{Variable}{GetDerivationString(numberOfDerivations)}"; 185 185 return definition; 186 186 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r17210 r17506 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 28 using HeuristicLab.Data; 28 29 using HeuristicLab.Parameters; 29 using HEAL.Attic;30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis { … … 94 94 problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>())); 95 95 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))); 97 97 emptyProblemData = problemData; 98 98 }
Note: See TracChangeset
for help on using the changeset viewer.