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 Feynman7 : FeynmanDescriptor{
|
---|
11 | public override string Name { get { return "Feynman I.11.19 A = x1*y1+x2*y2+x3*y3"; } }
|
---|
12 |
|
---|
13 | protected override string TargetVariable { get { return "A"; } }
|
---|
14 | protected override string[] VariableNames { get { return new string[] { "x1", "x2", "x3", "y1", "y2", "y3", "A"}; } }
|
---|
15 | protected override string[] AllowedInputVariables { get { return new string[] {"x1", "x2", "x3", "y1", "y2", "y3"}; } }
|
---|
16 |
|
---|
17 | public int Seed { get; private set; }
|
---|
18 |
|
---|
19 | public Feynman7() : this((int)System.DateTime.Now.Ticks) { }
|
---|
20 |
|
---|
21 | public Feynman7(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 x1 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
30 | var x2 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
31 | var x3 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
32 | var y1 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
33 | var y2 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
34 | var y3 = ValueGenerator.GenerateUniformDistributedValues(rand.Next(), TestPartitionEnd, 1, 5).ToList();
|
---|
35 |
|
---|
36 | var A = new List<double>();
|
---|
37 |
|
---|
38 | data.Add(x1);
|
---|
39 | data.Add(x2);
|
---|
40 | data.Add(x3);
|
---|
41 | data.Add(y1);
|
---|
42 | data.Add(y2);
|
---|
43 | data.Add(y3);
|
---|
44 | data.Add(A);
|
---|
45 |
|
---|
46 | for (var i = 0; i < x1.Count; i++) {
|
---|
47 | var res = x1[i] * y1[i] + x2[i] * y2[i] + x3[i] * y3[i];
|
---|
48 | A.Add(res);
|
---|
49 | }
|
---|
50 |
|
---|
51 |
|
---|
52 | return data;
|
---|
53 | }
|
---|
54 | }
|
---|
55 | }
|
---|