Changeset 13366
- Timestamp:
- 11/24/15 16:48:04 (9 years ago)
- Location:
- branches/ProblemRefactoring
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/Interfaces/IPermutationCreator.cs
r12012 r13366 28 28 /// An interface which represents an operator for creating permutations. 29 29 /// </summary> 30 public interface IPermutationCreator : IPermutationOperator, ISolutionCreator {30 public interface IPermutationCreator : IPermutationOperator, ISolutionCreator<Permutation> { 31 31 IValueLookupParameter<IntValue> LengthParameter { get; } 32 32 ILookupParameter<Permutation> PermutationParameter { get; } -
branches/ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/Permutation.cs
r12012 r13366 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Data; 26 using HeuristicLab.Optimization; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 28 … … 29 30 [Item("Permutation", "Represents a permutation of integer values.")] 30 31 [StorableClass] 31 public class Permutation : IntArray {32 public class Permutation : IntArray, ISolution { 32 33 [Storable] 33 34 private PermutationTypes permutationType; -
branches/ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/PermutationEncoding.cs
r12015 r13366 34 34 [Item("PermutationEncoding", "Describes a permutation encoding.")] 35 35 [StorableClass] 36 public sealed class PermutationEncoding : Encoding< IPermutationCreator> {36 public sealed class PermutationEncoding : Encoding<Permutation> { 37 37 #region encoding parameters 38 38 [Storable] … … 224 224 #endregion 225 225 } 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 }236 226 } -
branches/ProblemRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
r13173 r13366 40 40 [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 100)] 41 41 [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 44 45 private static readonly int DistanceMatrixSizeLimit = 1000; 45 46 public string Filename { get; set; } … … 432 433 try { 433 434 EvaluateAndLoadTour(data.BestKnownTour); 434 } catch (InvalidOperationException) { 435 } 436 catch (InvalidOperationException) { 435 437 if (data.BestKnownQuality.HasValue) 436 438 BestKnownQuality = new DoubleValue(data.BestKnownQuality.Value);
Note: See TracChangeset
for help on using the changeset viewer.