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 Feynman23 : FeynmanDescriptor{
|
---|
11 | public override string Name { get { return "Feynman I.18.14 L = m*r*v*sin(theta)"; } }
|
---|
12 |
|
---|
13 | protected override string TargetVariable { get { return "L"; } }
|
---|
14 | protected override string[] VariableNames { get { return new string[] { "m", "r", "v", "theta", "L"}; } }
|
---|
15 | protected override string[] AllowedInputVariables { get { return new string[] {"m", "r", "v", "theta"}; } }
|
---|
16 |
|
---|
17 | public int Seed { get; private set; }
|
---|
18 |
|
---|
19 | public Feynman23() : this((int)System.DateTime.Now.Ticks) { }
|
---|
20 |
|
---|
21 | public Feynman23(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 m = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
30 | var r = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
31 | var v = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
32 | var theta = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
33 |
|
---|
34 | var L = new List<double>();
|
---|
35 |
|
---|
36 | data.Add(m);
|
---|
37 | data.Add(r);
|
---|
38 | data.Add(v);
|
---|
39 | data.Add(L);
|
---|
40 |
|
---|
41 | for (var i = 0; i < r.Count; i++) {
|
---|
42 | var res = m[i] * r[i] * v[i] * Math.Sin(theta[i]);
|
---|
43 | L.Add(res);
|
---|
44 | }
|
---|
45 |
|
---|
46 | return data;
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|