[16264] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[16565] | 3 | * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[16264] | 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.Random;
|
---|
| 26 |
|
---|
| 27 | namespace HeuristicLab.Problems.Instances.DataAnalysis {
|
---|
[16431] | 28 | public class FluidDynamics : ArtificialRegressionDataDescriptor {
|
---|
[16394] | 29 | public override string Name { get { return "Flow Psi = V_inf r sin(th) (1 - R²/r²) + G/(2 π) ln(r/R)"; } }
|
---|
[16264] | 30 |
|
---|
| 31 | public override string Description {
|
---|
| 32 | get {
|
---|
[16394] | 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: Psi = V_inf r sin(th) (1 - R²/r²) + G/(2 π) ln(r/R)" + Environment.NewLine +
|
---|
| 38 | "with V_inf ∈ [60 m/s, 65 m/s]," + Environment.NewLine +
|
---|
| 39 | "th ∈ [30°, 40°]," + Environment.NewLine +
|
---|
| 40 | "r ∈ [0.2m, 0.5m]," + Environment.NewLine +
|
---|
| 41 | "R ∈ [0.5m, 0.8m]," + Environment.NewLine +
|
---|
| 42 | "G ∈ [5 m²/s, 10 m²/s]";
|
---|
[16264] | 43 | }
|
---|
| 44 | }
|
---|
| 45 |
|
---|
[16394] | 46 | protected override string TargetVariable { get { return "Psi"; } }
|
---|
| 47 | protected override string[] VariableNames { get { return new string[] { "V_inf", "th", "r", "R", "G", "Psi" }; } }
|
---|
| 48 | protected override string[] AllowedInputVariables { get { return new string[] { "V_inf", "th", "r", "R", "G" }; } }
|
---|
[16264] | 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 FluidDynamics() : this((int)System.DateTime.Now.Ticks) { }
|
---|
| 57 |
|
---|
| 58 | public FluidDynamics(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>>();
|
---|
[16394] | 66 | var V_inf = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 60.0, 65.0).ToList();
|
---|
| 67 | var th = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 30.0, 40.0).ToList();
|
---|
| 68 | var r = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.2, 0.5).ToList();
|
---|
| 69 | var R = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 0.5, 0.8).ToList();
|
---|
| 70 | var G = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 5, 10).ToList();
|
---|
[16264] | 71 |
|
---|
[16394] | 72 | List<double> Psi = new List<double>();
|
---|
| 73 | data.Add(V_inf);
|
---|
| 74 | data.Add(th);
|
---|
| 75 | data.Add(r);
|
---|
| 76 | data.Add(R);
|
---|
| 77 | data.Add(G);
|
---|
| 78 | data.Add(Psi);
|
---|
[16264] | 79 |
|
---|
[16394] | 80 | for (int i = 0; i < V_inf.Count; i++) {
|
---|
| 81 | var th_rad = Math.PI * th[i] / 180.0;
|
---|
| 82 | double Psi_i = V_inf[i] * r[i] * Math.Sin(th_rad) * (1 - (R[i] * R[i]) / (r[i] * r[i])) +
|
---|
| 83 | (G[i] / (2 * Math.PI)) * Math.Log(r[i] / R[i]);
|
---|
| 84 | Psi.Add(Psi_i);
|
---|
[16264] | 85 | }
|
---|
| 86 |
|
---|
| 87 | return data;
|
---|
| 88 | }
|
---|
| 89 | }
|
---|
| 90 | }
|
---|