Changeset 17735
- Timestamp:
- 08/27/20 17:54:39 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionConstraintAnalyzer.cs
r17734 r17735 21 21 private const string ConstraintViolationParameterName = "ConstraintViolations"; 22 22 private const string PenalityMultiplierParameterName = "ConstraintsPenalityMultiplier"; 23 private const string PenalityMultiplierResultParameterName = "PenalityMultiplierResultParameter"; 24 private const string StepSizeParameterName = "Step Size"; 23 25 24 26 #region parameter properties … … 32 34 public ILookupParameter<DoubleValue> PenalityMultiplierParameter => 33 35 (ILookupParameter<DoubleValue>)Parameters[PenalityMultiplierParameterName]; 36 public IValueParameter<IntValue> StepSizeParameter => 37 (IValueParameter<IntValue>)Parameters[StepSizeParameterName]; 38 39 public IResultParameter<DataTable> PenalityMultiplierResultParameter => 40 (IResultParameter<DataTable>)Parameters[PenalityMultiplierResultParameterName]; 34 41 35 42 #endregion … … 55 62 Parameters.Add(new LookupParameter<DoubleValue>(PenalityMultiplierParameterName, 56 63 "Lookup parameter for the penality multiplier.", "PenalityMultiplier")); 64 Parameters.Add(new ResultParameter<DataTable>(PenalityMultiplierResultParameterName, 65 "Shows the behavior of the penality multiplier.")); 66 Parameters.Add(new ValueParameter<IntValue>(StepSizeParameterName, 67 "Defines the step size for the increasing penality multiplier.", new IntValue(1))); 57 68 58 69 ConstraintViolationParameter.DefaultValue = new DataTable(ConstraintViolationParameterName) { … … 63 74 } 64 75 }; 76 77 PenalityMultiplierResultParameter.DefaultValue = new DataTable(PenalityMultiplierResultParameterName) 78 { 79 VisualProperties = 80 { 81 XAxisTitle = "Generations", 82 YAxisTitle = "Penality Multiplier" 83 } 84 }; 65 85 } 66 86 … … 83 103 Parameters.Add(new LookupParameter<DoubleValue>(PenalityMultiplierParameterName, 84 104 "Lookup parameter for the penality multiplier.", "PenalityMultiplier")); 105 106 if (!Parameters.ContainsKey(PenalityMultiplierResultParameterName)) 107 { 108 Parameters.Add(new ResultParameter<DataTable>(PenalityMultiplierResultParameterName, 109 "Shows the behavior of the penality multiplier.")); 110 111 PenalityMultiplierResultParameter.DefaultValue = new DataTable(PenalityMultiplierResultParameterName) 112 { 113 VisualProperties = 114 { 115 XAxisTitle = "Generations", 116 YAxisTitle = "Penality Multiplier" 117 } 118 }; 119 } 120 121 if (!Parameters.ContainsKey(StepSizeParameterName)) 122 Parameters.Add(new ValueParameter<IntValue>(StepSizeParameterName, 123 "Defines the step size for the increasing penality multiplier.", new IntValue(1))); 124 85 125 } 86 126 … … 88 128 { 89 129 Iterations++; 90 91 PenalityMultiplierParameter.ActualValue = new DoubleValue(QuadraticDiscreteDoubleValueModifier.Apply(0, 0.05, 1.0, Iterations, 0, 2000)); 130 var rowName = "GeneralizedExponentialDiscreteDoubleValueModifier"; 131 var stepSize = StepSizeParameter?.Value?.Value ?? 1; 132 var penalityMultiplier = new DoubleValue(LinearDiscreteDoubleValueModifier.Apply(0, 0.1, 1.0, (int)(Iterations / stepSize) * stepSize, 0, 1000)); 133 PenalityMultiplierParameter.ActualValue = penalityMultiplier; 92 134 //GeneralizedExponentialDiscreteDoubleValueModifier 135 //QuadraticDiscreteDoubleValueModifier 136 //LinearDiscreteDoubleValueModifier 93 137 94 138 var problemData = RegressionProblemDataParameter.ActualValue; … … 110 154 newDataTable.Rows[constraint.Expression].Values.Add(violations); 111 155 } 156 157 var penalityDataTable = PenalityMultiplierResultParameter.ActualValue; 158 if (penalityDataTable.Rows.Count == 0) 159 penalityDataTable.Rows.Add(new DataRow(rowName)); 160 penalityDataTable.Rows[rowName].Values.Add(penalityMultiplier.Value); 112 161 113 162 return base.Apply();
Note: See TracChangeset
for help on using the changeset viewer.