1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 | using HeuristicLab.Core;
|
---|
7 | using HeuristicLab.Optimization;
|
---|
8 | using HEAL.Attic;
|
---|
9 | using HeuristicLab.Common;
|
---|
10 | using HeuristicLab.Problems.Instances;
|
---|
11 | using HeuristicLab.Parameters;
|
---|
12 | using HeuristicLab.Data;
|
---|
13 |
|
---|
14 | namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.SingleObjective {
|
---|
15 | [StorableType("7464E84B-65CC-440A-91F0-9FA920D730F9")]
|
---|
16 | [Item(Name = "StructuredSymbolicRegressionSingleObjectiveProblem", Description = "A problem with a structural definition and unfixed subfunctions.")]
|
---|
17 | public class StructuredSymbolicRegressionSingleObjectiveProblem : SingleObjectiveBasicProblem<MultiEncoding>, IRegressionProblem, IProblemInstanceConsumer<RegressionProblemData> {
|
---|
18 |
|
---|
19 | #region Constants
|
---|
20 | private const string ProblemDataParameterName = "ProblemData";
|
---|
21 | private const string StructureDefinitionParameterName = "Structure Definition";
|
---|
22 | private const string GrammarParameterName = "Grammar";
|
---|
23 |
|
---|
24 | #endregion
|
---|
25 |
|
---|
26 | #region Parameter
|
---|
27 | public IValueParameter<IRegressionProblemData> ProblemDataParameter => (IValueParameter<IRegressionProblemData>)Parameters[ProblemDataParameterName];
|
---|
28 | public IFixedValueParameter<StringValue> StructureDefinitionParameter => (IFixedValueParameter<StringValue>)Parameters[StructureDefinitionParameterName];
|
---|
29 | public IValueParameter<ISymbolicDataAnalysisGrammar> GrammarParameter => (IValueParameter<ISymbolicDataAnalysisGrammar>)Parameters[GrammarParameterName];
|
---|
30 | #endregion
|
---|
31 |
|
---|
32 | #region Properties
|
---|
33 | public IRegressionProblemData ProblemData {
|
---|
34 | get => ProblemDataParameter.Value;
|
---|
35 | set {
|
---|
36 | ProblemDataParameter.Value = value;
|
---|
37 | ProblemDataChanged?.Invoke(this, EventArgs.Empty);
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | public string StructureDefinition {
|
---|
42 | get => StructureDefinitionParameter.Value.Value;
|
---|
43 | set => StructureDefinitionParameter.Value.Value = value;
|
---|
44 | }
|
---|
45 |
|
---|
46 | public ISymbolicDataAnalysisGrammar Grammar {
|
---|
47 | get => GrammarParameter.Value;
|
---|
48 | set => GrammarParameter.Value = value;
|
---|
49 | }
|
---|
50 |
|
---|
51 | IParameter IDataAnalysisProblem.ProblemDataParameter => ProblemDataParameter;
|
---|
52 | IDataAnalysisProblemData IDataAnalysisProblem.ProblemData => ProblemData;
|
---|
53 |
|
---|
54 | public override bool Maximization => false;
|
---|
55 | #endregion
|
---|
56 |
|
---|
57 | #region EventHandlers
|
---|
58 | public event EventHandler ProblemDataChanged;
|
---|
59 | #endregion
|
---|
60 |
|
---|
61 | #region Constructors & Cloning
|
---|
62 | public StructuredSymbolicRegressionSingleObjectiveProblem() {
|
---|
63 | Parameters.Add(new ValueParameter<RegressionProblemData>(ProblemDataParameterName, new RegressionProblemData()));
|
---|
64 | Parameters.Add(new FixedValueParameter<StringValue>(StructureDefinitionParameterName, new StringValue("")));
|
---|
65 | Parameters.Add(new ValueParameter<ISymbolicDataAnalysisGrammar>(GrammarParameterName, new LinearScalingGrammar()));
|
---|
66 | }
|
---|
67 |
|
---|
68 | public StructuredSymbolicRegressionSingleObjectiveProblem(StructuredSymbolicRegressionSingleObjectiveProblem original, Cloner cloner) {
|
---|
69 | }
|
---|
70 |
|
---|
71 | [StorableConstructor]
|
---|
72 | protected StructuredSymbolicRegressionSingleObjectiveProblem(StorableConstructorFlag _) : base(_) {
|
---|
73 | }
|
---|
74 |
|
---|
75 | public override IDeepCloneable Clone(Cloner cloner) =>
|
---|
76 | new StructuredSymbolicRegressionSingleObjectiveProblem(this, cloner);
|
---|
77 | #endregion
|
---|
78 |
|
---|
79 | public override double Evaluate(Individual individual, IRandom random) {
|
---|
80 | return 0.0;
|
---|
81 | }
|
---|
82 |
|
---|
83 | public void Load(RegressionProblemData data) {
|
---|
84 | ProblemData = data;
|
---|
85 | }
|
---|
86 | }
|
---|
87 | }
|
---|