[7849] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[11171] | 3 | * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[7849] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Linq;
|
---|
| 25 |
|
---|
| 26 | namespace HeuristicLab.Problems.Instances.DataAnalysis {
|
---|
| 27 | public class PolyTen : ArtificialRegressionDataDescriptor {
|
---|
| 28 |
|
---|
| 29 | public override string Name { get { return "Poly-10 y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10"; } }
|
---|
| 30 | public override string Description {
|
---|
| 31 | get {
|
---|
| 32 | return "Paper: A Simple but Theoretically-motivated Method to Control Bloat in Genetic Programming" + Environment.NewLine
|
---|
| 33 | + "Authors: Riccardo Poli" + Environment.NewLine
|
---|
| 34 | + "Function: y = X1*X2 + X3*X4 + X5*X6 + X1*X7*X9 + X3*X6*X10" + Environment.NewLine
|
---|
| 35 | + "Terminal set: x1, x2, x3, x4, x5, x6, x7, x8, x9, x10" + Environment.NewLine
|
---|
| 36 | + "Fitness was minus the sum of the absolute values of the errors made over 50 fitness cases. "
|
---|
| 37 | + "These were generated by randomly assigning values to the variables xiin the range [1, 1].";
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 | protected override string TargetVariable { get { return "Y"; } }
|
---|
[8825] | 41 | protected override string[] VariableNames { get { return new string[] { "X1", "X2", "X3", "X4", "X5", "X6", "X7", "X8", "X9", "X10", "Y" }; } }
|
---|
[7849] | 42 | protected override string[] AllowedInputVariables { get { return new string[] { "X1", "X2", "X3", "X4", "X5", "X6", "X7", "X8", "X9", "X10" }; } }
|
---|
| 43 | protected override int TrainingPartitionStart { get { return 0; } }
|
---|
| 44 | protected override int TrainingPartitionEnd { get { return 250; } }
|
---|
| 45 | protected override int TestPartitionStart { get { return 250; } }
|
---|
| 46 | protected override int TestPartitionEnd { get { return 500; } }
|
---|
| 47 |
|
---|
| 48 | protected override List<List<double>> GenerateValues() {
|
---|
| 49 | List<List<double>> data = new List<List<double>>();
|
---|
| 50 | for (int i = 0; i < AllowedInputVariables.Count(); i++) {
|
---|
| 51 | data.Add(ValueGenerator.GenerateUniformDistributedValues(TestPartitionEnd, -1, 1).ToList());
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | double x1, x2, x3, x4, x5, x6, x7, x8, x9, x10;
|
---|
| 55 | List<double> results = new List<double>();
|
---|
| 56 | for (int i = 0; i < data[0].Count; i++) {
|
---|
| 57 | x1 = data[0][i];
|
---|
| 58 | x2 = data[1][i];
|
---|
| 59 | x3 = data[2][i];
|
---|
| 60 | x4 = data[3][i];
|
---|
| 61 | x5 = data[4][i];
|
---|
| 62 | x6 = data[5][i];
|
---|
| 63 | x7 = data[6][i];
|
---|
| 64 | x8 = data[7][i];
|
---|
| 65 | x9 = data[8][i];
|
---|
| 66 | x10 = data[9][i];
|
---|
| 67 | results.Add(x1 * x2 + x3 * x4 + x5 * x6 + x1 * x7 * x9 + x3 * x6 * x10);
|
---|
| 68 | }
|
---|
| 69 | data.Add(results);
|
---|
| 70 |
|
---|
| 71 | return data;
|
---|
| 72 | }
|
---|
| 73 | }
|
---|
| 74 | }
|
---|