Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/12 14:29:53 (13 years ago)
Author:
abeham
Message:

#1396:

  • Fixed loading of instances that did not specify coordinates (visual or actual ones)
  • Turned coordinates into an OptionalValueParameter
  • Added checks in relevant operators that throw an exception if they can neither find coordinates or distances
  • Writing a message to the visualization if coordinates are not defined
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TSPPathMoveEvaluator.cs

    r7259 r7621  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    7879        DistanceMatrix distanceMatrix = DistanceMatrixParameter.ActualValue;
    7980        if (distanceMatrix == null) {
     81          if (coordinates == null) throw new InvalidOperationException("Neither a distance matrix nor coordinates were given.");
    8082          distanceMatrix = CalculateDistanceMatrix(coordinates);
    8183          DistanceMatrixParameter.ActualValue = distanceMatrix;
    8284        }
    8385        relativeQualityDifference = EvaluateByDistanceMatrix(permutation, distanceMatrix);
    84       } else relativeQualityDifference = EvaluateByCoordinates(permutation, coordinates);
     86      } else {
     87        if (coordinates == null) throw new InvalidOperationException("No coordinates were given.");
     88        relativeQualityDifference = EvaluateByCoordinates(permutation, coordinates);
     89      }
    8590      DoubleValue moveQuality = MoveQualityParameter.ActualValue;
    8691      if (moveQuality == null) MoveQualityParameter.ActualValue = new DoubleValue(QualityParameter.ActualValue.Value + relativeQualityDifference);
Note: See TracChangeset for help on using the changeset viewer.