Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Physics/RocketFuelFlow.cs @ 16755

Last change on this file since 16755 was 16565, checked in by gkronber, 6 years ago

#2520: merged changes from PersistenceOverhaul branch (r16451:16564) into trunk

File size: 3.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using HeuristicLab.Random;
26
27namespace HeuristicLab.Problems.Instances.DataAnalysis {
28  public class RocketFuelFlow : ArtificialRegressionDataDescriptor {
29    public override string Name { get { return "Rocket Fuel Flow m_dot = p0 A / sqrt(T0) * sqrt(γ/R (2/(γ+1))^((γ+1) / (γ-1)))"; } }
30
31    public override string Description {
32      get {
33        return "A full description of this problem instance is given in: " + Environment.NewLine +
34          "Chen Chen, Changtong Luo, Zonglin Jiang, \"A multilevel block building algorithm for fast " +
35          "modeling generalized separable systems\", Expert Systems with Applications, Volume 109, 2018, " +
36          "Pages 25-34 https://doi.org/10.1016/j.eswa.2018.05.021. " + Environment.NewLine +
37          "Function: m_dot = p0 A / sqrt(T0) * sqrt(γ/R (2/(γ+1))^((γ+1) / (γ-1)))" + Environment.NewLine +
38          "with p0 ∈ [4e5 Pa, 6e5 Pa]," + Environment.NewLine +
39          "A ∈ [0.5m², 1.5m²]," + Environment.NewLine +
40          "T0 ∈ [250°K, 260°K]," + Environment.NewLine +
41          "γ=1.4 and R=287 J/(kg*K)" + Environment.NewLine +
42          "The factor sqrt(γ/R (2/(γ+1))^((γ+1) / (γ-1))) is constant as γ and R are constants.";
43      }
44    }
45
46    protected override string TargetVariable { get { return "m_dot"; } }
47    protected override string[] VariableNames { get { return new string[] { "p0", "A", "T0", "m_dot" }; } }
48    protected override string[] AllowedInputVariables { get { return new string[] { "p0", "A", "T0" }; } }
49    protected override int TrainingPartitionStart { get { return 0; } }
50    protected override int TrainingPartitionEnd { get { return 100; } }
51    protected override int TestPartitionStart { get { return 100; } }
52    protected override int TestPartitionEnd { get { return 200; } }
53
54    public int Seed { get; private set; }
55
56    public RocketFuelFlow() : this((int)System.DateTime.Now.Ticks) { }
57
58    public RocketFuelFlow(int seed) {
59      Seed = seed;
60    }
61
62    protected override List<List<double>> GenerateValues() {
63      var rand = new MersenneTwister((uint)Seed);
64
65      List<List<double>> data = new List<List<double>>();
66      var p0 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 4.0e5, 6.0e5).ToList();
67      var A = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.5, 1.5).ToList();
68      var T0 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 250.0, 260.0).ToList();
69
70      List<double> m_dot = new List<double>();
71      data.Add(p0);
72      data.Add(A);
73      data.Add(T0);
74      data.Add(m_dot);
75      double R = 287.0;
76      double γ = 1.4;
77      var c = Math.Sqrt(γ / R * Math.Pow(2 / (γ + 1), (γ + 1) / (γ - 1)));
78      for (int i = 0; i < p0.Count; i++) {
79        double m_dot_i = p0[i] * A[i] / Math.Sqrt(T0[i]) * c;
80        m_dot.Add(m_dot_i);
81      }
82
83      return data;
84    }
85  }
86}
Note: See TracBrowser for help on using the repository browser.