- Timestamp:
- 10/29/10 19:53:44 (14 years ago)
- Location:
- branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/BestTSPSolutionAnalyzer.cs
r4068 r4683 28 28 using HeuristicLab.Parameters; 29 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.Common; 30 31 31 32 namespace HeuristicLab.Problems.TravelingSalesman { … … 61 62 } 62 63 64 [StorableConstructor] 65 private BestTSPSolutionAnalyzer(bool deserializing) : base(deserializing) { } 66 private BestTSPSolutionAnalyzer(BestTSPSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 67 public override IDeepCloneable Clone(Cloner cloner) { 68 return new BestTSPSolutionAnalyzer(this, cloner); 69 } 63 70 public BestTSPSolutionAnalyzer() 64 71 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/TSPAlleleFrequencyAnalyzer.cs
r4623 r4683 27 27 using HeuristicLab.Parameters; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Common; 29 30 30 31 namespace HeuristicLab.Problems.TravelingSalesman { … … 39 40 } 40 41 42 [StorableConstructor] 43 private TSPAlleleFrequencyAnalyzer(bool deserializing) : base(deserializing) { } 44 private TSPAlleleFrequencyAnalyzer(TSPAlleleFrequencyAnalyzer original, Cloner cloner) 45 : base(original, cloner) { 46 } 47 public override IDeepCloneable Clone(Cloner cloner) { 48 return new TSPAlleleFrequencyAnalyzer(this, cloner); 49 } 41 50 public TSPAlleleFrequencyAnalyzer() 42 51 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Evaluators/TSPCoordinatesPathEvaluator.cs
r4068 r4683 25 25 using HeuristicLab.Parameters; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Common; 27 28 28 29 namespace HeuristicLab.Problems.TravelingSalesman { … … 46 47 } 47 48 49 [StorableConstructor] 50 protected TSPCoordinatesPathEvaluator(bool deserializing) : base(deserializing) { } 51 protected TSPCoordinatesPathEvaluator(TSPCoordinatesPathEvaluator original, Cloner cloner) : base(original, cloner) { } 48 52 protected TSPCoordinatesPathEvaluator() 49 53 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Evaluators/TSPEuclideanPathEvaluator.cs
r4068 r4683 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Common; 25 26 26 27 namespace HeuristicLab.Problems.TravelingSalesman { … … 31 32 [StorableClass] 32 33 public sealed class TSPEuclideanPathEvaluator : TSPCoordinatesPathEvaluator { 34 [StorableConstructor] 35 protected TSPEuclideanPathEvaluator(bool deserializing) : base(deserializing) { } 36 protected TSPEuclideanPathEvaluator(TSPEuclideanPathEvaluator original, Cloner cloner) : base(original, cloner) { } 37 public TSPEuclideanPathEvaluator() : base() { } 38 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new TSPEuclideanPathEvaluator(this, cloner); 41 } 42 33 43 /// <summary> 34 44 /// Calculates the distance between two points using the Euclidean distance metric. -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Evaluators/TSPEvaluator.cs
r4068 r4683 25 25 using HeuristicLab.Parameters; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Common; 27 28 28 29 namespace HeuristicLab.Problems.TravelingSalesman { … … 41 42 } 42 43 44 [StorableConstructor] 45 protected TSPEvaluator(bool deserializing) : base(deserializing) { } 46 protected TSPEvaluator(TSPEvaluator original, Cloner cloner) : base(original, cloner) { } 43 47 protected TSPEvaluator() 44 48 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Evaluators/TSPGeoPathEvaluator.cs
r4068 r4683 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Common; 25 26 26 27 namespace HeuristicLab.Problems.TravelingSalesman { … … 33 34 private const double PI = 3.141592; 34 35 private const double RADIUS = 6378.388; 36 37 [StorableConstructor] 38 private TSPGeoPathEvaluator(bool deserializing) : base(deserializing) { } 39 private TSPGeoPathEvaluator(TSPGeoPathEvaluator original, Cloner cloner) : base(original, cloner) { } 40 public TSPGeoPathEvaluator() : base() { } 41 42 public override IDeepCloneable Clone(Cloner cloner) { 43 return new TSPGeoPathEvaluator(this, cloner); 44 } 45 35 46 36 47 /// <summary> -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/Evaluators/TSPRoundedEuclideanPathEvaluator.cs
r4068 r4683 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Common; 25 26 26 27 namespace HeuristicLab.Problems.TravelingSalesman { … … 31 32 [StorableClass] 32 33 public sealed class TSPRoundedEuclideanPathEvaluator : TSPCoordinatesPathEvaluator { 34 [StorableConstructor] 35 private TSPRoundedEuclideanPathEvaluator(bool deserializing) : base(deserializing) { } 36 private TSPRoundedEuclideanPathEvaluator(TSPRoundedEuclideanPathEvaluator original, Cloner cloner) : base(original, cloner) { } 37 public TSPRoundedEuclideanPathEvaluator() : base() { } 38 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new TSPRoundedEuclideanPathEvaluator(this, cloner); 41 } 42 33 43 /// <summary> 34 44 /// Calculates the distance between two points using the rounded Euclidean distance metric. -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TSPMoveEvaluator.cs
r4068 r4683 27 27 using HeuristicLab.Parameters; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Common; 29 30 30 31 namespace HeuristicLab.Problems.TravelingSalesman { … … 48 49 } 49 50 51 [StorableConstructor] 52 protected TSPMoveEvaluator(bool deserializing) : base(deserializing) { } 53 protected TSPMoveEvaluator(TSPMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 50 54 protected TSPMoveEvaluator() 51 55 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TSPPathMoveEvaluator.cs
r4068 r4683 25 25 using HeuristicLab.Parameters; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Common; 27 28 28 29 namespace HeuristicLab.Problems.TravelingSalesman { … … 46 47 } 47 48 49 [StorableConstructor] 50 protected TSPPathMoveEvaluator(bool deserializing) : base(deserializing) { } 51 protected TSPPathMoveEvaluator(TSPPathMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 48 52 protected TSPPathMoveEvaluator() 49 53 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveEuclideanPathEvaluator.cs
r4068 r4683 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Common; 25 26 26 27 namespace HeuristicLab.Problems.TravelingSalesman { … … 31 32 [StorableClass] 32 33 public class TSPTranslocationMoveEuclideanPathEvaluator : TSPTranslocationMovePathEvaluator { 34 [StorableConstructor] 35 protected TSPTranslocationMoveEuclideanPathEvaluator(bool deserializing) : base(deserializing) { } 36 protected TSPTranslocationMoveEuclideanPathEvaluator(TSPTranslocationMoveEuclideanPathEvaluator original, Cloner cloner) : base(original, cloner) { } 37 public TSPTranslocationMoveEuclideanPathEvaluator() : base() { } 38 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new TSPTranslocationMoveEuclideanPathEvaluator(this, cloner); 41 } 42 33 43 public override Type EvaluatorType { 34 44 get { return typeof(TSPEuclideanPathEvaluator); } -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveGeoPathEvaluator.cs
r4068 r4683 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Common; 25 26 26 27 namespace HeuristicLab.Problems.TravelingSalesman { … … 37 38 private const double PI = 3.141592; 38 39 private const double RADIUS = 6378.388; 40 41 [StorableConstructor] 42 protected TSPTranslocationMoveGeoPathEvaluator(bool deserializing) : base(deserializing) { } 43 protected TSPTranslocationMoveGeoPathEvaluator(TSPTranslocationMoveGeoPathEvaluator original, Cloner cloner) : base(original, cloner) { } 44 public TSPTranslocationMoveGeoPathEvaluator() : base() { } 45 46 public override IDeepCloneable Clone(Cloner cloner) { 47 return new TSPTranslocationMoveGeoPathEvaluator(this, cloner); 48 } 49 39 50 40 51 /// <summary> -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMovePathEvaluator.cs
r4068 r4683 25 25 using HeuristicLab.Parameters; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Common; 27 28 28 29 namespace HeuristicLab.Problems.TravelingSalesman { … … 37 38 } 38 39 40 [StorableConstructor] 41 protected TSPTranslocationMovePathEvaluator(bool deserializing) : base(deserializing) { } 42 protected TSPTranslocationMovePathEvaluator(TSPTranslocationMovePathEvaluator original, Cloner cloner) : base(original, cloner) { } 39 43 public TSPTranslocationMovePathEvaluator() 40 44 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPTranslocationMoveRoundedEuclideanPathEvaluator.cs
r4068 r4683 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Common; 25 26 26 27 namespace HeuristicLab.Problems.TravelingSalesman { … … 31 32 [StorableClass] 32 33 public class TSPTranslocationMoveRoundedEuclideanPathEvaluator : TSPTranslocationMovePathEvaluator { 34 [StorableConstructor] 35 protected TSPTranslocationMoveRoundedEuclideanPathEvaluator(bool deserializing) : base(deserializing) { } 36 protected TSPTranslocationMoveRoundedEuclideanPathEvaluator(TSPTranslocationMoveRoundedEuclideanPathEvaluator original, Cloner cloner) : base(original, cloner) { } 37 public TSPTranslocationMoveRoundedEuclideanPathEvaluator() : base() { } 38 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new TSPTranslocationMoveRoundedEuclideanPathEvaluator(this, cloner); 41 } 42 33 43 public override Type EvaluatorType { 34 44 get { return typeof(TSPRoundedEuclideanPathEvaluator); } -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveEuclideanPathEvaluator.cs
r4068 r4683 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Common; 25 26 26 27 namespace HeuristicLab.Problems.TravelingSalesman { … … 31 32 [StorableClass] 32 33 public class TSPInversionMoveEuclideanPathEvaluator : TSPInversionMovePathEvaluator { 34 [StorableConstructor] 35 protected TSPInversionMoveEuclideanPathEvaluator(bool deserializing) : base(deserializing) { } 36 protected TSPInversionMoveEuclideanPathEvaluator(TSPInversionMoveEuclideanPathEvaluator original, Cloner cloner) : base(original, cloner) { } 37 public TSPInversionMoveEuclideanPathEvaluator() : base() { } 38 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new TSPInversionMoveEuclideanPathEvaluator(this, cloner); 41 } 42 33 43 public override Type EvaluatorType { 34 44 get { return typeof(TSPEuclideanPathEvaluator); } -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveGeoPathEvaluator.cs
r4068 r4683 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Common; 25 26 26 27 namespace HeuristicLab.Problems.TravelingSalesman { … … 38 39 private const double RADIUS = 6378.388; 39 40 41 [StorableConstructor] 42 protected TSPInversionMoveGeoPathEvaluator(bool deserializing) : base(deserializing) { } 43 protected TSPInversionMoveGeoPathEvaluator(TSPInversionMoveGeoPathEvaluator original, Cloner cloner) : base(original, cloner) { } 44 public TSPInversionMoveGeoPathEvaluator() : base() { } 45 46 public override IDeepCloneable Clone(Cloner cloner) { 47 return new TSPInversionMoveGeoPathEvaluator(this, cloner); 48 } 49 40 50 /// <summary> 41 51 /// Calculates the distance between two points using the GEO distance metric (globe coordinates). -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMovePathEvaluator.cs
r4068 r4683 25 25 using HeuristicLab.Parameters; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Common; 27 28 28 29 namespace HeuristicLab.Problems.TravelingSalesman { … … 37 38 } 38 39 40 [StorableConstructor] 41 protected TSPInversionMovePathEvaluator(bool deserializing) : base(deserializing) { } 42 protected TSPInversionMovePathEvaluator(TSPInversionMovePathEvaluator original, Cloner cloner) : base(original, cloner) { } 39 43 public TSPInversionMovePathEvaluator() 40 44 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMoveRoundedEuclideanPathEvaluator.cs
r4068 r4683 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Common; 25 26 26 27 namespace HeuristicLab.Problems.TravelingSalesman { … … 31 32 [StorableClass] 32 33 public class TSPInversionMoveRoundedEuclideanPathEvaluator : TSPInversionMovePathEvaluator { 34 [StorableConstructor] 35 protected TSPInversionMoveRoundedEuclideanPathEvaluator(bool deserializing) : base(deserializing) { } 36 protected TSPInversionMoveRoundedEuclideanPathEvaluator(TSPInversionMoveRoundedEuclideanPathEvaluator original, Cloner cloner) : base(original, cloner) { } 37 public TSPInversionMoveRoundedEuclideanPathEvaluator() : base() { } 38 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new TSPInversionMoveRoundedEuclideanPathEvaluator(this, cloner); 41 } 42 33 43 public override Type EvaluatorType { 34 44 get { return typeof(TSPRoundedEuclideanPathEvaluator); } -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/PathTSPTour.cs
r4477 r4683 79 79 } 80 80 81 [StorableConstructor] 82 private PathTSPTour(bool deserializing) : base(deserializing) { } 83 private PathTSPTour(PathTSPTour original, Cloner cloner) 84 : base(original, cloner) { 85 this.coordinates = cloner.Clone(original.coordinates); 86 this.permutation = cloner.Clone(original.permutation); 87 this.quality = cloner.Clone(original.quality); 88 Initialize(); 89 } 81 90 public PathTSPTour() : base() { } 82 91 public PathTSPTour(DoubleMatrix coordinates) … … 98 107 Initialize(); 99 108 } 100 [StorableConstructor] 101 private PathTSPTour(bool deserializing) : base(deserializing) { } 109 110 public override IDeepCloneable Clone(Cloner cloner) { 111 return new PathTSPTour(this, cloner); 112 } 102 113 103 114 [StorableHook(HookType.AfterDeserialization)] 115 private void AfterDeserialization() { 116 Initialize(); 117 } 118 104 119 private void Initialize() { 105 120 if (coordinates != null) RegisterCoordinatesEvents(); 106 121 if (permutation != null) RegisterPermutationEvents(); 107 122 if (quality != null) RegisterQualityEvents(); 108 }109 110 public override IDeepCloneable Clone(Cloner cloner) {111 PathTSPTour clone = new PathTSPTour();112 cloner.RegisterClonedObject(this, clone);113 clone.coordinates = (DoubleMatrix)cloner.Clone(coordinates);114 clone.permutation = (Permutation)cloner.Clone(permutation);115 clone.quality = (DoubleValue)cloner.Clone(quality);116 clone.Initialize();117 return clone;118 123 } 119 124 -
branches/CloningRefactoring/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
r4641 r4683 138 138 [StorableConstructor] 139 139 private TravelingSalesmanProblem(bool deserializing) : base(deserializing) { } 140 private TravelingSalesmanProblem(TravelingSalesmanProblem original, Cloner cloner) 141 : base(original, cloner) { 142 this.operators = original.operators.Select(x => (IOperator)cloner.Clone(x)).ToList(); 143 this.DistanceMatrixParameter.Value = original.DistanceMatrixParameter.Value; 144 AttachEventHandlers(); 145 } 146 public override IDeepCloneable Clone(Cloner cloner) { 147 return new TravelingSalesmanProblem(this, cloner); 148 } 140 149 public TravelingSalesmanProblem() 141 150 : base() { … … 168 177 } 169 178 170 public override IDeepCloneable Clone(Cloner cloner) {171 TravelingSalesmanProblem clone = (TravelingSalesmanProblem)base.Clone(cloner);172 clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList();173 clone.DistanceMatrixParameter.Value = DistanceMatrixParameter.Value;174 clone.AttachEventHandlers();175 return clone;176 }177 178 179 #region Events 179 180 public event EventHandler SolutionCreatorChanged; … … 251 252 #region Helpers 252 253 [StorableHook(HookType.AfterDeserialization)] 253 private void AfterDeserialization Hook() {254 private void AfterDeserialization() { 254 255 // BackwardsCompatibility3.3 255 256 #region Backwards compatible code (remove with 3.4)
Note: See TracChangeset
for help on using the changeset viewer.