Changeset 17627
- Timestamp:
- 06/23/20 13:22:04 (5 years ago)
- Location:
- branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj
r17623 r17627 172 172 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveMultiHardConstraintEvaluator.cs" /> 173 173 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator.cs" /> 174 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveSplittingEvaluator.cs" /> 174 175 <Compile Include="MultiObjective\SymbolicRegressionMultiObjectiveValidationBestSolutionAnalyzer.cs" /> 175 176 <Compile Include="Plugin.cs" /> -
branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator.cs
r17623 r17627 30 30 using HeuristicLab.Data; 31 31 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 32 using HeuristicLab.Parameters;33 32 34 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.MultiObjective { … … 37 36 [StorableType("8E9D76B7-ED9C-43E7-9898-01FBD3633880")] 38 37 public class 39 SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator : SymbolicRegressionMultiObjectiveEvaluator { 40 private const string MinIntervalWidthParameterName = "MinIntervalWidth"; 41 private const string MaxIntervalSplitDepthParameterName = "MaxIntervalSplitDepth"; 42 43 public IFixedValueParameter<DoubleValue> MinIntervalWidthParameter => 44 (IFixedValueParameter<DoubleValue>) Parameters[MinIntervalWidthParameterName]; 45 46 public IFixedValueParameter<IntValue> MaxIntervalSplitDepthParameter => 47 (IFixedValueParameter<IntValue>) Parameters[MaxIntervalSplitDepthParameterName]; 48 49 public double MinIntervalWidth => MinIntervalWidthParameter.Value.Value; 50 51 public int MaxIntervalSplitDepth => MaxIntervalSplitDepthParameter.Value.Value; 52 38 SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator : SymbolicRegressionMultiObjectiveSplittingEvaluator { 53 39 #region Constructors 54 40 55 public SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator() { 56 Parameters.Add(new FixedValueParameter<DoubleValue>(MinIntervalWidthParameterName, new DoubleValue(1.0))); 57 Parameters.Add(new FixedValueParameter<IntValue>(MaxIntervalSplitDepthParameterName, new IntValue(5))); 58 } 41 public SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator() { } 59 42 60 43 [StorableConstructor] … … 72 55 73 56 public override IOperation InstrumentedApply() { 74 var rows = GenerateRowsToEvaluate(); 75 var solution = SymbolicExpressionTreeParameter.ActualValue; 76 var problemData = ProblemDataParameter.ActualValue; 77 var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; 78 var estimationLimits = EstimationLimitsParameter.ActualValue; 79 //var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value; 57 var rows = GenerateRowsToEvaluate(); 58 var solution = SymbolicExpressionTreeParameter.ActualValue; 59 var problemData = ProblemDataParameter.ActualValue; 60 var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; 61 var estimationLimits = EstimationLimitsParameter.ActualValue; 62 var minIntervalWidth = MinSplittingWidth; 63 var maxIntervalSplitDepth = MaxSplittingDepth; 64 //var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value; 80 65 var applyLinearScaling = false; 81 66 82 67 if (UseConstantOptimization) 83 68 SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(interpreter, solution, problemData, rows, 84 85 86 87 88 69 applyLinearScaling, 70 ConstantOptimizationIterations, 71 ConstantOptimizationUpdateVariableWeights, 72 estimationLimits.Lower, 73 estimationLimits.Upper); 89 74 90 75 var qualities = Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, 91 rows, applyLinearScaling, DecimalPlaces, MinIntervalWidth, MaxIntervalSplitDepth);76 rows, applyLinearScaling, DecimalPlaces, minIntervalWidth, maxIntervalSplitDepth); 92 77 QualitiesParameter.ActualValue = new DoubleArray(qualities); 93 78 return base.InstrumentedApply(); … … 102 87 103 88 var quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, 104 105 106 ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces, MinIntervalWidth,107 MaxIntervalSplitDepth);89 EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, 90 problemData, rows, 91 ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces, MinSplittingWidth, 92 MaxSplittingDepth); 108 93 109 94 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; … … 119 104 double upperEstimationLimit, 120 105 IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, 121 int decimalPlaces, double minIntervalSplitWidth, int maxIntervalSplitDe tph) {106 int decimalPlaces, double minIntervalSplitWidth, int maxIntervalSplitDepth) { 122 107 OnlineCalculatorError errorState; 123 108 var estimatedValues = … … 144 129 foreach (var c in constraints) { 145 130 var penalty = ConstraintExceeded(c, intervalInterpreter, variableRanges, 146 131 solution /*, problemData.IntervalSplitting*/); 147 132 var maxP = 0.1; 148 133 … … 163 148 if (constraint.Variable != null && !variableRanges.ContainsKey(constraint.Variable)) 164 149 throw new ArgumentException( 165 166 150 $"The given variable {constraint.Variable} in the constraint does not exists in the model.", 151 nameof(IntervalConstraintsParser)); 167 152 Interval resultInterval; 168 153 if (!constraint.IsDerivative) { … … 207 192 public override IEnumerable<bool> Maximization { 208 193 get { 209 var objectives = new List<bool> {false}; //First NMSE ==> min194 var objectives = new List<bool> {false}; //First NMSE ==> min 210 195 objectives.AddRange(Enumerable.Repeat(false, 3)); //Constraints ==> min 211 196
Note: See TracChangeset
for help on using the changeset viewer.