Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17735


Ignore:
Timestamp:
08/27/20 17:54:39 (4 years ago)
Author:
dpiringe
Message:

#3076

  • added a IResultParameter to show the rising penality
  • added a IValueParameter to set the step size (enables plateaus with the same penality multiplier)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionConstraintAnalyzer.cs

    r17734 r17735  
    2121    private const string ConstraintViolationParameterName = "ConstraintViolations";
    2222    private const string PenalityMultiplierParameterName = "ConstraintsPenalityMultiplier";
     23    private const string PenalityMultiplierResultParameterName = "PenalityMultiplierResultParameter";
     24    private const string StepSizeParameterName = "Step Size";
    2325
    2426    #region parameter properties
     
    3234    public ILookupParameter<DoubleValue> PenalityMultiplierParameter =>
    3335      (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];
    3441
    3542    #endregion
     
    5562      Parameters.Add(new LookupParameter<DoubleValue>(PenalityMultiplierParameterName,
    5663        "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)));
    5768
    5869      ConstraintViolationParameter.DefaultValue = new DataTable(ConstraintViolationParameterName) {
     
    6374          }
    6475      };
     76
     77      PenalityMultiplierResultParameter.DefaultValue = new DataTable(PenalityMultiplierResultParameterName)
     78      {
     79        VisualProperties =
     80          {
     81            XAxisTitle = "Generations",
     82            YAxisTitle = "Penality Multiplier"
     83          }
     84      };
    6585    }
    6686
     
    83103        Parameters.Add(new LookupParameter<DoubleValue>(PenalityMultiplierParameterName,
    84104        "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
    85125    }
    86126
     
    88128    {
    89129      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;
    92134      //GeneralizedExponentialDiscreteDoubleValueModifier
     135      //QuadraticDiscreteDoubleValueModifier
     136      //LinearDiscreteDoubleValueModifier
    93137
    94138      var problemData = RegressionProblemDataParameter.ActualValue;
     
    110154        newDataTable.Rows[constraint.Expression].Values.Add(violations);
    111155      }
     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);
    112161
    113162      return base.Apply();
Note: See TracChangeset for help on using the changeset viewer.