source: branches/2520_PersistenceReintegration/HeuristicLab.Problems.Instances/3.3/Types/TSPData.cs @ 16453

Last change on this file since 16453 was 16453, checked in by jkarder, 2 years ago

#2520: updated year of copyrights

File size: 3.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2019 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;
23
24namespace HeuristicLab.Problems.Instances {
25  /// <summary>
26  /// Describes instances of the Traveling Salesman Problem (TSP).
27  /// </summary>
28  public class TSPData {
29    /// <summary>
30    /// The name of the instance
31    /// </summary>
32    public string Name { get; set; }
33    /// <summary>
34    /// Optional! The description of the instance
35    /// </summary>
36    public string Description { get; set; }
37
38    /// <summary>
39    /// The number of cities.
40    /// </summary>
41    public int Dimension { get; set; }
42    /// <summary>
43    /// Specifies the distance measure that is to be used.
44    /// </summary>
45    public DistanceMeasure DistanceMeasure { get; set; }
46    /// <summary>
47    /// Optional! The distances are given in form of a distance matrix.
48    /// </summary>
49    /// <remarks>
50    /// Either this property or <see cref="Coordinates"/> needs to be specified.
51    /// </remarks>
52    public double[,] Distances { get; set; }
53    /// <summary>
54    /// Optional! A a matrix of dimension [N, 2] matrix where each row is one of the cities
55    /// and the colmns represent x and y coordinates respectively.
56    /// </summary>
57    /// <remarks>
58    /// Either this property or <see cref="Distances"/> needs to be specified.
59    ///
60    /// If no distance matrix is given, the distances have to be calculated by the
61    /// specified distance measure. If a distance matrix is given in addtion to the
62    /// coordinates, the distance matrix takes precedence and the coordinates are
63    /// for display only.
64    /// </remarks>
65    public double[,] Coordinates { get; set; }
66
67    /// <summary>
68    /// Optional! The best-known tour in path-encoding.
69    /// </summary>
70    public int[] BestKnownTour { get; set; }
71    /// <summary>
72    /// Optional! The quality of the best-known tour.
73    /// </summary>
74    public double? BestKnownQuality { get; set; }
75
76    /// <summary>
77    /// If only the coordinates are given, can calculate the distance matrix.
78    /// </summary>
79    /// <returns>A full distance matrix between all cities.</returns>
80    public double[,] GetDistanceMatrix() {
81      return DistanceHelper.GetDistanceMatrix(DistanceMeasure, Coordinates, Distances, Dimension);
82    }
83  }
84}
Note: See TracBrowser for help on using the repository browser.