Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/ProblemInstances/AircraftMaximumLift.cs @ 16022

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

#2886: Add problem instance providers for grammar enumeration.

File size: 4.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 AircraftMaximumLift : ArtificialRegressionDataDescriptor {
9    public override string Name { get { return "Aircraft Maximum Lift Coefficient"; } }
10
11    public override string Description {
12      get {
13        return "Paper: A multilevel block building algorithm for fast modeling generalized separable systems. " +
14               Environment.NewLine +
15               "Author: Chen Chen, Changtong Luo, Zonglin Jiang" + Environment.NewLine;
16      }
17    }
18
19    protected override string TargetVariable { get { return "f(X)"; } }
20    protected override string[] VariableNames { get { return new string[] { "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "f(X)" }; } }
21    protected override string[] AllowedInputVariables { get { return new string[] { "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18" }; } }
22    protected override int TrainingPartitionStart { get { return 0; } }
23    protected override int TrainingPartitionEnd { get { return 100; } }
24    protected override int TestPartitionStart { get { return 100; } }
25    protected override int TestPartitionEnd { get { return 200; } }
26
27    public int Seed { get; private set; }
28
29    public AircraftMaximumLift() : this((int)System.DateTime.Now.Ticks) { }
30
31    public AircraftMaximumLift(int seed) {
32      Seed = seed;
33    }
34
35    protected override List<List<double>> GenerateValues() {
36      var rand = new MersenneTwister((uint)Seed);
37
38      List<List<double>> data = new List<List<double>>();
39      var x1 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.4, 0.8).ToList();
40
41      var x2 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 3.0, 4.0).ToList();
42
43      var x3 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 20.0, 30.0).ToList();
44
45      var x4 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 2.0, 5.0).ToList();
46      var x13 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 2.0, 5.0).ToList();
47      var x16 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 2.0, 5.0).ToList();
48
49
50      var x5 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1.0, 1.5).ToList();
51      var x6 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 5.0, 7.0).ToList();
52
53      var x7 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.5, 1.5).ToList();
54      var x10 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.5, 1.5).ToList();
55
56      var x8 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1.0, 1.5).ToList();
57      var x11 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1.0, 1.5).ToList();
58
59      var x9 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1.0, 2.0).ToList();
60      var x12 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1.0, 2.0).ToList();
61
62      var x14 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1.0, 1.5).ToList();
63      var x17 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1.0, 1.5).ToList();
64
65      var x15 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 5.0, 7.0).ToList();
66
67      var x18 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 10.0, 20.0).ToList();
68
69      List<double> fx = new List<double>();
70      data.Add(x1);
71      data.Add(x2);
72      data.Add(x3);
73      data.Add(x4);
74      data.Add(x5);
75      data.Add(x6);
76      data.Add(x7);
77      data.Add(x8);
78      data.Add(x9);
79      data.Add(x10);
80      data.Add(x11);
81      data.Add(x12);
82      data.Add(x13);
83      data.Add(x14);
84      data.Add(x15);
85      data.Add(x16);
86      data.Add(x17);
87      data.Add(x18);
88      data.Add(fx);
89
90      for (int i = 0; i < x1.Count; i++) {
91        double fxi = x1[i];
92        fxi = fxi - 0.25 * x4[i] * x5[i] * x6[i] * (4 + 0.1 * (x2[i] / x3[i]) - (x2[i] / x3[i]) * (x2[i] / x3[i]));
93        fxi = fxi + x13[i] * (x14[i] / x15[i]) * x18[i] * x7[i];
94        fxi = fxi - x13[i] * (x14[i] / x15[i]) * x8[i];
95        fxi = fxi + x13[i] * (x14[i] / x15[i]) * x9[i];
96        fxi = fxi + x16[i] * (x17[i] / x15[i]) * x18[i] * x10[i];
97        fxi = fxi - x16[i] * (x17[i] / x15[i]) * x11[i];
98        fxi = fxi + x16[i] * (x17[i] / x15[i]) * x12[i];
99
100        fx.Add(fxi);
101      }
102
103      return data;
104    }
105  }
106}
Note: See TracBrowser for help on using the repository browser.