Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/06/12 01:43:06 (12 years ago)
Author:
abeham
Message:

#1782: trunk integration of problem instance development

  • Adapted TSP and QAP to use the new feature
  • Moved the TSPLIB importer dialog from the TSP plugin to the TSPLIB instances plugin (created a view for that provider)
  • Created it as a default view for IHeuristicOptimizationProblem in order not to interfere with other problems do not yet work with this
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/Evaluators/TSPCoordinatesPathEvaluator.cs

    r7259 r7558  
    7373    }
    7474
     75    public static double Apply(TSPCoordinatesPathEvaluator evaluator, DoubleMatrix coordinates, Permutation tour) {
     76      DoubleMatrix c = coordinates;
     77      Permutation p = tour;
     78      double length = 0;
     79      for (int i = 0; i < p.Length - 1; i++)
     80        length += evaluator.CalculateDistance(c[p[i], 0], c[p[i], 1], c[p[i + 1], 0], c[p[i + 1], 1]);
     81      length += evaluator.CalculateDistance(c[p[p.Length - 1], 0], c[p[p.Length - 1], 1], c[p[0], 0], c[p[0], 1]);
     82      return length;
     83    }
     84
    7585    public sealed override IOperation Apply() {
    7686      if (UseDistanceMatrixParameter.ActualValue.Value) {
Note: See TracChangeset for help on using the changeset viewer.