Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8922 for trunk


Ignore:
Timestamp:
11/19/12 16:29:34 (12 years ago)
Author:
mkommend
Message:

#1953: Refactored GetDistance method in VRPProblemInstace.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs

    r8652 r8922  
    183183
    184184    public virtual double GetDistance(int start, int end, IVRPEncoding solution) {
    185       double distance = 0.0;
    186185      if (distanceMatrix == null && UseDistanceMatrix.Value) {
    187         if (DistanceMatrix != null)
    188           distanceMatrix = DistanceMatrix;
    189         else
    190           distanceMatrix = DistanceMatrix = CreateDistanceMatrix();
    191       }
    192 
    193       if (distanceMatrix != null)
    194         distance = distanceMatrix[start, end];
    195       else
    196         distance = CalculateDistance(start, end);
    197 
    198       return distance;
     186        if (DistanceMatrix == null) DistanceMatrix = CreateDistanceMatrix();
     187        distanceMatrix = DistanceMatrix;
     188      }
     189
     190      if (distanceMatrix != null) return distanceMatrix[start, end];
     191      return CalculateDistance(start, end);
    199192    }
    200193
Note: See TracChangeset for help on using the changeset viewer.