Changeset 12261 for branches/PTSP/HeuristicLab.Problems.PTSP/3.3/PTSP.cs
- Timestamp:
- 03/26/15 16:14:52 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PTSP/HeuristicLab.Problems.PTSP/3.3/PTSP.cs
r12228 r12261 34 34 using HeuristicLab.Parameters; 35 35 using HeuristicLab.Data; 36 using HeuristicLab.Random; 36 37 37 38 namespace HeuristicLab.Problems.PTSP { … … 133 134 Description = data.Description; 134 135 136 // Get Probabilities of cities using random with seed from hash function on the Name of the instance 137 double[] tempMatrix = new double[data.Dimension]; 138 MersenneTwister r = new MersenneTwister((uint)data.Name.GetHashCode()); 139 for (int i = 0; i < data.Dimension; i++) { 140 tempMatrix[i] = r.NextDouble(); 141 } 142 ProbabilityMatrix = new DoubleArray(tempMatrix); 143 144 if (data.BestKnownTour != null) { 145 BestKnownSolution = new Permutation(PermutationTypes.RelativeUndirected, data.BestKnownTour); 146 } 147 135 148 bool clearCoordinates = false, clearDistanceMatrix = false; 136 149 if (data.Coordinates != null && data.Coordinates.GetLength(0) > 0) … … 143 156 144 157 DistanceMatrix = new DistanceMatrix(data.GetDistanceMatrix()); 145 // Get Probabilities of cities using random with seed from hash function on the Name of the instance 146 ProbabilityMatrix = new DoubleArray(data.Dimension); 147 Random r = new Random(data.Name.GetHashCode()); 148 for (int i = 0; i < data.Dimension; i++) { 149 ProbabilityMatrix[i] = r.NextDouble(); 150 } 158 151 159 Encoding.Length = data.Dimension; 152 160
Note: See TracChangeset
for help on using the changeset viewer.