- Timestamp:
- 12/08/21 15:37:43 (3 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/ShapeConstrainedRegressionSingleObjectiveProblem.cs
r17964 r18107 28 28 [StorableType("B35ADCA7-E902-4BEE-9DDE-DF8BBC1E27FE")] 29 29 [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 150)] 30 public class ShapeConstrainedRegressionSingleObjectiveProblem : SymbolicRegressionSingleObjectiveProblem {30 public class ShapeConstrainedRegressionSingleObjectiveProblem : SymbolicRegressionSingleObjectiveProblem, IShapeConstrainedRegressionProblem { 31 31 [StorableConstructor] 32 32 protected ShapeConstrainedRegressionSingleObjectiveProblem(StorableConstructorFlag _) : base(_) { } … … 34 34 public override IDeepCloneable Clone(Cloner cloner) { return new ShapeConstrainedRegressionSingleObjectiveProblem(this, cloner); } 35 35 36 public ShapeConstrainedRegressionProblemData ShapeConstrainedRegressionProblemData { 37 get => (ShapeConstrainedRegressionProblemData)ProblemData; 38 set => ProblemData = value; 39 } 36 40 public ShapeConstrainedRegressionSingleObjectiveProblem() 37 41 : base(new ShapeConstrainedRegressionProblemData(), new NMSESingleObjectiveConstraintsEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) { … … 51 55 52 56 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 } 58 65 59 66 base.Load(scProblemData); -
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblem.cs
r17180 r18107 92 92 93 93 #region Import & Export 94 public v oid Load(T data) {94 public virtual void Load(T data) { 95 95 Name = data.Name; 96 96 Description = data.Description; … … 98 98 } 99 99 100 public T Export() {100 public virtual T Export() { 101 101 return ProblemData; 102 102 } -
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ShapeConstrainedRegressionProblem.cs
r17960 r18107 24 24 using HeuristicLab.Core; 25 25 26 namespace HeuristicLab.Problems.DataAnalysis {26 namespace HeuristicLab.Problems.DataAnalysis { 27 27 [StorableType("B53C4C71-3715-4BB1-9A95-4E969D8135C6")] 28 28 [Item("Shape-constrained Regression Problem", "A regression problem with shape constraints.")] 29 public class ShapeConstrainedRegressionProblem : DataAnalysisProblem<I ShapeConstrainedRegressionProblemData>, IShapeConstrainedRegressionProblem {29 public class ShapeConstrainedRegressionProblem : DataAnalysisProblem<IRegressionProblemData>, IShapeConstrainedRegressionProblem { 30 30 [StorableConstructor] 31 31 protected ShapeConstrainedRegressionProblem(StorableConstructorFlag _) : base(_) { } … … 33 33 public override IDeepCloneable Clone(Cloner cloner) { return new ShapeConstrainedRegressionProblem(this, cloner); } 34 34 35 public ShapeConstrainedRegressionProblemData ShapeConstrainedRegressionProblemData { 36 get => (ShapeConstrainedRegressionProblemData)ProblemData; 37 set => ProblemData = value; 38 } 35 39 public ShapeConstrainedRegressionProblem() : base(new ShapeConstrainedRegressionProblemData()) { } 40 41 42 public override void Load(IRegressionProblemData data) { 43 if (data is ShapeConstrainedRegressionProblemData scProblemData) { 44 // use directly 45 } else { 46 scProblemData = new ShapeConstrainedRegressionProblemData(data.Dataset, data.AllowedInputVariables, data.TargetVariable, 47 data.TrainingPartition, data.TestPartition) { 48 Name = data.Name, 49 Description = data.Description 50 }; 51 } 52 base.Load(scProblemData); 53 } 36 54 } 37 55 } -
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IShapeConstrainedRegressionProblem.cs
r17960 r18107 24 24 namespace HeuristicLab.Problems.DataAnalysis { 25 25 [StorableType("C6E9D32A-7727-487E-859C-DF24EDCC5922")] 26 public interface IShapeConstrainedRegressionProblem : IDataAnalysisProblem<IShapeConstrainedRegressionProblemData> { 26 public interface IShapeConstrainedRegressionProblem : IRegressionProblem { 27 ShapeConstrainedRegressionProblemData ShapeConstrainedRegressionProblemData { get; set; } 27 28 } 28 29 }
Note: See TracChangeset
for help on using the changeset viewer.