Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13366 for branches


Ignore:
Timestamp:
11/24/15 16:48:04 (9 years ago)
Author:
mkommend
Message:

#2521: Adapted PermutationEncoding and TSP.

Location:
branches/ProblemRefactoring
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/Interfaces/IPermutationCreator.cs

    r12012 r13366  
    2828  /// An interface which represents an operator for creating permutations.
    2929  /// </summary>
    30   public interface IPermutationCreator : IPermutationOperator, ISolutionCreator {
     30  public interface IPermutationCreator : IPermutationOperator, ISolutionCreator<Permutation> {
    3131    IValueLookupParameter<IntValue> LengthParameter { get; }
    3232    ILookupParameter<Permutation> PermutationParameter { get; }
  • branches/ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/Permutation.cs

    r12012 r13366  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     26using HeuristicLab.Optimization;
    2627using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2728
     
    2930  [Item("Permutation", "Represents a permutation of integer values.")]
    3031  [StorableClass]
    31   public class Permutation : IntArray {
     32  public class Permutation : IntArray, ISolution {
    3233    [Storable]
    3334    private PermutationTypes permutationType;
  • branches/ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/PermutationEncoding.cs

    r12015 r13366  
    3434  [Item("PermutationEncoding", "Describes a permutation encoding.")]
    3535  [StorableClass]
    36   public sealed class PermutationEncoding : Encoding<IPermutationCreator> {
     36  public sealed class PermutationEncoding : Encoding<Permutation> {
    3737    #region encoding parameters
    3838    [Storable]
     
    224224    #endregion
    225225  }
    226 
    227   public static class IndividualExtensionMethods {
    228     public static Permutation Permutation(this Individual individual) {
    229       var encoding = individual.GetEncoding<PermutationEncoding>();
    230       return individual.Permutation(encoding.Name);
    231     }
    232     public static Permutation Permutation(this Individual individual, string name) {
    233       return (Permutation)individual[name];
    234     }
    235   }
    236226}
  • branches/ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs

    r13173 r13366  
    4040  [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 100)]
    4141  [StorableClass]
    42   public sealed class TravelingSalesmanProblem : SingleObjectiveHeuristicOptimizationProblem<ITSPEvaluator, IPermutationCreator>, IStorableContent,
    43     IProblemInstanceConsumer<TSPData> {
     42  public sealed class TravelingSalesmanProblem : SingleObjectiveHeuristicOptimizationProblem<ITSPEvaluator, IPermutationCreator>,
     43    ISingleObjectiveProblem<PermutationEncoding, Permutation>, IStorableContent, IProblemInstanceConsumer<TSPData> {
     44
    4445    private static readonly int DistanceMatrixSizeLimit = 1000;
    4546    public string Filename { get; set; }
     
    432433        try {
    433434          EvaluateAndLoadTour(data.BestKnownTour);
    434         } catch (InvalidOperationException) {
     435        }
     436        catch (InvalidOperationException) {
    435437          if (data.BestKnownQuality.HasValue)
    436438            BestKnownQuality = new DoubleValue(data.BestKnownQuality.Value);
Note: See TracChangeset for help on using the changeset viewer.