Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/08/21 15:37:43 (3 years ago)
Author:
gkronber
Message:

#3073 changed ProblemData loading of IShapeConstrainedRegressionProblems to make sure we can also load ShapeConstrainedRegressionProblemData objects correctly without losing shape constraints

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/ShapeConstrainedRegressionSingleObjectiveProblem.cs

    r17964 r18107  
    2828  [StorableType("B35ADCA7-E902-4BEE-9DDE-DF8BBC1E27FE")]
    2929  [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 150)]
    30   public class ShapeConstrainedRegressionSingleObjectiveProblem : SymbolicRegressionSingleObjectiveProblem {
     30  public class ShapeConstrainedRegressionSingleObjectiveProblem : SymbolicRegressionSingleObjectiveProblem, IShapeConstrainedRegressionProblem {
    3131    [StorableConstructor]
    3232    protected ShapeConstrainedRegressionSingleObjectiveProblem(StorableConstructorFlag _) : base(_) { }
     
    3434    public override IDeepCloneable Clone(Cloner cloner) { return new ShapeConstrainedRegressionSingleObjectiveProblem(this, cloner); }
    3535
     36    public ShapeConstrainedRegressionProblemData ShapeConstrainedRegressionProblemData {
     37      get => (ShapeConstrainedRegressionProblemData)ProblemData;
     38      set => ProblemData = value;
     39    }
    3640    public ShapeConstrainedRegressionSingleObjectiveProblem()
    3741      : base(new ShapeConstrainedRegressionProblemData(), new NMSESingleObjectiveConstraintsEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) {
     
    5155
    5256    public override void Load(IRegressionProblemData data) {
    53       var scProblemData = new ShapeConstrainedRegressionProblemData(data.Dataset, data.AllowedInputVariables, data.TargetVariable,
    54                                                                     data.TrainingPartition, data.TestPartition) {
    55         Name = data.Name,
    56         Description = data.Description
    57       };
     57      if (data is ShapeConstrainedRegressionProblemData scProblemData) {
     58      } else {
     59        scProblemData = new ShapeConstrainedRegressionProblemData(data.Dataset, data.AllowedInputVariables, data.TargetVariable,
     60                                                                  data.TrainingPartition, data.TestPartition) {
     61          Name = data.Name,
     62          Description = data.Description
     63        };
     64      }
    5865
    5966      base.Load(scProblemData);
Note: See TracChangeset for help on using the changeset viewer.