Free cookie consent management tool by TermsFeed Policy Generator

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

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

#3075

  • Added rest of part I equations
  • Set Training/Test Partitions to 105
File size: 1.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using HeuristicLab.Random;
5
6namespace HeuristicLab.Problems.Instances.DataAnalysis {
7  public class Feynman30 : FeynmanDescriptor {
8    public override string Name { get { return "Feynman I.30.3 Int_0*sin(n*theta/2)**2/sin(theta/2)**2"; } }
9
10    protected override string TargetVariable { get { return "Int"; } }
11    protected override string[] VariableNames { get { return new[] {"Int_0", "theta", "n", "Int"}; } }
12    protected override string[] AllowedInputVariables { get { return new[] {"Int_0", "theta", "n"}; } }
13
14    public int Seed { get; private set; }
15
16    public Feynman30() : this((int) DateTime.Now.Ticks) { }
17
18    public Feynman30(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 Int_0 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
27      var theta = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
28      var n     = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
29
30      var Int = new List<double>();
31
32      data.Add(Int_0);
33      data.Add(theta);
34      data.Add(n);
35      data.Add(Int);
36
37      for (var i = 0; i < Int_0.Count; i++) {
38        var res = Int_0[i] * Math.Pow(Math.Sin(n[i] * theta[i] / 2), 2) / Math.Pow(Math.Sin(theta[i] / 2), 2);
39        Int.Add(res);
40      }
41
42      return data;
43    }
44  }
45}
Note: See TracBrowser for help on using the repository browser.