Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/ProblemInstances/AircraftLift.cs @ 16123

Last change on this file since 16123 was 15928, checked in by lkammere, 7 years ago

#2886: Add problem instance providers for grammar enumeration.

File size: 2.9 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using HeuristicLab.Problems.Instances.DataAnalysis;
5using HeuristicLab.Random;
6
7namespace HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration {
8  class AircraftLift : ArtificialRegressionDataDescriptor {
9    public override string Name { get { return "Aircraft Lift Coefficient C_L = x1*(x2 - 2) + x3*x4*x5/x6"; } }
10
11    public override string Description {
12      get {
13        return "Paper: A multilevel block building algorithm for fast modeling generalized separable systems. " + Environment.NewLine +
14               "Author: Chen Chen, Changtong Luo, Zonglin Jiang" + Environment.NewLine +
15               "Function: f(X) = x1*(x2 - 2) + x3*x4*x5/x6" + Environment.NewLine +
16               "with x1 in [0.4,0.8], x2 in [5, 10], x3 in [0.4,0.8], x4 in [5,10], x5 in [1,1.5], x6 in [5,7]";
17      }
18    }
19
20    protected override string TargetVariable { get { return "f(X)"; } }
21    protected override string[] VariableNames { get { return new string[] { "x1", "x2", "x3", "x4", "x5", "x6", "f(X)" }; } }
22    protected override string[] AllowedInputVariables { get { return new string[] { "x1", "x2", "x3", "x4", "x5", "x6" }; } }
23    protected override int TrainingPartitionStart { get { return 0; } }
24    protected override int TrainingPartitionEnd { get { return 100; } }
25    protected override int TestPartitionStart { get { return 100; } }
26    protected override int TestPartitionEnd { get { return 200; } }
27
28    public int Seed { get; private set; }
29
30    public AircraftLift() : this((int)System.DateTime.Now.Ticks) { }
31
32    public AircraftLift(int seed) {
33      Seed = seed;
34    }
35
36    protected override List<List<double>> GenerateValues() {
37      var rand = new MersenneTwister((uint)Seed);
38
39      List<List<double>> data = new List<List<double>>();
40      var x1 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.4, 0.8).ToList();
41      var x2 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 5.0, 10.0).ToList();
42      var x3 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.4, 0.8).ToList();
43      var x4 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 5.0, 10.0).ToList();
44      var x5 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1.0, 1.5).ToList();
45      var x6 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 5.0, 7.0).ToList();
46
47      List<double> fx = new List<double>();
48      data.Add(x1);
49      data.Add(x2);
50      data.Add(x3);
51      data.Add(x4);
52      data.Add(x5);
53      data.Add(x6);
54      data.Add(fx);
55
56      for (int i = 0; i < x1.Count; i++) {
57        double fxi = x1[i] * (x2[i] - 2.0) + x3[i] * x4[i] * x5[i] / x6[i];
58        fx.Add(fxi);
59      }
60
61      return data;
62    }
63  }
64}
Note: See TracBrowser for help on using the repository browser.