1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using HeuristicLab.Common;
|
---|
4 | using HeuristicLab.Core;
|
---|
5 | using HeuristicLab.Data;
|
---|
6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
7 |
|
---|
8 | namespace 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 | }
|
---|