#region License Information
/* HeuristicLab
* Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.Collections.Generic;
using HeuristicLab.Data;
namespace HeuristicLab.Problems.DataAnalysis.Benchmarks {
public class KeijzerFunctionSixteen : RegressionToyBenchmark {
public KeijzerFunctionSixteen() {
Name = "Keijzer 16 f(x) = x^3 / 5 + y^3 / 2 - y - x";
Description = "Paper: Improving Symbolic Regression with Interval Arithmetic and Linear Scaling" + Environment.NewLine
+ "Authors: Maarten Keijzer" + Environment.NewLine
+ "Function: f(x, y) = x^3 / 5 + y^3 / 2 - y - x" + Environment.NewLine
+ "range(train): 20 Training cases x,y = rnd(-3, 3)" + Environment.NewLine
+ "range(test): x,y = [-3:0.01:3]" + Environment.NewLine
+ "Function Set: x + y, x * y, 1/x, -x, sqrt(x)" + Environment.NewLine + Environment.NewLine
+ "Note: Test partition has been adjusted to only 100 random uniformly distributed test cases in the intercal [-3, 3] (not ca. 360000 as described) "
+ ", but 5000 cases are created";
targetVariable = "F";
inputVariables = new List() { "X", "Y" };
trainingPartition = new IntRange(0, 20);
testPartition = new IntRange(2500, 5000);
}
protected override List GenerateTarget(List> data) {
double x, y;
List results = new List();
for (int i = 0; i < data[0].Count; i++) {
x = data[0][i];
y = data[1][i];
results.Add(Math.Pow(x, 3) / 5 + Math.Pow(y, 3) / 2 - y - x);
}
return results;
}
protected override List> GenerateInput() {
List> dataList = new List>();
DoubleRange range = new DoubleRange(-3, 3);
for (int i = 0; i < InputVariable.Count; i++) {
dataList.Add(RegressionBenchmark.GenerateUniformDistributedValues(5000, range));
}
return dataList;
}
}
}