Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PTSP/HeuristicLab.Problems.PTSP/3.3/DistanceMatrix.cs @ 12329

Last change on this file since 12329 was 12191, checked in by apolidur, 10 years ago

#2221: Splitting PTSP into Analytical and Estimated

File size: 1.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using HeuristicLab.Common;
4using HeuristicLab.Core;
5using HeuristicLab.Data;
6using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7
8namespace HeuristicLab.Problems.PTSP {
9  /// <summary>
10  /// Represents a distance matrix of a Traveling Salesman Problem.
11  /// </summary>
12  [Item("DistanceMatrix", "Represents a distance matrix of a Traveling Salesman Problem.")]
13  [StorableClass]
14  public sealed class DistanceMatrix : DoubleMatrix {
15    [StorableConstructor]
16    private DistanceMatrix(bool deserializing) : base(deserializing) { }
17    private DistanceMatrix(DistanceMatrix original, Cloner cloner) {
18      throw new NotSupportedException("Distance matrices cannot be cloned.");
19    }
20    public DistanceMatrix() : base() { }
21    public DistanceMatrix(int rows, int columns) : base(rows, columns) { }
22    public DistanceMatrix(int rows, int columns, IEnumerable<string> columnNames) : base(rows, columns, columnNames) { }
23    public DistanceMatrix(int rows, int columns, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(rows, columns, columnNames, rowNames) { }
24    public DistanceMatrix(double[,] elements) : base(elements) { }
25    public DistanceMatrix(double[,] elements, IEnumerable<string> columnNames) : base(elements, columnNames) { }
26    public DistanceMatrix(double[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(elements, columnNames, rowNames) { }
27
28    public override IDeepCloneable Clone(Cloner cloner) {
29      // distance matrices are not cloned for performance reasons
30      cloner.RegisterClonedObject(this, this);
31      return this;
32    }
33  }
34}
Note: See TracBrowser for help on using the repository browser.