Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/10/17 23:19:11 (7 years ago)
Author:
abeham
Message:

#2457: worked on code for eurocast paper

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Problems.Instances.QAPLIB/3.3/OneSizeInstanceProvider.cs

    r14691 r15031  
    22using System.Collections.Generic;
    33using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
     4using System.Text.RegularExpressions;
    65
    76namespace HeuristicLab.Problems.Instances.QAPLIB {
     
    98    public override IEnumerable<IDataDescriptor> GetDataDescriptors() {
    109      var drezner = new DreznerQAPInstanceProvider();
    11       foreach (var desc in drezner.GetDataDescriptors())
    12         yield return new OneSizeDataDescriptor(desc.Name + "-25", desc.Description, drezner, desc);
     10      foreach (var desc in drezner.GetDataDescriptors()) {
     11        var dim = int.Parse(Regex.Match(desc.Name, "dre(?<g>\\d+)").Groups["g"].Value);
     12        if (dim < 25) continue;
     13        yield return new OneSizeDataDescriptor(desc.Name + (dim == 25 ? "" : "-25"), desc.Description, drezner, desc);
     14      }
     15      // Microarray instances are all greater than 25 dimensions
    1316      var microarray = new MicroarrayQAPInstanceProvider();
    14       foreach (var desc in microarray.GetDataDescriptors())
     17      foreach (var desc in microarray.GetDataDescriptors()) {
    1518        yield return new OneSizeDataDescriptor(desc.Name + "-25", desc.Description, microarray, desc);
     19      }
    1620      var qaplib = new QAPLIBInstanceProvider();
    17       foreach (var desc in qaplib.GetDataDescriptors())
    18         yield return new OneSizeDataDescriptor(desc.Name + "-25", desc.Description, qaplib, desc);
     21      foreach (var desc in qaplib.GetDataDescriptors()) {
     22        var instance = qaplib.LoadData(desc);
     23        if (instance.Dimension < 25) continue;
     24        yield return new OneSizeDataDescriptor(desc.Name + (instance.Dimension == 25 ? "" : "-25"), desc.Description, qaplib, desc);
     25      }
     26      // Taillard's instances are basically from the same distribution
     27      // to avoid over-representation in the set only the tai27e are taken and reduced to 25 dimension
    1928      var taillard = new TaillardQAPInstanceProvider();
    20       foreach (var desc in taillard.GetDataDescriptors())
     29      foreach (var desc in taillard.GetDataDescriptors()) {
     30        if (!desc.Name.StartsWith("tai27e")) continue;
    2131        yield return new OneSizeDataDescriptor(desc.Name + "-25", desc.Description, taillard, desc);
     32      }
    2233    }
    2334
     
    5970      data.Dimension = 25;
    6071      data.Name += "-25";
    61       data.Description += " (reduced or enlarged to 25 dimensions)";
     72      data.Description += " (reduced to 25 dimensions)";
    6273
    6374      return data;
     
    6879    public override Uri WebLink { get { return null; } }
    6980    public override string ReferencePublication { get { return string.Empty; } }
    70 
    71     // permutation must be strictly different in every position
     81   
    7282    private static void Shuffle(int[] p, Random random) {
    7383      for (var i = p.Length - 1; i > 0; i--) {
    74         // Swap element "i" with a random earlier element (excluding itself)
    7584        var swapIndex = random.Next(i + 1);
    7685        var h = p[swapIndex];
Note: See TracChangeset for help on using the changeset viewer.