Free cookie consent management tool by TermsFeed Policy Generator

source: branches/QAPGenerators/HeuristicLab.Problems.Instances.QAPGenerator/3.3/Descriptors/TaibQAPInstanceGeneratorDescriptor.cs @ 14704

Last change on this file since 14704 was 14704, checked in by abeham, 7 years ago

#2738: added branch

File size: 3.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 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
22namespace HeuristicLab.Problems.Instances.QAPGenerator {
23  public sealed class TaibQAPInstanceGeneratorDescriptor : QAPInstanceGeneratorDescriptor {
24
25    private int maxClusterDistance;
26    public int MaxClusterDistance {
27      get { return maxClusterDistance; }
28      set {
29        if (maxClusterDistance == value) return;
30        maxClusterDistance = value;
31        OnPropertyChanged("MaxClusterDistance");
32      }
33    }
34
35    private int maxClusterSize;
36    public int MaxClusterSize {
37      get { return maxClusterSize; }
38      set {
39        if (maxClusterSize == value) return;
40        maxClusterSize = value;
41        OnPropertyChanged("MaxClusterSize");
42      }
43    }
44
45    private int maxClusterRadius;
46    public int MaxClusterRadius {
47      get { return maxClusterRadius; }
48      set {
49        if (maxClusterRadius == value) return;
50        maxClusterRadius = value;
51        OnPropertyChanged("MaxClusterRadius");
52      }
53    }
54
55    private int minFlowExponent;
56    public int MinFlowExponent {
57      get { return minFlowExponent; }
58      set {
59        if (minFlowExponent == value) return;
60        minFlowExponent = value;
61        OnPropertyChanged("MinFlowExponent");
62      }
63    }
64
65    private int maxFlowExponent;
66    public int MaxFlowExponent {
67      get { return maxFlowExponent; }
68      set {
69        if (maxFlowExponent == value) return;
70        maxFlowExponent = value;
71        OnPropertyChanged("MaxFlowExponent");
72      }
73    }
74
75    public override string Name {
76      get { return "Tai-b Instances"; }
77    }
78
79    public override string Description {
80      get { return "Generates randomly clustered symmetric QAP instances with more real-world like flows."; }
81    }
82
83    public override bool IsConfigurationValid {
84      get {
85        return base.IsConfigurationValid
86          && MaxClusterDistance > 0
87          && MaxClusterRadius > 0
88          && MaxClusterSize > 0
89          && MinFlowExponent < MaxFlowExponent
90          && MaxFlowExponent > 0;
91      }
92    }
93
94    public TaibQAPInstanceGeneratorDescriptor() {
95      // default ctor should result in a valid configuration
96      N = 20;
97      Seed = 123456789;
98      MaxClusterDistance = 1000;
99      MaxClusterRadius = 20;
100      MaxClusterSize = 10;
101      MinFlowExponent = -5;
102      MaxFlowExponent = 3;
103    }
104
105    public override QAPData GetInstance() {
106      double[,] A, B;
107      TaillardQAPInstanceGenerator.GenerateTaib(N, maxClusterDistance, maxClusterSize, maxClusterRadius, minFlowExponent, maxFlowExponent, out A, out B, new Bratley(Seed));
108      return new QAPData {
109        Name = "tai" + N.ToString("00") + "b (" + maxClusterDistance + ", " + maxClusterSize + ", " + maxClusterRadius + ") [" + minFlowExponent + ";" + maxFlowExponent + "]",
110        Description = "Instance generated with TaillardQAPInstanceGenerator.GenerateTaib",
111        Dimension = N,
112        Weights = B,
113        Distances = A
114      };
115    }
116  }
117}
Note: See TracBrowser for help on using the repository browser.