Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 17578 was 17180, checked in by swagner, 5 years ago

#2875: Removed years in copyrights

File size: 4.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 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.Common;
26using HeuristicLab.Random;
27
28namespace HeuristicLab.Problems.Instances.DataAnalysis {
29  public class RocketFuelFlow : ArtificialRegressionDataDescriptor {
30    public override string Name { get { return "Rocket Fuel Flow m_dot = p0 A / sqrt(T0) * sqrt(γ/R (2/(γ+1))^((γ+1) / (γ-1)))"; } }
31
32    public override string Description {
33      get {
34        return "A full description of this problem instance is given in: " + Environment.NewLine +
35          "Chen Chen, Changtong Luo, Zonglin Jiang, \"A multilevel block building algorithm for fast " +
36          "modeling generalized separable systems\", Expert Systems with Applications, Volume 109, 2018, " +
37          "Pages 25-34 https://doi.org/10.1016/j.eswa.2018.05.021. " + Environment.NewLine +
38          "Function: m_dot = p0 A / sqrt(T0) * sqrt(γ/R (2/(γ+1))^((γ+1) / (γ-1)))" + Environment.NewLine +
39          "with total pressure p0 ∈ [4e5 Pa, 6e5 Pa]," + Environment.NewLine +
40          "cross-sectional area of the nozzle A ∈ [0.5m², 1.5m²]," + Environment.NewLine +
41          "total temperature T0 ∈ [250°K, 260°K]," + Environment.NewLine +
42          "specific heat capacity γ = 1.4 and gas constant R = 287 J/(kg*K)" + Environment.NewLine +
43          "The factor sqrt(γ/R (2/(γ+1))^((γ+1) / (γ-1))) is constant because γ and R are constants.";
44      }
45    }
46
47    protected override string TargetVariable { get { return "m_dot"; } }
48    protected override string[] VariableNames { get { return new string[] { "p0", "A", "T0", "m_dot", "m_dot_noise" }; } }
49    protected override string[] AllowedInputVariables { get { return new string[] { "p0", "A", "T0" }; } }
50    protected override int TrainingPartitionStart { get { return 0; } }
51    protected override int TrainingPartitionEnd { get { return 100; } }
52    protected override int TestPartitionStart { get { return 100; } }
53    protected override int TestPartitionEnd { get { return 200; } }
54
55    public int Seed { get; private set; }
56
57    public RocketFuelFlow() : this((int)System.DateTime.Now.Ticks) { }
58
59    public RocketFuelFlow(int seed) {
60      Seed = seed;
61    }
62
63    protected override List<List<double>> GenerateValues() {
64      var rand = new MersenneTwister((uint)Seed);
65
66      List<List<double>> data = new List<List<double>>();
67      var p0 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 4.0e5, 6.0e5).ToList();
68      var A = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.5, 1.5).ToList();
69      var T0 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 250.0, 260.0).ToList();
70
71      var m_dot = new List<double>();
72      var m_dot_noise = new List<double>();
73      data.Add(p0);
74      data.Add(A);
75      data.Add(T0);
76      data.Add(m_dot);
77      data.Add(m_dot_noise);
78      double R = 287.0;
79      double γ = 1.4;
80      var c = Math.Sqrt(γ / R * Math.Pow(2 / (γ + 1), (γ + 1) / (γ - 1)));
81      for (int i = 0; i < p0.Count; i++) {
82        double m_dot_i = p0[i] * A[i] / Math.Sqrt(T0[i]) * c;
83        m_dot.Add(m_dot_i);
84      }
85
86      var sigma_noise = 0.05 * m_dot.StandardDeviationPop();
87      m_dot_noise.AddRange(m_dot.Select(md => md + NormalDistributedRandom.NextDouble(rand, 0, sigma_noise)));
88      return data;
89    }
90  }
91}
Note: See TracBrowser for help on using the repository browser.