1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 | using HeuristicLab.Common;
|
---|
7 | using HeuristicLab.Random;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.Problems.Instances.DataAnalysis {
|
---|
10 | public class Feynman18 : FeynmanDescriptor{
|
---|
11 | public override string Name { get { return "Feynman I.15.3t t1 = (t-u*x/c^2)/sqrt(1-u^2/c^2)"; } }
|
---|
12 |
|
---|
13 | protected override string TargetVariable { get { return "t1"; } }
|
---|
14 | protected override string[] VariableNames { get { return new string[] { "x", "c", "u", "t", "t1"}; } }
|
---|
15 | protected override string[] AllowedInputVariables { get { return new string[] {"x", "c", "u", "t"}; } }
|
---|
16 |
|
---|
17 | public int Seed { get; private set; }
|
---|
18 |
|
---|
19 | public Feynman18() : this((int)System.DateTime.Now.Ticks) { }
|
---|
20 |
|
---|
21 | public Feynman18(int seed) {
|
---|
22 | Seed = seed;
|
---|
23 | }
|
---|
24 |
|
---|
25 | protected override List<List<double>> GenerateValues() {
|
---|
26 | var rand = new MersenneTwister((uint)Seed);
|
---|
27 |
|
---|
28 | var data = new List<List<double>>();
|
---|
29 | var x = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
30 | var c = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 3, 10).ToList();
|
---|
31 | var u = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 2).ToList();
|
---|
32 | var t = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
33 |
|
---|
34 | var t1 = new List<double>();
|
---|
35 |
|
---|
36 | data.Add(x);
|
---|
37 | data.Add(c);
|
---|
38 | data.Add(u);
|
---|
39 | data.Add(t);
|
---|
40 | data.Add(t1);
|
---|
41 |
|
---|
42 | for (var i = 0; i < x.Count; i++) {
|
---|
43 | var res = (t[i] - u[i] * x[i] / Math.Pow(c[i], 2)) / Math.Sqrt(1 - Math.Pow(u[i], 2) / Math.Pow(c[i], 2));
|
---|
44 | t1.Add(res);
|
---|
45 | }
|
---|
46 |
|
---|
47 | return data;
|
---|
48 | }
|
---|
49 | }
|
---|
50 | }
|
---|