#region License Information
/* HeuristicLab
* Copyright (C) 2002-2011 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 NguyenFunctionTwo : RegressionToyBenchmark {
public NguyenFunctionTwo() {
Name = "Nguyen F2 = x^4 + x^3 + x^2 + x";
Description = "Paper: Semantically-based Crossover in Genetic Programming: Application to Real-valued Symbolic Regression" + Environment.NewLine
+ "Authors: Nguyen Quang Uy · Nguyen Xuan Hoai · Michael O’Neill · R.I. McKay · Edgar Galvan-Lopez" + Environment.NewLine
+ "Function: F2 = x^4 + x^3 + x^2 + x" + Environment.NewLine
+ "Fitcases: 20 random points ⊆ [-1, 1]" + Environment.NewLine
+ "Non-terminals: +, -, *, /, sin, cos, exp, log (protected version)" + Environment.NewLine
+ "Terminals: X, 1 for single variable problems, and X, Y for bivariable problems";
targetVariable = "Y";
inputVariables = new List() { "X" };
trainingPartition = new IntRange(0, 20);
testPartition = new IntRange(250, 350);
}
protected override List GenerateTarget(List> data) {
double x;
List results = new List();
for (int i = 0; i < data[0].Count; i++) {
x = data[0][i];
results.Add(Math.Pow(x, 4) + Math.Pow(x, 3) + Math.Pow(x, 2) + x);
}
return results;
}
protected override List> GenerateInput() {
List> dataList = new List>();
DoubleRange range = new DoubleRange(-1, 1);
dataList.Add(RegressionBenchmark.GenerateUniformDistributedValues(500, range));
return dataList;
}
}
}