Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/TrentMcConaghy/TrentMcConaghyInstanceProvider.cs @ 7666

Last change on this file since 7666 was 7666, checked in by sforsten, 12 years ago

#1784:

  • deleted obsolete project Problems.Instances.Regression.Views
  • added TrentMcConaghy and Various problem instances (zip file from TrentMcConaghy is rather big)
File size: 3.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
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
22using System;
23using System.Collections.Generic;
24using System.IO;
25using System.Linq;
26using ICSharpCode.SharpZipLib.Zip;
27
28namespace HeuristicLab.Problems.Instances.Regression {
29  public class TrentMcConaghyInstanceProvider : ResourceRegressionInstanceProvider {
30    public override string Name {
31      get { return "Trent McConaghy Benchmark Problems"; }
32    }
33    public override string Description {
34      get {
35        return "Paper: Deterministic Symbolic Regression Technology, Genetic Programming Theory and Practice IX" + Environment.NewLine
36          + "High-Dimensional Statistical Modeling and Analysis of Custom Integrated Circuits" + Environment.NewLine
37          + "Authors: T. McConaghy" + Environment.NewLine
38          + "Website: http://trent.st/ffx/";
39      }
40    }
41    public override Uri WebLink {
42      get { return new Uri("http://trent.st/ffx/"); }
43    }
44    public override string ReferencePublication {
45      get { return ""; }
46    }
47
48    protected override string FileExtension { get { return "TrentMcConaghy"; } }
49
50    public override IEnumerable<IDataDescriptor> GetDataDescriptors() {
51      var solutionsArchiveName = GetResourceName(FileExtension + @"\.zip");
52      if (!String.IsNullOrEmpty(solutionsArchiveName)) {
53        using (var solutionsZipFile = new ZipInputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {
54          foreach (var entry in GetZipContents(solutionsZipFile).OrderBy(x => x))
55            yield return new ResourceRegressionDataDescriptor(Path.GetFileNameWithoutExtension(entry), Description, entry);
56        }
57      }
58    }
59
60    public override RegressionData LoadData(IDataDescriptor id) {
61      RegressionData regData = base.LoadData(id);
62
63      regData.TargetVariable = regData.InputVariables.First();
64      regData.AllowedInputVariables = regData.InputVariables.Where(x => !x.Equals(regData.TargetVariable));
65
66      return regData;
67    }
68
69    protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {
70      ZipEntry entry;
71      while ((entry = zipFile.GetNextEntry()) != null) {
72        yield return entry.Name;
73      }
74    }
75  }
76}
Note: See TracBrowser for help on using the repository browser.