Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/11/20 14:20:01 (4 years ago)
Author:
dpiringe
Message:

#3076

  • added parameter support for dimensions
  • added region calculation in SymbolicRegressionConstraintAnalyzer
Location:
branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
Files:
2 edited

Legend:

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

    r17705 r17722  
    3030using HeuristicLab.Data;
    3131using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     32using HeuristicLab.Parameters;
    3233
    3334namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.MultiObjective {
     
    3738  public class
    3839    SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator : SymbolicRegressionMultiObjectiveSplittingEvaluator {
     40    public const string DimensionsParameterName = "Dimensions";
     41
     42    public IFixedValueParameter<IntValue> DimensionsParameter => (IFixedValueParameter<IntValue>)Parameters[DimensionsParameterName];
     43
    3944    #region Constructors
    40 
    41     public SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator() { }
     45    public SymbolicRegressionMultiObjectiveMultiSoftConstraintEvaluator() {
     46      Parameters.Add(new FixedValueParameter<IntValue>(DimensionsParameterName, new IntValue(2)));
     47    }
    4248
    4349    [StorableConstructor]
     
    4854
    4955    #endregion
     56
     57    [StorableHook(HookType.AfterDeserialization)]
     58    private void AfterDeserialization() {
     59      if(!Parameters.ContainsKey(DimensionsParameterName))
     60        Parameters.Add(new FixedValueParameter<IntValue>(DimensionsParameterName, new IntValue(2)));
     61    }
    5062
    5163    public override IDeepCloneable Clone(Cloner cloner) {
     
    193205          intervalInterpreter.GetSymbolicExpressionTreeInterval(tree, variableRanges /*, splitting: splitting*/);
    194206      }
    195 
     207     
    196208      //Calculate soft-constraints for intervals
    197209      if (constraint.Interval.Contains(resultInterval)) return 0;
     
    219231      get {
    220232        var objectives = new List<bool> {false};          //First NMSE ==> min
    221         objectives.AddRange(Enumerable.Repeat(false, 2)); //Constraints ==> min
     233        objectives.AddRange(Enumerable.Repeat(false, DimensionsParameter.Value.Value)); //Constraints ==> min
    222234       
    223235        return objectives;
  • branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionConstraintAnalyzer.cs

    r17636 r17722  
    11using System;
    22using System.Collections.Generic;
     3using System.Collections.ObjectModel;
    34using System.Linq;
    45using HEAL.Attic;
     
    9192      Interval resultInterval;
    9293
     94      // create new variable ranges for defined regions
     95      IDictionary<string, Interval> regionRanges = new Dictionary<string, Interval>();
     96      foreach (var kvp in variableRanges)
     97      {
     98        if (kvp.Key != constraint.Target && constraint.Regions.TryGetValue(kvp.Key, out Interval val))
     99        {
     100          regionRanges.Add(kvp.Key, val);
     101        }
     102        else
     103        {
     104          regionRanges.Add(kvp);
     105        }
     106      }
     107
     108      // calculate result interval
    93109      if (!constraint.IsDerivative) {
    94         resultInterval = intervalInterpreter.GetSymbolicExpressionTreeInterval(solution, variableRanges);
     110        resultInterval = intervalInterpreter.GetSymbolicExpressionTreeInterval(solution, new ReadOnlyDictionary<string, Interval>(regionRanges));
    95111      }
    96112      else {
     
    102118        }
    103119
    104         resultInterval = intervalInterpreter.GetSymbolicExpressionTreeInterval(tree, variableRanges);
     120        resultInterval = intervalInterpreter.GetSymbolicExpressionTreeInterval(tree, new ReadOnlyDictionary<string, Interval>(regionRanges));
    105121      }
    106122
Note: See TracChangeset for help on using the changeset viewer.