Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3075_aifeynman_instances/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/Feynman/Feynman13.cs @ 17638

Last change on this file since 17638 was 17638, checked in by chaider, 4 years ago

#3075 Added first part of feynman equations as instances

File size: 1.9 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using HeuristicLab.Common;
7using HeuristicLab.Random;
8
9namespace HeuristicLab.Problems.Instances.DataAnalysis {
10  public class Feynman13 : FeynmanDescriptor{
11 public override string Name { get { return "Feynman I.12.11 F = q*(Ef+B*v*sin(theta))"; } }
12
13 protected override string TargetVariable { get { return "F"; } }
14    protected override string[] VariableNames { get { return new string[] { "q", "Ef", "B", "v", "theta", "F"}; } }
15    protected override string[] AllowedInputVariables { get { return new string[] {"q", "Ef", "B", "v", "theta"}; } }
16
17    public int Seed { get; private set; }
18
19    public Feynman13() : this((int)System.DateTime.Now.Ticks) { }
20
21    public Feynman13(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 q = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
30      var Ef = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
31      var B = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
32      var v = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
33      var theta = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
34
35      var F = new List<double>();
36
37      data.Add(q);
38      data.Add(Ef);
39      data.Add(B);
40      data.Add(v);
41      data.Add(theta);
42      data.Add(F);
43
44      for (var i = 0; i < q.Count; i++) {
45        var res = q[i] * (Ef[i] + B[i] * v[i] * Math.Sin(theta[i]));
46        F.Add(res);
47      }
48
49      return data;
50    }
51  }
52}
Note: See TracBrowser for help on using the repository browser.