Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/26/15 16:14:52 (9 years ago)
Author:
apolidur
Message:

#2221: Fixing MoveEvaluators after running unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PTSP/HeuristicLab.Problems.PTSP/3.3/PTSP.cs

    r12228 r12261  
    3434using HeuristicLab.Parameters;
    3535using HeuristicLab.Data;
     36using HeuristicLab.Random;
    3637
    3738namespace HeuristicLab.Problems.PTSP {
     
    133134      Description = data.Description;
    134135
     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     
    135148      bool clearCoordinates = false, clearDistanceMatrix = false;
    136149      if (data.Coordinates != null && data.Coordinates.GetLength(0) > 0)
     
    143156
    144157      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     
    151159      Encoding.Length = data.Dimension;
    152160
Note: See TracChangeset for help on using the changeset viewer.