Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/17/15 09:28:57 (8 years ago)
Author:
abeham
Message:

#2221: reverse engineered PTSPData and added simple instance provider based on TSPLIB

File:
1 edited

Legend:

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

    r12387 r13202  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Text;
    26 using System.Threading.Tasks;
     22using HeuristicLab.Common;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.PermutationEncoding;
    2726using HeuristicLab.Optimization;
    28 using HeuristicLab.PluginInfrastructure;
    29 using HeuristicLab.Core;
     27using HeuristicLab.Parameters;
    3028using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3129using HeuristicLab.Problems.Instances;
    32 using HeuristicLab.Encodings.PermutationEncoding;
    33 using HeuristicLab.Common;
    34 using HeuristicLab.Parameters;
    35 using HeuristicLab.Data;
    36 using HeuristicLab.Random;
    3730
    3831namespace HeuristicLab.Problems.PTSP {
     
    5952      get { return (ValueParameter<DoubleArray>)Parameters["ProbabilityMatrix"]; }
    6053    }
    61    
     54
    6255
    6356    #endregion
     
    8477      set { ProbabilityMatrixParameter.Value = value; }
    8578    }
    86    
     79
    8780    #endregion
    88    
     81
    8982
    9083    public override bool Maximization {
     
    112105      });
    113106
    114       ProbabilityMatrix = new DoubleArray(new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1});
    115      
     107      ProbabilityMatrix = new DoubleArray(new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 });
     108
    116109    }
    117110
     
    134127        BestKnownSolution = new Permutation(PermutationTypes.RelativeUndirected, data.BestKnownTour);
    135128      }
    136      
    137       bool clearCoordinates = false, clearDistanceMatrix = false;
    138       if (data.Coordinates != null && data.Coordinates.GetLength(0) > 0)
    139         Coordinates = new DoubleMatrix(data.Coordinates);
    140       else clearCoordinates = true;
    141129
    142       // reset them after assigning the evaluator
    143       if (clearCoordinates) Coordinates = null;
    144       if (clearDistanceMatrix) DistanceMatrix = null;
     130      Coordinates = data.Coordinates != null && data.Coordinates.GetLength(0) > 0 ? new DoubleMatrix(data.Coordinates) : null;
     131      DistanceMatrix = new DistanceMatrix(data.GetDistanceMatrix());
    145132
    146       DistanceMatrix = new DistanceMatrix(data.GetDistanceMatrix());
    147      
    148133      Encoding.Length = data.Dimension;
    149134
Note: See TracChangeset for help on using the changeset viewer.