Line | |
---|
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 Feynman1 : FeynmanDescriptor{
|
---|
11 | public override string Name { get { return "Feynman I.6.2a f = exp(-theta^2/2)/sqrt(2*pi)"; } }
|
---|
12 |
|
---|
13 | protected override string TargetVariable { get { return "f"; } }
|
---|
14 | protected override string[] VariableNames { get { return new string[] { "theta", "f" }; } }
|
---|
15 | protected override string[] AllowedInputVariables { get { return new string[] { "theta" }; } }
|
---|
16 |
|
---|
17 | public int Seed { get; private set; }
|
---|
18 |
|
---|
19 | public Feynman1() : this((int)System.DateTime.Now.Ticks) { }
|
---|
20 |
|
---|
21 | public Feynman1(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 theta = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 3).ToList();
|
---|
30 |
|
---|
31 | var f = new List<double>();
|
---|
32 |
|
---|
33 | data.Add(theta);
|
---|
34 | data.Add(f);
|
---|
35 |
|
---|
36 |
|
---|
37 | for (var i = 0; i < theta.Count; i++) {
|
---|
38 | var res = Math.Exp(Math.Pow(-theta[i], 2) / 2) / Math.Sqrt(2 * Math.PI);
|
---|
39 | f.Add(res);
|
---|
40 | }
|
---|
41 |
|
---|
42 |
|
---|
43 | return data;
|
---|
44 | }
|
---|
45 | }
|
---|
46 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.