Ignore:
Timestamp:
01/10/22 15:17:35 (5 months ago)
Author:
dpiringe
Message:

#3138

  • added the class ExtendedConstraint which represents an expression (the transformation of the found model) and the corresponding shape constraints
  • added a list of ExtendedConstraint in NMSESingleObjectiveConstraintsEvaluator to make future tests/experiments (exists only temporarily in NMSESingleObjectiveConstraintsEvaluator, will be moved later)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3138_Shape_Constraints_Transformations/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/NMSESingleObjectiveConstraintsEvaluator.cs

    r18180 r18181  
    4141    private const string BoundsEstimatorParameterName = "BoundsEstimator";
    4242    private const string PenaltyFactorParameterName = "PenaltyFactor";
     43    private const string ExtendedConstraintsParameterName = "ExtendedConstraints";
    4344
    4445
     
    5758      (IFixedValueParameter<DoubleValue>)Parameters[PenaltyFactorParameterName];
    5859
     60    public IFixedValueParameter<IItemList<ExtendedConstraint>> ExtendedConstraintsParameter =>
     61      (IFixedValueParameter<IItemList<ExtendedConstraint>>)Parameters[ExtendedConstraintsParameterName];
     62
     63
    5964    public bool OptimizeParameters {
    6065      get => OptimizerParametersParameter.Value.Value;
     
    8186      set => PenaltyFactorParameter.Value.Value = value;
    8287    }
     88
     89    public IEnumerable<ExtendedConstraint> ExtendedConstraints {
     90      get => ExtendedConstraintsParameter.Value;
     91    }
     92     
    8393
    8494
     
    106116      Parameters.Add(new FixedValueParameter<DoubleValue>(PenaltyFactorParameterName,
    107117        "Punishment factor for constraint violations for soft constraint handling (fitness = NMSE + penaltyFactor * avg(violations)) (default: 1.0)", new DoubleValue(1.0)));
     118      Parameters.Add(new FixedValueParameter<ItemList<ExtendedConstraint>>(ExtendedConstraintsParameterName, "", new ItemList<ExtendedConstraint>()));
    108119    }
    109120
     
    164175
    165176      var quality = Calculate(interpreter, tree, estimationLimits.Lower, estimationLimits.Upper, problemData, rows,
    166         BoundsEstimator, UseSoftConstraints, PenalityFactor);
     177        BoundsEstimator, UseSoftConstraints, PenalityFactor, ExtendedConstraints);
    167178      QualityParameter.ActualValue = new DoubleValue(quality);
    168179
     
    176187      IRegressionProblemData problemData, IEnumerable<int> rows,
    177188      IBoundsEstimator estimator,
    178       bool useSoftConstraints = false, double penaltyFactor = 1.0) {
     189      bool useSoftConstraints = false, double penaltyFactor = 1.0,
     190      IEnumerable<ExtendedConstraint> extendedConstraints = null) {
    179191
    180192      var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(tree, problemData.Dataset, rows);
     
    225237      var nmse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree,
    226238        EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper,
    227         problemData, rows, BoundsEstimator, UseSoftConstraints, PenalityFactor);
     239        problemData, rows, BoundsEstimator, UseSoftConstraints, PenalityFactor, ExtendedConstraints);
    228240
    229241      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
Note: See TracChangeset for help on using the changeset viewer.