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 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Linq;
|
---|
25 | using HeuristicLab.Common;
|
---|
26 | using HeuristicLab.Random;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Problems.Instances.DataAnalysis {
|
---|
29 | public class FluidDynamics : ArtificialRegressionDataDescriptor {
|
---|
30 | public override string Name { get { return "Spinning cylinder flow Ψ = V_∞ r sin(θ) (1 - R²/r²) + Γ/(2 π) ln(r/R)"; } }
|
---|
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: Ψ = V_∞ r sin(θ) (1 - R²/r²) + Γ/(2 π) ln(r/R)" + Environment.NewLine +
|
---|
39 | "with uniform stream velocity V_∞ ∈ [60 m/s, 65 m/s]," + Environment.NewLine +
|
---|
40 | "angle for polar coordinate vector field θ ∈ [30°, 40°]," + Environment.NewLine +
|
---|
41 | "radius for polar coordinate vector field r ∈ [0.5m, 0.8m]," + Environment.NewLine +
|
---|
42 | "radius of cylinder R ∈ [0.2m, 0.5m]," + Environment.NewLine +
|
---|
43 | "vortex strength (induced by spinning) Γ ∈ [5 m²/s, 10 m²/s]" + Environment.NewLine +
|
---|
44 | "Note: the definition deviates from the definition used in the source above because here we have r > R meaning we want to calculate the flow _outside_ of the cylinder.";
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | protected override string TargetVariable { get { return "Ψ"; } }
|
---|
49 | protected override string[] VariableNames { get { return new string[] { "V_∞", "θ", "r", "R", "Γ", "Ψ", "Ψ_noise" }; } }
|
---|
50 | protected override string[] AllowedInputVariables { get { return new string[] { "V_∞", "θ", "r", "R", "Γ" }; } }
|
---|
51 | protected override int TrainingPartitionStart { get { return 0; } }
|
---|
52 | protected override int TrainingPartitionEnd { get { return 100; } }
|
---|
53 | protected override int TestPartitionStart { get { return 100; } }
|
---|
54 | protected override int TestPartitionEnd { get { return 200; } }
|
---|
55 |
|
---|
56 | public int Seed { get; private set; }
|
---|
57 |
|
---|
58 | public FluidDynamics() : this((int)System.DateTime.Now.Ticks) { }
|
---|
59 |
|
---|
60 | public FluidDynamics(int seed) {
|
---|
61 | Seed = seed;
|
---|
62 | }
|
---|
63 |
|
---|
64 | protected override List<List<double>> GenerateValues() {
|
---|
65 | var rand = new MersenneTwister((uint)Seed);
|
---|
66 |
|
---|
67 | List<List<double>> data = new List<List<double>>();
|
---|
68 | var V_inf = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 60.0, 65.0).ToList();
|
---|
69 | var th = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 30.0, 40.0).ToList();
|
---|
70 | var r = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.5, 0.8).ToList();
|
---|
71 | var R = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.2, 0.5).ToList();
|
---|
72 | var G = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 5, 10).ToList();
|
---|
73 |
|
---|
74 | var Psi = new List<double>();
|
---|
75 | var Psi_noise = new List<double>();
|
---|
76 |
|
---|
77 | data.Add(V_inf);
|
---|
78 | data.Add(th);
|
---|
79 | data.Add(r);
|
---|
80 | data.Add(R);
|
---|
81 | data.Add(G);
|
---|
82 | data.Add(Psi);
|
---|
83 | data.Add(Psi_noise);
|
---|
84 |
|
---|
85 | for (int i = 0; i < V_inf.Count; i++) {
|
---|
86 | var th_rad = Math.PI * th[i] / 180.0;
|
---|
87 | double Psi_i = V_inf[i] * r[i] * Math.Sin(th_rad) * (1 - (R[i] * R[i]) / (r[i] * r[i])) +
|
---|
88 | (G[i] / (2 * Math.PI)) * Math.Log(r[i] / R[i]);
|
---|
89 | Psi.Add(Psi_i);
|
---|
90 | }
|
---|
91 |
|
---|
92 | var sigma_noise = 0.05 * Psi.StandardDeviationPop();
|
---|
93 | Psi_noise.AddRange(Psi.Select(md => md + NormalDistributedRandom.NextDouble(rand, 0, sigma_noise)));
|
---|
94 |
|
---|
95 | return data;
|
---|
96 | }
|
---|
97 | }
|
---|
98 | }
|
---|