Free cookie consent management tool by TermsFeed Policy Generator

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

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

#3075 Added equations of part II

File size: 1.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using HeuristicLab.Random;
5
6namespace HeuristicLab.Problems.Instances.DataAnalysis {
7  public class Feynman57 : FeynmanDescriptor {
8    public override string Name { get { return "Feynman II.6.15b p_d/(4*pi*epsilon)*3*cos(theta)*sin(theta)/r**3"; } }
9
10    protected override string TargetVariable { get { return "Ef"; } }
11    protected override string[] VariableNames { get { return new[] {"epsilon", "p_d", "theta", "r", "Ef"}; } }
12    protected override string[] AllowedInputVariables { get { return new[] {"epsilon", "p_d", "theta", "r"}; } }
13
14    public int Seed { get; private set; }
15
16    public Feynman57() : this((int) DateTime.Now.Ticks) { }
17
18    public Feynman57(int seed) {
19      Seed = seed;
20    }
21
22    protected override List<List<double>> GenerateValues() {
23      var rand = new MersenneTwister((uint) Seed);
24
25      var data    = new List<List<double>>();
26      var epsilon = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 3).ToList();
27      var p_d     = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 3).ToList();
28      var theta   = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 3).ToList();
29      var r       = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 3).ToList();
30
31      var Ef = new List<double>();
32
33      data.Add(epsilon);
34      data.Add(p_d);
35      data.Add(theta);
36      data.Add(r);
37      data.Add(Ef);
38
39      for (var i = 0; i < epsilon.Count; i++) {
40        var res = p_d[i] / (4 * Math.PI * epsilon[i]) * 3 * Math.Cos(theta[i]) * Math.Sin(theta[i]) / Math.Pow(r[i], 3);
41        Ef.Add(res);
42      }
43
44      return data;
45    }
46  }
47}
Note: See TracBrowser for help on using the repository browser.