Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2886_SymRegGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.SymRegGrammarEnumeration/ProblemInstances/RocketFuelFlow.cs @ 15928

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

#2886: Add problem instance providers for grammar enumeration.

File size: 2.4 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 RocketFuelFlow : ArtificialRegressionDataDescriptor {
9    public override string Name { get { return "Rocket Fuel Flow f(X) = 4000*x1*x2/sqrt(x3)"; } }
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) = 4000*x1*x2/sqrt(x3)" + Environment.NewLine +
16               "with x1 in [4,6], x2 in [0.5, 1.5], x3 in [250,260]";
17      }
18    }
19
20    protected override string TargetVariable { get { return "f(X)"; } }
21    protected override string[] VariableNames { get { return new string[] { "x1", "x2", "x3", "f(X)" }; } }
22    protected override string[] AllowedInputVariables { get { return new string[] { "x1", "x2", "x3" }; } }
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 RocketFuelFlow() : this((int)System.DateTime.Now.Ticks) { }
31
32    public RocketFuelFlow(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, 4.0, 6.0).ToList();
41      var x2 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.5, 1.5).ToList();
42      var x3 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 250.0, 260.0).ToList();
43
44      List<double> fx = new List<double>();
45      data.Add(x1);
46      data.Add(x2);
47      data.Add(x3);
48      data.Add(fx);
49
50      for (int i = 0; i < x1.Count; i++) {
51        double fxi = 4000 * x1[i] * x2[i] / Math.Sqrt(x3[i]);
52        fx.Add(fxi);
53      }
54
55      return data;
56    }
57  }
58}
Note: See TracBrowser for help on using the repository browser.