Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3040_VectorBasedGP/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/GPTP2021VectorBenchmarks/GPTP2021VectorBenchmarksInstanceProvider.cs @ 17915

Last change on this file since 17915 was 17915, checked in by pfleck, 18 months ago

#3040 started added some vector benchmarks for gptp.

File size: 4.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 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.Compression;
25using System.Linq;
26using System.Runtime.Remoting.Messaging;
27
28namespace HeuristicLab.Problems.Instances.DataAnalysis {
29  public class GPTP2021VectorBenchmarksInstanceProvider : ResourceRegressionInstanceProvider {
30    public override string Name {
31      get { return "GPTP 2021 Vector Benchmark Problems"; }
32    }
33    public override string Description {
34      get {
35        return "";
36      }
37    }
38    public override Uri WebLink {
39      get { return null; }
40    }
41    public override string ReferencePublication {
42      get { return ""; }
43    }
44
45    protected override string FileName { get { return "GPTP2021VectorBenchmarks"; } }
46
47    public override IEnumerable<IDataDescriptor> GetDataDescriptors() {
48      return new List<ResourceRegressionDataDescriptor> {
49        new GPTP2021VectorBenchmarkDataDescriptor("test_A_01", new []{ "v1" }),
50        new GPTP2021VectorBenchmarkDataDescriptor("test_A_02", new []{ "v1" }),
51        new GPTP2021VectorBenchmarkDataDescriptor("test_A_03", new []{ "x1", "v1" }),
52        new GPTP2021VectorBenchmarkDataDescriptor("test_A_04", new []{ "x1", "x2", "v1", "v2" }),
53        new GPTP2021VectorBenchmarkDataDescriptor("test_A_05", new []{ "x1", "x2", "v1", "v2" }),
54        new GPTP2021VectorBenchmarkDataDescriptor("test_B_01", new []{ "x1", "x2", "v1", "v2" }),
55        new GPTP2021VectorBenchmarkDataDescriptor("test_B_02", new []{ "x1", "x2", "v1", "v2" }),
56        new GPTP2021VectorBenchmarkDataDescriptor("test_B_03", new []{ "x1", "x2", "v1", "v2", "v3" }),
57        new GPTP2021VectorBenchmarkDataDescriptor("test_B_04", new []{ "x1", "x2", "v1", "v2", "v3", "v4" }),
58
59        new GPTP2021VectorBenchmarkDataDescriptor("unrolled_test_A_01", Flatten(V("v1"))),
60        new GPTP2021VectorBenchmarkDataDescriptor("unrolled_test_A_02", Flatten(V("v1"))),
61        new GPTP2021VectorBenchmarkDataDescriptor("unrolled_test_A_03", Flatten(S("x1"), V("v1"))),
62        new GPTP2021VectorBenchmarkDataDescriptor("unrolled_test_A_04", Flatten(S("x1"), S("x2"), V("v1"), V("v2"))),
63        new GPTP2021VectorBenchmarkDataDescriptor("unrolled_test_A_05", Flatten(S("x1"), S("x2"), V("v1"), V("v2"))),
64        new GPTP2021VectorBenchmarkDataDescriptor("unrolled_test_B_01", Flatten(S("x1"), S("x2"), V("v1"), V("v2"))),
65        new GPTP2021VectorBenchmarkDataDescriptor("unrolled_test_B_02", Flatten(S("x1"), S("x2"), V("v1"), V("v2"))),
66        new GPTP2021VectorBenchmarkDataDescriptor("unrolled_test_B_03", Flatten(S("x1"), S("x2"), V("v1"), V("v2"), V("v3"))),
67        new GPTP2021VectorBenchmarkDataDescriptor("unrolled_test_B_04", Flatten(S("x1"), S("x2"), V("v1"), V("v2"), V("v3"), V("v4")))
68      };
69    }
70
71    private static IEnumerable<string> S(string name) {
72      yield return name;
73    }
74    // Unroll vector variable name
75    private static IEnumerable<string> V(string name, int length = 20) {
76      return Enumerable.Range(0, length).Select(i => name + "_" + i);
77    }
78    private static T[] Flatten<T>(params IEnumerable<T>[] values) {
79      return values.SelectMany(x => x).ToArray();
80    }
81
82    protected override TableFileFormatOptions GetFormatOptions(ZipArchiveEntry entry) {
83      return new TableFileFormatOptions() {
84        ColumnSeparator = ';',
85        VectorSeparator = ','
86      };
87    }
88  }
89}
Note: See TracBrowser for help on using the repository browser.