- Timestamp:
- 11/06/10 01:56:04 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/CloningRefactoring (added) merged: 4656-4693,4696-4697,4711-4714,4718-4719
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting
- Property svn:mergeinfo changed
/branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting (added) merged: 4686-4687,4689-4693,4696-4697
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuCrossover.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab. Encodings.PermutationEncoding;24 using HeuristicLab.Optimization; 24 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using HeuristicLab.Optimization;28 27 29 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu { … … 34 33 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 35 34 } 36 35 37 36 [StorableConstructor] 38 37 protected ZhuCrossover(bool deserializing) : base(deserializing) { } 38 protected ZhuCrossover(ZhuCrossover original, Cloner cloner) 39 : base(original, cloner) { 40 } 39 41 40 42 public ZhuCrossover() … … 52 54 if (!(solution is ZhuEncoding)) { 53 55 parents[i] = ZhuEncoding.ConvertFrom(solution, 54 Cities, 56 Cities, 55 57 DueTimeParameter.ActualValue, 56 58 ServiceTimeParameter.ActualValue, -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover1.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.PermutationEncoding;24 using HeuristicLab.Parameters;25 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 25 28 26 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu { 29 27 [Item("ZhuHeuristicCrossover1", "The Zhu Heuristic Crossover (Version 1). It is implemented as described in Zhu, K.Q. (2000). A New Genetic Algorithm For VRPTW. Proceedings of the International Conference on Artificial Intelligence.")] 30 28 [StorableClass] 31 public sealed class ZhuHeuristicCrossover1 : ZhuCrossover { 29 public sealed class ZhuHeuristicCrossover1 : ZhuCrossover { 32 30 [StorableConstructor] 33 31 private ZhuHeuristicCrossover1(bool deserializing) : base(deserializing) { } 34 32 private ZhuHeuristicCrossover1(ZhuHeuristicCrossover1 original, Cloner cloner) 33 : base(original, cloner) { 34 } 35 public override IDeepCloneable Clone(Cloner cloner) { 36 return new ZhuHeuristicCrossover1(this, cloner); 37 } 35 38 public ZhuHeuristicCrossover1() 36 39 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover2.cs
r4352 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 22 24 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.PermutationEncoding;24 using HeuristicLab.Parameters;25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using System.Collections.Generic;28 26 29 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu { 30 28 [Item("ZhuHeuristicCrossover2", "The Zhu Heuristic Crossover (Version 2). It is implemented as described in Zhu, K.Q. (2000). A New Genetic Algorithm For VRPTW. Proceedings of the International Conference on Artificial Intelligence.")] 31 29 [StorableClass] 32 public sealed class ZhuHeuristicCrossover2 : ZhuCrossover { 30 public sealed class ZhuHeuristicCrossover2 : ZhuCrossover { 33 31 [StorableConstructor] 34 32 private ZhuHeuristicCrossover2(bool deserializing) : base(deserializing) { } 35 33 private ZhuHeuristicCrossover2(ZhuHeuristicCrossover2 original, Cloner cloner) 34 : base(original, cloner) { 35 } 36 public override IDeepCloneable Clone(Cloner cloner) { 37 return new ZhuHeuristicCrossover2(this, cloner); 38 } 36 39 public ZhuHeuristicCrossover2() 37 40 : base() { … … 49 52 if (predecessor < 0) 50 53 predecessor = predecessor + child.Length; 51 54 52 55 int parent1Index = i; 53 56 int parent2Index = i; … … 56 59 if (i == breakPoint) { 57 60 child[i] = p1[parent1Index]; 58 61 59 62 p1.Remove(child[i]); 60 63 if (parent1Index >= p1.Count) -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuMergeCrossover1.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.PermutationEncoding;24 using HeuristicLab.Parameters;25 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 25 28 26 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu { 29 27 [Item("ZhuMergeCrossover1", "The Zhu Merge Crossover (Version 1). It is implemented as described in Zhu, K.Q. (2000). A New Genetic Algorithm For VRPTW. Proceedings of the International Conference on Artificial Intelligence.")] 30 28 [StorableClass] 31 public sealed class ZhuMergeCrossover1 : ZhuCrossover { 29 public sealed class ZhuMergeCrossover1 : ZhuCrossover { 32 30 [StorableConstructor] 33 31 private ZhuMergeCrossover1(bool deserializing) : base(deserializing) { } 34 32 private ZhuMergeCrossover1(ZhuMergeCrossover1 original, Cloner cloner) 33 : base(original, cloner) { 34 } 35 public override IDeepCloneable Clone(Cloner cloner) { 36 return new ZhuMergeCrossover1(this, cloner); 37 } 35 38 public ZhuMergeCrossover1() 36 39 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuMergeCrossover2.cs
r4352 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 22 24 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.PermutationEncoding;24 using HeuristicLab.Parameters;25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using System.Collections.Generic;28 26 29 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu { 30 28 [Item("ZhuMergeCrossover2", "The Zhu Merge Crossover (Version 2). It is implemented as described in Zhu, K.Q. (2000). A New Genetic Algorithm For VRPTW. Proceedings of the International Conference on Artificial Intelligence.")] 31 29 [StorableClass] 32 public sealed class ZhuMergeCrossover2 : ZhuCrossover { 30 public sealed class ZhuMergeCrossover2 : ZhuCrossover { 33 31 [StorableConstructor] 34 32 private ZhuMergeCrossover2(bool deserializing) : base(deserializing) { } 35 33 private ZhuMergeCrossover2(ZhuMergeCrossover2 original, Cloner cloner) 34 : base(original, cloner) { 35 } 36 public override IDeepCloneable Clone(Cloner cloner) { 37 return new ZhuMergeCrossover2(this, cloner); 38 } 36 39 public ZhuMergeCrossover2() 37 40 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Crossovers/ZhuPermutationCrossover.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.PermutationEncoding; 24 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 27 28 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu { 29 29 [Item("ZhuPermutationCrossover", "An operator which crosses two VRP representations using a standard permutation operator. It is implemented as described in Zhu, K.Q. (2000). A New Genetic Algorithm For VRPTW. Proceedings of the International Conference on Artificial Intelligence.")] 30 30 [StorableClass] 31 public sealed class PrinsPermutationCrossover : ZhuCrossover { 31 public sealed class PrinsPermutationCrossover : ZhuCrossover { 32 32 public IValueLookupParameter<IPermutationCrossover> InnerCrossoverParameter { 33 33 get { return (IValueLookupParameter<IPermutationCrossover>)Parameters["InnerCrossover"]; } … … 36 36 [StorableConstructor] 37 37 private PrinsPermutationCrossover(bool deserializing) : base(deserializing) { } 38 38 private PrinsPermutationCrossover(PrinsPermutationCrossover original, Cloner cloner) 39 : base(original, cloner) { 40 } 41 public override IDeepCloneable Clone(Cloner cloner) { 42 return new PrinsPermutationCrossover(this, cloner); 43 } 39 44 public PrinsPermutationCrossover() 40 45 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Manipulators/ZhuManipulator.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab. Encodings.PermutationEncoding;24 using HeuristicLab.Optimization; 24 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using HeuristicLab.Optimization;28 27 29 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu { … … 34 33 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 35 34 } 36 37 35 [StorableConstructor] 38 36 protected ZhuManipulator(bool deserializing) : base(deserializing) { } 37 protected ZhuManipulator(ZhuManipulator original, Cloner cloner) 38 : base(original, cloner) { 39 } 40 39 41 40 42 public ZhuManipulator() … … 49 51 if (!(solution is ZhuEncoding)) { 50 52 VRPToursParameter.ActualValue = ZhuEncoding.ConvertFrom(solution, 51 Cities, 53 Cities, 52 54 DueTimeParameter.ActualValue, 53 55 ServiceTimeParameter.ActualValue, -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/Manipulators/ZhuPermutationManipulator.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.PermutationEncoding; 24 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 27 28 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu { … … 36 36 [StorableConstructor] 37 37 private ZhuPermutationManipulator(bool deserializing) : base(deserializing) { } 38 38 private ZhuPermutationManipulator(ZhuPermutationManipulator original, Cloner cloner) 39 : base(original, cloner) { 40 } 41 public override IDeepCloneable Clone(Cloner cloner) { 42 return new ZhuPermutationManipulator(this, cloner); 43 } 39 44 public ZhuPermutationManipulator() 40 45 : base() { 41 46 Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("InnerManipulator", "The permutation manipulator.", new TranslocationManipulator())); 42 47 } 43 48 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/ZhuEncoding.cs
r4352 r4722 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 22 24 using HeuristicLab.Common; 23 25 using HeuristicLab.Core; … … 25 27 using HeuristicLab.Encodings.PermutationEncoding; 26 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using System.Collections.Generic;28 29 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 29 using System;30 30 31 31 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Zhu { … … 44 44 [Storable] 45 45 DoubleArray dueTimeArray; 46 46 47 47 [Storable] 48 48 DoubleArray serviceTimeArray; … … 50 50 [Storable] 51 51 DoubleArray readyTimeArray; 52 52 53 53 [Storable] 54 54 DoubleArray demandArray; … … 75 75 distanceMatrix, 76 76 useDistanceMatrix)) { 77 78 79 77 newTour.Cities.Remove(city); 78 if (newTour.Cities.Count > 0) 79 result.Add(newTour); 80 80 81 82 81 newTour = new Tour(); 82 newTour.Cities.Add(city); 83 83 } 84 84 } … … 124 124 #endregion 125 125 126 public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) { 127 ZhuEncoding clone = new ZhuEncoding( 128 new Permutation(this.PermutationType, this.array), cities, 129 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 130 coordinates, useDistanceMatrix); 131 132 cloner.RegisterClonedObject(this, clone); 133 clone.readOnly = readOnly; 134 return clone; 126 [StorableConstructor] 127 protected ZhuEncoding(bool deserializing) : base(deserializing) { } 128 protected ZhuEncoding(ZhuEncoding original, Cloner cloner) 129 : base(original, cloner) { 130 this.cities = original.cities; 131 this.dueTimeArray = original.dueTimeArray; 132 this.serviceTimeArray = original.serviceTimeArray; 133 this.readyTimeArray = original.readyTimeArray; 134 this.demandArray = original.demandArray; 135 this.capacity = original.capacity; 136 this.coordinates = original.coordinates; 137 this.useDistanceMatrix = original.useDistanceMatrix; 138 } 139 public ZhuEncoding(Permutation permutation, int cities, 140 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity, 141 DoubleMatrix coordinates, BoolValue useDistanceMatrix) 142 : base(permutation) { 143 this.cities = cities; 144 this.dueTimeArray = dueTimeArray; 145 this.serviceTimeArray = serviceTimeArray; 146 this.readyTimeArray = readyTimeArray; 147 this.demandArray = demandArray; 148 this.capacity = capacity; 149 this.coordinates = coordinates; 150 this.useDistanceMatrix = useDistanceMatrix; 135 151 } 136 152 137 public ZhuEncoding(Permutation permutation, int cities, 138 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity, 139 DoubleMatrix coordinates, BoolValue useDistanceMatrix) 140 : base(permutation) { 141 this.cities = cities; 142 this.dueTimeArray = dueTimeArray; 143 this.serviceTimeArray = serviceTimeArray; 144 this.readyTimeArray = readyTimeArray; 145 this.demandArray = demandArray; 146 this.capacity = capacity; 147 this.coordinates = coordinates; 148 this.useDistanceMatrix = useDistanceMatrix; 149 } 150 151 [StorableConstructor] 152 private ZhuEncoding(bool serializing) 153 : base(serializing) { 153 public override IDeepCloneable Clone(Cloner cloner) { 154 return new ZhuEncoding(this, cloner); 154 155 } 155 156 … … 171 172 } 172 173 173 public static ZhuEncoding ConvertFrom(List<int> routeParam, int cities, 174 public static ZhuEncoding ConvertFrom(List<int> routeParam, int cities, 174 175 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity, 175 176 DoubleMatrix coordinates, BoolValue useDistanceMatrix) { … … 183 184 184 185 return new ZhuEncoding( 185 new Permutation(PermutationTypes.RelativeUndirected, route.ToArray()), cities, 186 new Permutation(PermutationTypes.RelativeUndirected, route.ToArray()), cities, 186 187 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 187 188 coordinates, useDistanceMatrix);
Note: See TracChangeset
for help on using the changeset viewer.