Changeset 4722 for trunk/sources/HeuristicLab.Problems.VehicleRouting
- Timestamp:
- 11/06/10 01:56:04 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 107 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/Analyzers/BestAverageWorstVRPToursAnalyzer.cs
r4416 r4722 21 21 22 22 using System; 23 using HeuristicLab.Analysis; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 29 30 using HeuristicLab.Parameters; 30 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Analysis;32 32 33 33 namespace HeuristicLab.Problems.VehicleRouting { … … 150 150 public BestAverageWorstVRPToursAnalyzer() 151 151 : base() { 152 #region Create parameters 152 #region Create parameters 153 153 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Overload", "The overloads of the VRP solutions which should be analyzed.")); 154 154 Parameters.Add(new ValueLookupParameter<DoubleValue>("BestOverload", "The best overload value.")); … … 157 157 Parameters.Add(new ValueLookupParameter<DoubleValue>("CurrentWorstOverload", "The current worst overload value of all solutions.")); 158 158 Parameters.Add(new ValueLookupParameter<DataTable>("Overloads", "The data table to store the current best, current average, current worst, best and best known overload value.")); 159 159 160 160 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Tardiness", "The tardiness of the VRP solutions which should be analyzed.")); 161 161 Parameters.Add(new ValueLookupParameter<DoubleValue>("BestTardiness", "The best tardiness value.")); … … 311 311 [StorableConstructor] 312 312 private BestAverageWorstVRPToursAnalyzer(bool deserializing) : base() { } 313 private BestAverageWorstVRPToursAnalyzer(BestAverageWorstVRPToursAnalyzer original, Cloner cloner) 314 : base(original, cloner) { 315 Initialize(); 316 } 317 public override IDeepCloneable Clone(Cloner cloner) { 318 return new BestAverageWorstVRPToursAnalyzer(this, cloner); 319 } 313 320 314 321 [StorableHook(HookType.AfterDeserialization)] 322 private void AfterDeserialization() { 323 Initialize(); 324 } 315 325 private void Initialize() { 316 326 OverloadParameter.DepthChanged += new EventHandler(OverloadParameter_DepthChanged); … … 321 331 } 322 332 323 public override IDeepCloneable Clone(Cloner cloner) {324 BestAverageWorstVRPToursAnalyzer clone = (BestAverageWorstVRPToursAnalyzer)base.Clone(cloner);325 clone.Initialize();326 return clone;327 }328 333 329 334 void OverloadParameter_DepthChanged(object sender, EventArgs e) { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Analyzers/BestAverageWorstVRPToursCalculator.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 95 96 } 96 97 98 [StorableConstructor] 99 private BestAverageWorstVRPToursCalculator(bool deserializing) : base(deserializing) { } 100 private BestAverageWorstVRPToursCalculator(BestAverageWorstVRPToursCalculator original, Cloner cloner) 101 : base(original, cloner) { 102 } 97 103 public BestAverageWorstVRPToursCalculator() 98 104 : base() { … … 123 129 } 124 130 131 public override IDeepCloneable Clone(Cloner cloner) { 132 return new BestAverageWorstVRPToursCalculator(this, cloner); 133 } 134 125 135 private void UpdateOverloads() { 126 136 ItemArray<DoubleValue> overloads = OverloadParameter.ActualValue; -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Analyzers/BestVRPSolutionAnalyzer.cs
r4513 r4722 21 21 22 22 using System.Linq; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 83 84 [StorableConstructor] 84 85 private BestVRPSolutionAnalyzer(bool deserializing) : base(deserializing) { } 85 86 private BestVRPSolutionAnalyzer(BestVRPSolutionAnalyzer original, Cloner cloner) 87 : base(original, cloner) { 88 } 86 89 public BestVRPSolutionAnalyzer() 87 90 : base() { … … 102 105 Parameters.Add(new LookupParameter<VRPSolution>("BestSolution", "The best VRP solution.")); 103 106 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best VRP solution should be stored.")); 107 } 108 109 public override IDeepCloneable Clone(Cloner cloner) { 110 return new BestVRPSolutionAnalyzer(this, cloner); 104 111 } 105 112 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Analyzers/BestVRPToursMemorizer.cs
r4352 r4722 21 21 22 22 using System.Linq; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 63 64 } 64 65 66 [StorableConstructor] 67 protected BestVRPToursMemorizer(bool deserializing) : base(deserializing) { } 68 protected BestVRPToursMemorizer(BestVRPToursMemorizer original, Cloner cloner) 69 : base(original, cloner) { 70 } 65 71 public BestVRPToursMemorizer() 66 72 : base() { … … 77 83 Parameters.Add(new ValueLookupParameter<DoubleValue>("BestVehiclesUtilized", "The best vehicles utilized found so far.")); 78 84 85 } 86 87 public override IDeepCloneable Clone(Cloner cloner) { 88 return new BestVRPToursMemorizer(this, cloner); 79 89 } 80 90 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/AlbaEncoding.cs
r4352 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 25 26 using HeuristicLab.Encodings.PermutationEncoding; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using System.Collections.Generic;28 28 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 29 29 … … 34 34 [Storable] 35 35 private int cities; 36 36 37 37 #region IVRPEncoding Members 38 38 public override List<Tour> GetTours(ILookupParameter<DoubleMatrix> distanceMatrix = null, int maxVehicles = int.MaxValue) { … … 64 64 65 65 public int MaxVehicles { 66 get { return Length - Cities + 1; 66 get { return Length - Cities + 1; } 67 67 } 68 68 69 69 #endregion 70 70 71 public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) { 72 AlbaEncoding clone = new AlbaEncoding( 73 new Permutation(this.PermutationType, this.array), cities); 74 cloner.RegisterClonedObject(this, clone); 75 clone.readOnly = readOnly; 76 return clone; 71 72 [StorableConstructor] 73 protected AlbaEncoding(bool deserializing) : base(deserializing) { } 74 protected AlbaEncoding(AlbaEncoding original, Cloner cloner) 75 : base(original, cloner) { 76 cities = original.cities; 77 readOnly = original.readOnly; 77 78 } 78 79 … … 82 83 } 83 84 84 [StorableConstructor] 85 private AlbaEncoding(bool serializing) 86 : base(serializing) { 85 public override IDeepCloneable Clone(Cloner cloner) { 86 return new AlbaEncoding(this, cloner); 87 87 } 88 88 … … 103 103 foreach (Tour tour in tours) { 104 104 foreach (int city in tour.Cities) { 105 106 105 array[arrayIndex] = city - 1; 106 arrayIndex++; 107 107 } 108 108 … … 119 119 arrayIndex++; 120 120 } 121 121 122 122 AlbaEncoding solution = new AlbaEncoding(new Permutation(PermutationTypes.RelativeUndirected, new IntArray(array)), cities); 123 123 … … 128 128 List<int> route = new List<int>(routeParam); 129 129 route.RemoveAt(routeParam.Count - 1); 130 130 131 131 int cities = 0; 132 132 for (int i = 0; i < route.Count; i++) { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaCrossover.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.Alba { … … 34 33 get { return (LookupParameter<IRandom>)Parameters["Random"]; } 35 34 } 36 35 37 36 [StorableConstructor] 38 37 protected AlbaCrossover(bool deserializing) : base(deserializing) { } 39 38 protected AlbaCrossover(AlbaCrossover original, Cloner cloner) : base(original, cloner) { } 40 39 public AlbaCrossover() 41 40 : base() { 42 41 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 43 42 44 43 AlbaEncoding.RemoveUnusedParameters(Parameters); 45 44 } … … 61 60 ParentsParameter.ActualValue = parents; 62 61 63 ChildParameter.ActualValue = 62 ChildParameter.ActualValue = 64 63 Crossover(RandomParameter.ActualValue, parents[0] as AlbaEncoding, parents[1] as AlbaEncoding); 65 64 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaPermutationCrossover.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.Alba { 29 29 [Item("AlbaPermutationCrossover", "An operator which crosses two VRP representations using a standard permutation operator. It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")] 30 30 [StorableClass] 31 public sealed class AlbaPermutationCrossover : AlbaCrossover { 31 public sealed class AlbaPermutationCrossover : AlbaCrossover { 32 32 public IValueLookupParameter<IPermutationCrossover> InnerCrossoverParameter { 33 33 get { return (IValueLookupParameter<IPermutationCrossover>)Parameters["InnerCrossover"]; } … … 36 36 [StorableConstructor] 37 37 private AlbaPermutationCrossover(bool deserializing) : base(deserializing) { } 38 38 private AlbaPermutationCrossover(AlbaPermutationCrossover original, Cloner cloner) 39 : base(original, cloner) { 40 } 41 public override IDeepCloneable Clone(Cloner cloner) { 42 return new AlbaPermutationCrossover(this, cloner); 43 } 39 44 public AlbaPermutationCrossover() 40 45 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerInsertionManipulator.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.Alba { … … 32 30 [StorableConstructor] 33 31 private AlbaCustomerInsertionManipulator(bool deserializing) : base(deserializing) { } 34 32 private AlbaCustomerInsertionManipulator(AlbaCustomerInsertionManipulator original, Cloner cloner) 33 : base(original, cloner) { 34 } 35 35 public AlbaCustomerInsertionManipulator() 36 36 : base() { 37 } 38 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new AlbaCustomerInsertionManipulator(this, cloner); 37 41 } 38 42 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerInversionManipulator.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.Alba { … … 33 31 [StorableConstructor] 34 32 private AlbaCustomerInversionManipulator(bool deserializing) : base(deserializing) { } 35 33 private AlbaCustomerInversionManipulator(AlbaCustomerInversionManipulator original, Cloner cloner) 34 : base(original, cloner) { 35 } 36 36 public AlbaCustomerInversionManipulator() 37 37 : base() { 38 38 } 39 39 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new AlbaCustomerInversionManipulator(this, cloner); 42 } 40 43 protected override void Manipulate(IRandom random, AlbaEncoding individual) { 41 44 int breakPoint1, breakPoint2; -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaCustomerSwapManipulator.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.Alba { … … 32 30 [StorableConstructor] 33 31 private AlbaCustomerSwapManipulator(bool deserializing) : base(deserializing) { } 34 32 private AlbaCustomerSwapManipulator(AlbaCustomerSwapManipulator original, Cloner cloner) : base(original, cloner) { } 35 33 public AlbaCustomerSwapManipulator() 36 34 : base() { 35 } 36 public override IDeepCloneable Clone(Cloner cloner) { 37 return new AlbaCustomerSwapManipulator(this, cloner); 37 38 } 38 39 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaIntraRouteInversionManipulator.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;28 using System.Collections.Generic;29 26 30 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { 31 28 [Item("AlbaIntraRouteInversionManipulator", "An operator which applies the SLS operation to a VRP representation. It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")] 32 29 [StorableClass] 33 public sealed class AlbaIntraRouteInversionManipulator : AlbaManipulator { 30 public sealed class AlbaIntraRouteInversionManipulator : AlbaManipulator { 34 31 [StorableConstructor] 35 32 private AlbaIntraRouteInversionManipulator(bool deserializing) : base(deserializing) { } 36 33 private AlbaIntraRouteInversionManipulator(AlbaIntraRouteInversionManipulator original, Cloner cloner) : base(original, cloner) { } 37 34 public AlbaIntraRouteInversionManipulator() 38 35 : base() { 39 } 36 } 37 38 public override IDeepCloneable Clone(Cloner cloner) { 39 return new AlbaIntraRouteInversionManipulator(this, cloner); 40 } 40 41 41 42 public static void Apply(AlbaEncoding individual, int index1, int index2) { … … 72 73 73 74 int currentTourEnd = currentTourStart; 74 while (currentTourEnd < individual.Length && 75 while (currentTourEnd < individual.Length && 75 76 individual[currentTourEnd] < individual.Cities) { 76 77 currentTourEnd++; -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaLambdaInterchangeManipulator.cs
r4352 r4722 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 22 25 using HeuristicLab.Core; 23 using HeuristicLab. Encodings.PermutationEncoding;26 using HeuristicLab.Data; 24 27 using HeuristicLab.Parameters; 25 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using System;28 using System.Collections.Generic;29 29 30 30 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { … … 35 35 get { return (IValueParameter<IntValue>)Parameters["Lambda"]; } 36 36 } 37 37 38 38 [StorableConstructor] 39 39 private AlbaLambdaInterchangeManipulator(bool deserializing) : base(deserializing) { } 40 40 private AlbaLambdaInterchangeManipulator(AlbaLambdaInterchangeManipulator original, Cloner cloner) : base(original, cloner) { } 41 41 public AlbaLambdaInterchangeManipulator() 42 42 : base() { 43 44 43 Parameters.Add(new ValueParameter<IntValue>("Lambda", "The lambda value.", new IntValue(1))); 44 } 45 45 46 public static void Apply(AlbaEncoding individual, int tour1Index, int position1, int length1, 46 public override IDeepCloneable Clone(Cloner cloner) { 47 return new AlbaLambdaInterchangeManipulator(this, cloner); 48 } 49 50 public static void Apply(AlbaEncoding individual, int tour1Index, int position1, int length1, 47 51 int tour2Index, int position2, int length2) { 48 52 List<Tour> tours = individual.GetTours(); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaManipulator.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.Alba { … … 37 36 [StorableConstructor] 38 37 protected AlbaManipulator(bool deserializing) : base(deserializing) { } 39 38 protected AlbaManipulator(AlbaManipulator original, Cloner cloner) : base(original, cloner) { } 40 39 public AlbaManipulator() 41 40 : base() { 42 41 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 43 42 44 43 AlbaEncoding.RemoveUnusedParameters(Parameters); 45 44 } 46 45 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaPermutationManipulator.cs
r4416 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.Alba { … … 36 36 [StorableConstructor] 37 37 private AlbaPermutationManipualtor(bool deserializing) : base(deserializing) { } 38 38 private AlbaPermutationManipualtor(AlbaPermutationManipualtor original, Cloner cloner) : base(original, cloner) { } 39 39 public AlbaPermutationManipualtor() 40 40 : base() { 41 Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("InnerManipulator", "The permutation manipulator.", new TranslocationManipulator())); 41 Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("InnerManipulator", "The permutation manipulator.", new TranslocationManipulator())); 42 } 43 44 public override IDeepCloneable Clone(Cloner cloner) { 45 return new AlbaPermutationManipualtor(this, cloner); 42 46 } 43 47 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveMaker.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 60 61 get { return (ILookupParameter<DoubleValue>)Parameters["Tardiness"]; } 61 62 } 62 63 63 64 [StorableConstructor] 64 65 protected AlbaMoveMaker(bool deserializing) : base(deserializing) { } 65 66 protected AlbaMoveMaker(AlbaMoveMaker original, Cloner cloner) : base(original, cloner) { } 66 67 public AlbaMoveMaker() 67 68 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveOperator.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.PermutationEncoding;24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Data;26 using HeuristicLab.Parameters;27 25 28 26 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { 29 27 [Item("AlbaMoveOperator", "A move operator for an Alba VRP representation.")] 30 28 [StorableClass] 31 public abstract class AlbaMoveOperator : VRPMoveOperator { 29 public abstract class AlbaMoveOperator : VRPMoveOperator { 32 30 [StorableConstructor] 33 31 protected AlbaMoveOperator(bool deserializing) : base(deserializing) { } 34 35 public AlbaMoveOperator() : base()36 {32 protected AlbaMoveOperator(AlbaMoveOperator original, Cloner cloner) : base(original, cloner) { } 33 public AlbaMoveOperator() 34 : base() { 37 35 AlbaEncoding.RemoveUnusedParameters(Parameters); 38 36 } … … 41 39 IVRPEncoding solution = VRPToursParameter.ActualValue; 42 40 if (!(solution is AlbaEncoding)) { 43 VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value, 41 VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value, 44 42 DistanceMatrixParameter); 45 43 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaPermutationMoveOperator.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.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Data;26 using HeuristicLab.Parameters;27 26 28 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { 29 28 [Item("AlbaPermutationMoveOperator", "A move operator for an Alba VRP representation using an inner permutation move operator.")] 30 29 [StorableClass] 31 public abstract class AlbaPermutationMoveOperator : AlbaMoveOperator { 30 public abstract class AlbaPermutationMoveOperator : AlbaMoveOperator { 32 31 [Storable] 33 32 protected abstract IPermutationMoveOperator PermutationMoveOperatorParameter { get; set; } … … 35 34 [StorableConstructor] 36 35 protected AlbaPermutationMoveOperator(bool deserializing) : base(deserializing) { } 37 36 protected AlbaPermutationMoveOperator(AlbaPermutationMoveOperator original, Cloner cloner) : base(original, cloner) { } 38 37 public AlbaPermutationMoveOperator() 39 : base() 40 { 38 : base() { 41 39 } 42 40 43 41 public override IOperation Apply() { 44 42 IOperation next = base.Apply(); 45 43 46 44 IVRPEncoding solution = VRPToursParameter.ActualValue; 47 45 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/Interfaces/IAlbaIntraRouteInversionMoveOperator.cs
r4352 r4722 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.PermutationEncoding;24 using HeuristicLab.Optimization;25 23 26 24 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/Interfaces/IAlbaLambdaInterchangeMoveOperator.cs
r4352 r4722 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.PermutationEncoding;24 using HeuristicLab.Optimization;25 23 26 24 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/Interfaces/IAlbaTranslocationMoveOperator.cs
r4204 r4722 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Encodings.PermutationEncoding; 24 using HeuristicLab.Optimization;25 24 26 25 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaExhaustiveIntraRouteInversionMoveGenerator.cs
r4352 r4722 20 20 #endregion 21 21 22 using System; 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Optimization; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;27 using HeuristicLab.Parameters;28 using System.Collections.Generic;29 27 30 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { … … 34 32 [StorableConstructor] 35 33 private AlbaExhaustiveIntraRouteInversionGenerator(bool deserializing) : base(deserializing) { } 36 34 private AlbaExhaustiveIntraRouteInversionGenerator(AlbaExhaustiveIntraRouteInversionGenerator original, Cloner cloner) : base(original, cloner) { } 37 35 public AlbaExhaustiveIntraRouteInversionGenerator() 38 36 : base() { 37 } 38 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new AlbaExhaustiveIntraRouteInversionGenerator(this, cloner); 39 41 } 40 42 … … 44 46 int currentTourStart = 0; 45 47 int currentTourEnd = 0; 46 while (currentTourEnd != individual.Length) {48 while (currentTourEnd != individual.Length) { 47 49 currentTourEnd = currentTourStart; 48 while (individual[currentTourEnd] < individual.Cities && 50 while (individual[currentTourEnd] < individual.Cities && 49 51 currentTourEnd < individual.Length) { 50 52 currentTourEnd++; … … 53 55 int tourLength = currentTourEnd - currentTourStart; 54 56 if (tourLength >= 4) { 55 for (int i = 0; i <= tourLength - 4; i++ 57 for (int i = 0; i <= tourLength - 4; i++) { 56 58 for (int j = i + 2; j <= tourLength - 2; j++) { 57 59 AlbaIntraRouteInversionMove move = new AlbaIntraRouteInversionMove( 58 currentTourStart + i, 59 currentTourStart + j, 60 currentTourStart + i, 61 currentTourStart + j, 60 62 individual); 61 63 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionEvaluator.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.Data; 24 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 27 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba; 27 using HeuristicLab.Data;28 28 29 29 namespace HeuristicLab.Problems.VehicleRouting { … … 37 37 [StorableConstructor] 38 38 private AlbaIntraRouteInversionMoveEvaluator(bool deserializing) : base(deserializing) { } 39 39 private AlbaIntraRouteInversionMoveEvaluator(AlbaIntraRouteInversionMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 40 40 public AlbaIntraRouteInversionMoveEvaluator() 41 41 : base() { 42 Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The move to evaluate.")); 42 Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The move to evaluate.")); 43 } 44 45 public override IDeepCloneable Clone(Cloner cloner) { 46 return new AlbaIntraRouteInversionMoveEvaluator(this, cloner); 43 47 } 44 48 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMove.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.PermutationEncoding; 23 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 using HeuristicLab.Encodings.PermutationEncoding;25 using HeuristicLab.Common;26 27 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 27 using HeuristicLab.Data;28 28 29 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { … … 32 32 public class AlbaIntraRouteInversionMove : TwoIndexMove, IVRPMove { 33 33 public IVRPEncoding Individual { get { return Permutation as AlbaEncoding; } } 34 34 35 [StorableConstructor] 36 protected AlbaIntraRouteInversionMove(bool deserializing) : base(deserializing) { } 37 protected AlbaIntraRouteInversionMove(AlbaIntraRouteInversionMove original, Cloner cloner) 38 : base(original, cloner) { 39 Permutation = cloner.Clone(original.Permutation); 40 } 35 41 public AlbaIntraRouteInversionMove() 36 42 : base() { … … 43 49 public AlbaIntraRouteInversionMove(int index1, int index2, AlbaEncoding permutation) 44 50 : base(index1, index2, permutation) { 45 51 this.Permutation = permutation.Clone() as AlbaEncoding; 46 52 } 47 53 48 public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) { 49 AlbaIntraRouteInversionMove clone = new AlbaIntraRouteInversionMove( 50 Index1, Index2); 51 52 if (Permutation != null) 53 clone.Permutation = (AlbaEncoding)cloner.Clone(Permutation); 54 55 cloner.RegisterClonedObject(this, clone); 56 return clone; 54 public override IDeepCloneable Clone(Cloner cloner) { 55 return new AlbaIntraRouteInversionMove(this, cloner); 57 56 } 58 57 … … 61 60 public TourEvaluation GetMoveQuality( 62 61 IntValue vehicles, 63 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 62 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 64 63 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, 65 64 DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, 66 65 DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 67 66 ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) { 68 69 70 71 67 return AlbaIntraRouteInversionMoveEvaluator.GetMoveQuality(Permutation as AlbaEncoding, this, vehicles, 68 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 69 coordinates, fleetUsageFactor, timeFactor, distanceFactor, 70 overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix); 72 71 } 73 72 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMoveGenerator.cs
r4352 r4722 20 20 #endregion 21 21 22 using System;22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Optimization; 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;27 using HeuristicLab.Parameters;28 using System.Collections.Generic;29 27 30 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { … … 42 40 [StorableConstructor] 43 41 protected AlbaIntraRouteInversionMoveGenerator(bool deserializing) : base(deserializing) { } 44 42 protected AlbaIntraRouteInversionMoveGenerator(AlbaIntraRouteInversionMoveGenerator original, Cloner cloner) : base(original, cloner) { } 45 43 public AlbaIntraRouteInversionMoveGenerator() 46 44 : base() { 47 48 45 Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The moves that should be generated in subscopes.")); 46 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes.")); 49 47 } 50 48 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMoveMaker.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; 24 using HeuristicLab.Operators;25 25 using HeuristicLab.Optimization; 26 26 using HeuristicLab.Parameters; … … 45 45 46 46 [StorableConstructor] 47 pr ivateAlbaIntraRouteInversionMoveMaker(bool deserializing) : base(deserializing) { }48 47 protected AlbaIntraRouteInversionMoveMaker(bool deserializing) : base(deserializing) { } 48 protected AlbaIntraRouteInversionMoveMaker(AlbaIntraRouteInversionMoveMaker original, Cloner cloner) : base(original, cloner) { } 49 49 public AlbaIntraRouteInversionMoveMaker() 50 50 : base() { … … 52 52 Parameters.Add(new LookupParameter<AlbaIntraRouteInversionMove>("AlbaIntraRouteInversionMove", "The move to make.")); 53 53 Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move.")); 54 } 55 56 public override IDeepCloneable Clone(Cloner cloner) { 57 return new AlbaIntraRouteInversionMoveMaker(this, cloner); 54 58 } 55 59 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaStochasticIntraRouteInversionMutliMoveGenerator.cs
r4352 r4722 20 20 #endregion 21 21 22 using System;22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Optimization; 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;27 using HeuristicLab.Parameters;28 using System.Collections.Generic;29 using HeuristicLab.Data;30 28 31 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { … … 40 38 get { return (IValueLookupParameter<IntValue>)Parameters["SampleSize"]; } 41 39 } 42 40 43 41 [StorableConstructor] 44 42 private AlbaStochasticIntraRouteInversionMultiMoveGenerator(bool deserializing) : base(deserializing) { } 45 43 private AlbaStochasticIntraRouteInversionMultiMoveGenerator(AlbaStochasticIntraRouteInversionMultiMoveGenerator original, Cloner cloner) : base(original, cloner) { } 46 44 public AlbaStochasticIntraRouteInversionMultiMoveGenerator() 47 45 : base() { 48 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); 49 Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate.")); 46 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); 47 Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate.")); 48 } 49 50 public override IDeepCloneable Clone(Cloner cloner) { 51 return new AlbaStochasticIntraRouteInversionMultiMoveGenerator(this, cloner); 50 52 } 51 53 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaStochasticIntraRouteInversionSingleMoveGenerator.cs
r4352 r4722 20 20 #endregion 21 21 22 using System; 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Optimization; 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;27 using HeuristicLab.Parameters;28 using System.Collections.Generic;29 28 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 30 29 … … 41 40 42 41 #endregion 43 42 44 43 public ILookupParameter<IRandom> RandomParameter { 45 44 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } 46 45 } 47 46 48 47 [StorableConstructor] 49 48 private AlbaStochasticIntraRouteInversionSingleMoveGenerator(bool deserializing) : base(deserializing) { } 50 49 private AlbaStochasticIntraRouteInversionSingleMoveGenerator(AlbaStochasticIntraRouteInversionSingleMoveGenerator original, Cloner cloner) : base(original, cloner) { } 51 50 public AlbaStochasticIntraRouteInversionSingleMoveGenerator() 52 51 : base() { 53 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); 52 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); 53 } 54 55 public override IDeepCloneable Clone(Cloner cloner) { 56 return new AlbaStochasticIntraRouteInversionSingleMoveGenerator(this, cloner); 54 57 } 55 58 … … 75 78 76 79 int currentTourEnd = currentTourStart; 77 while (currentTourEnd < individual.Length && 80 while (currentTourEnd < individual.Length && 78 81 individual[currentTourEnd] < individual.Cities) { 79 82 currentTourEnd++; … … 93 96 94 97 AlbaIntraRouteInversionMove move = Apply(individual, Cities, RandomParameter.ActualValue); 95 if (move != null)98 if (move != null) 96 99 moves.Add(move); 97 100 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaExhaustiveLambdaInterchangeMoveGenerator.cs
r4352 r4722 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 23 25 using HeuristicLab.Core; 24 26 using HeuristicLab.Optimization; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;27 using HeuristicLab.Parameters;28 using System.Collections.Generic;29 28 30 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { … … 34 33 [StorableConstructor] 35 34 private AlbaExhaustiveLambdaInterchangeMoveGenerator(bool deserializing) : base(deserializing) { } 36 37 public AlbaExhaustiveLambdaInterchangeMoveGenerator() 38 : base() { 35 private AlbaExhaustiveLambdaInterchangeMoveGenerator(AlbaExhaustiveLambdaInterchangeMoveGenerator original, Cloner cloner) : base(original, cloner) { } 36 public AlbaExhaustiveLambdaInterchangeMoveGenerator() : base() { } 37 public override IDeepCloneable Clone(Cloner cloner) { 38 return new AlbaExhaustiveLambdaInterchangeMoveGenerator(this, cloner); 39 39 } 40 40 … … 50 50 51 51 for (int length1 = 0; length1 <= Math.Min(lambda, tour1.Cities.Count); length1++) { 52 for (int length2 = 0; length2 <= Math.Min(lambda, tour2.Cities.Count); length2++) {53 if (length1 != 0 || length2 != 0) {54 for (int index1 = 0; index1 < tour1.Cities.Count - length1 + 1; index1++) {55 for (int index2 = 0; index2 < tour2.Cities.Count - length2 + 1; index2++) {56 moves.Add(new AlbaLambdaInterchangeMove(tour1Index, index1, length1, 52 for (int length2 = 0; length2 <= Math.Min(lambda, tour2.Cities.Count); length2++) { 53 if (length1 != 0 || length2 != 0) { 54 for (int index1 = 0; index1 < tour1.Cities.Count - length1 + 1; index1++) { 55 for (int index2 = 0; index2 < tour2.Cities.Count - length2 + 1; index2++) { 56 moves.Add(new AlbaLambdaInterchangeMove(tour1Index, index1, length1, 57 57 tour2Index, index2, length2, individual)); 58 58 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMove.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 23 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 using HeuristicLab.Encodings.PermutationEncoding;25 using HeuristicLab.Common;26 using System.Collections.Generic;27 26 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 28 using HeuristicLab.Data;29 27 30 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { 31 29 [Item("InversionMove", "Item that describes a lambda move on a VRP representation. It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")] 32 30 [StorableClass] 33 public class AlbaLambdaInterchangeMove : Item, IVRPMove {31 public class AlbaLambdaInterchangeMove : Item, IVRPMove { 34 32 [Storable] 35 33 public IVRPEncoding Individual { get; protected set; } 36 34 37 35 [Storable] 38 36 public int Tour1 { get; protected set; } … … 52 50 [Storable] 53 51 public int Length2 { get; protected set; } 54 55 public AlbaLambdaInterchangeMove(): base() { 52 53 [StorableConstructor] 54 protected AlbaLambdaInterchangeMove(bool deserializing) : base(deserializing) { } 55 protected AlbaLambdaInterchangeMove(AlbaLambdaInterchangeMove original, Cloner cloner) 56 : base(original, cloner) { 57 Tour1 = original.Tour1; 58 Position1 = original.Position1; 59 Length1 = original.Length1; 60 61 Tour2 = original.Tour2; 62 Position2 = original.Position2; 63 Length2 = original.Length2; 64 65 Individual = cloner.Clone(original.Individual); 66 } 67 public override IDeepCloneable Clone(Cloner cloner) { 68 return new AlbaLambdaInterchangeMove(this, cloner); 69 } 70 71 public AlbaLambdaInterchangeMove() 72 : base() { 56 73 Tour1 = -1; 57 74 Position1 = -1; … … 65 82 } 66 83 67 public AlbaLambdaInterchangeMove(int tour1, int position1, int length1, 84 public AlbaLambdaInterchangeMove(int tour1, int position1, int length1, 68 85 int tour2, int position2, int length2, AlbaEncoding permutation) { 69 70 71 86 Tour1 = tour1; 87 Position1 = position1; 88 Length1 = length1; 72 89 73 74 75 90 Tour2 = tour2; 91 Position2 = position2; 92 Length2 = length2; 76 93 77 this.Individual = permutation.Clone() as AlbaEncoding; 78 } 79 80 public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) { 81 AlbaLambdaInterchangeMove clone = new AlbaLambdaInterchangeMove(); 82 83 clone.Tour1 = Tour1; 84 clone.Position1 = Position1; 85 clone.Length1 = Length1; 86 87 clone.Tour2 = Tour2; 88 clone.Position2 = Position2; 89 clone.Length2 = Length2; 90 91 if (Individual != null) 92 clone.Individual = (AlbaEncoding)cloner.Clone(Individual); 93 94 cloner.RegisterClonedObject(this, clone); 95 return clone; 94 this.Individual = permutation.Clone() as AlbaEncoding; 96 95 } 97 96 … … 100 99 public TourEvaluation GetMoveQuality( 101 100 IntValue vehicles, 102 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 101 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, 103 102 DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates, 104 103 DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, 105 104 DoubleValue overloadPenalty, DoubleValue tardinessPenalty, 106 105 ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) { 107 108 109 110 106 return AlbaLambdaInterchangeMoveEvaluator.GetMoveQuality(Individual as AlbaEncoding, this, vehicles, 107 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 108 coordinates, fleetUsageFactor, timeFactor, distanceFactor, 109 overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix); 111 110 } 112 111 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveEvaluator.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.Data; 24 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 27 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba; 27 using HeuristicLab.Data;28 28 29 29 namespace HeuristicLab.Problems.VehicleRouting { … … 37 37 [StorableConstructor] 38 38 private AlbaLambdaInterchangeMoveEvaluator(bool deserializing) : base(deserializing) { } 39 39 private AlbaLambdaInterchangeMoveEvaluator(AlbaLambdaInterchangeMoveEvaluator original, Cloner cloner) 40 : base(original, cloner) { 41 } 40 42 public AlbaLambdaInterchangeMoveEvaluator() 41 43 : base() { … … 43 45 } 44 46 47 public override IDeepCloneable Clone(Cloner cloner) { 48 return new AlbaLambdaInterchangeMoveEvaluator(this, cloner); 49 } 45 50 public static TourEvaluation GetMoveQuality(AlbaEncoding individual, AlbaLambdaInterchangeMove move, 46 51 IntValue vehicles, -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveGenerator.cs
r4352 r4722 20 20 #endregion 21 21 22 using System;22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Optimization; 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;27 using HeuristicLab.Parameters;28 using System.Collections.Generic;29 using HeuristicLab.Data;30 28 31 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { … … 51 49 [StorableConstructor] 52 50 protected AlbaLambdaInterchangeMoveGenerator(bool deserializing) : base(deserializing) { } 53 51 protected AlbaLambdaInterchangeMoveGenerator(AlbaLambdaInterchangeMoveGenerator original, Cloner cloner) 52 : base(original, cloner) { 53 } 54 54 public AlbaLambdaInterchangeMoveGenerator() 55 55 : base() { 56 57 58 56 Parameters.Add(new LookupParameter<AlbaLambdaInterchangeMove>("AlbaLambdaInterchangeMove", "The moves that should be generated in subscopes.")); 57 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes.")); 58 Parameters.Add(new ValueParameter<IntValue>("Lambda", "The lambda value.", new IntValue(1))); 59 59 } 60 60 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveMaker.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; 24 using HeuristicLab.Operators;25 25 using HeuristicLab.Optimization; 26 26 using HeuristicLab.Parameters; 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using System.Collections.Generic;29 28 30 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { … … 46 45 47 46 [StorableConstructor] 48 private AlbaLambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { } 49 47 protected AlbaLambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { } 48 protected AlbaLambdaInterchangeMoveMaker(AlbaLambdaInterchangeMoveMaker original, Cloner cloner) 49 : base(original, cloner) { 50 } 50 51 public AlbaLambdaInterchangeMoveMaker() 51 52 : base() { … … 53 54 Parameters.Add(new LookupParameter<AlbaLambdaInterchangeMove>("AlbaLambdaInterchangeMove", "The move to make.")); 54 55 Parameters.Add(new LookupParameter<DoubleValue>("MoveQuality", "The relative quality of the move.")); 56 } 57 58 public override IDeepCloneable Clone(Cloner cloner) { 59 return new AlbaLambdaInterchangeMoveMaker(this, cloner); 55 60 } 56 61 … … 64 69 public override IOperation Apply() { 65 70 IOperation next = base.Apply(); 66 71 67 72 AlbaLambdaInterchangeMove move = LambdaInterchangeMoveParameter.ActualValue; 68 73 DoubleValue moveQuality = MoveQualityParameter.ActualValue; 69 74 DoubleValue quality = QualityParameter.ActualValue; 70 75 71 76 //perform move 72 77 VRPToursParameter.ActualValue = move.MakeMove(); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaStochasticLambdaInterchangeMutliMoveGenerator.cs
r4352 r4722 20 20 #endregion 21 21 22 using System;22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Optimization; 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;27 using HeuristicLab.Parameters;28 using System.Collections.Generic;29 using HeuristicLab.Data;30 28 31 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba { … … 40 38 get { return (IValueLookupParameter<IntValue>)Parameters["SampleSize"]; } 41 39 } 42 40 43 41 [StorableConstructor] 44 42 private AlbaStochasticLambdaInterchangeMultiMoveGenerator(bool deserializing) : base(deserializing) { } 45 43 private AlbaStochasticLambdaInterchangeMultiMoveGenerator(AlbaStochasticLambdaInterchangeMultiMoveGenerator original, Cloner cloner) : base(original, cloner) { } 46 44 public AlbaStochasticLambdaInterchangeMultiMoveGenerator() 47 45 : base() { 48 49 46 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); 47 Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate.")); 50 48 } 51 49 public override IDeepCloneable Clone(Cloner cloner) { 50 return new AlbaStochasticLambdaInterchangeMultiMoveGenerator(this, cloner); 51 } 52 52 protected override AlbaLambdaInterchangeMove[] GenerateMoves(AlbaEncoding individual, int lambda) { 53 53 int sampleSize = SampleSizeParameter.ActualValue.Value; -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaStochasticLambdaInterchangeSingleMoveGenerator.cs
r4352 r4722 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 23 25 using HeuristicLab.Core; 24 26 using HeuristicLab.Optimization; 27 using HeuristicLab.Parameters; 25 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;27 using HeuristicLab.Parameters;28 using System.Collections.Generic;29 29 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 30 30 … … 41 41 42 42 #endregion 43 43 44 44 public ILookupParameter<IRandom> RandomParameter { 45 45 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } 46 46 } 47 47 48 48 [StorableConstructor] 49 49 private AlbaStochasticLambdaInterchangeSingleMoveGenerator(bool deserializing) : base(deserializing) { } 50 50 private AlbaStochasticLambdaInterchangeSingleMoveGenerator(AlbaStochasticLambdaInterchangeSingleMoveGenerator original, Cloner cloner) 51 : base(original, cloner) { 52 } 51 53 public AlbaStochasticLambdaInterchangeSingleMoveGenerator() 52 54 : base() { 53 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); 55 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); 56 } 57 58 public override IDeepCloneable Clone(Cloner cloner) { 59 return new AlbaStochasticLambdaInterchangeSingleMoveGenerator(this, cloner); 54 60 } 55 61 … … 81 87 82 88 AlbaLambdaInterchangeMove move = Apply(individual, Cities, lambda, RandomParameter.ActualValue); 83 if (move != null)89 if (move != null) 84 90 moves.Add(move); 85 91 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveEvaluator.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.PermutationEncoding; … … 37 38 [StorableConstructor] 38 39 private AlbaTranslocationMoveEvaluator(bool deserializing) : base(deserializing) { } 39 40 private AlbaTranslocationMoveEvaluator(AlbaTranslocationMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 40 41 public AlbaTranslocationMoveEvaluator() 41 42 : base() { 42 43 Parameters.Add(new LookupParameter<TranslocationMove>("TranslocationMove", "The move to evaluate.")); 44 } 45 46 public override IDeepCloneable Clone(Cloner cloner) { 47 return new AlbaTranslocationMoveEvaluator(this, cloner); 43 48 } 44 49 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveGenerator.cs
r4352 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic;22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Data; … … 70 70 [StorableConstructor] 71 71 private AlbaTranslocationMoveGenerator(bool deserializing) : base(deserializing) { } 72 72 private AlbaTranslocationMoveGenerator(AlbaTranslocationMoveGenerator original, Cloner cloner) : base(original, cloner) { } 73 73 public AlbaTranslocationMoveGenerator() 74 74 : base() { … … 78 78 79 79 ((IMultiMoveGenerator)TranslocationMoveGeneratorParameter.Value).SampleSizeParameter.ActualName = SampleSizeParameter.Name; 80 } 81 82 public override IDeepCloneable Clone(Cloner cloner) { 83 return new AlbaTranslocationMoveGenerator(this, cloner); 80 84 } 81 85 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveHardTabuCriterion.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 58 59 [StorableConstructor] 59 60 private AlbaTranslocationMoveHardTabuCriterion(bool deserializing) : base(deserializing) { } 60 61 private AlbaTranslocationMoveHardTabuCriterion(AlbaTranslocationMoveHardTabuCriterion original, Cloner cloner) 62 : base(original, cloner) { 63 } 61 64 public AlbaTranslocationMoveHardTabuCriterion() 62 65 : base() { 63 66 tabuChecker = new TranslocationMoveHardTabuCriterion(); 64 67 } 68 public override IDeepCloneable Clone(Cloner cloner) { 69 return new AlbaTranslocationMoveHardTabuCriterion(this, cloner); 70 } 65 71 } 66 72 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveMaker.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Encodings.PermutationEncoding; 25 using HeuristicLab.Optimization;26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 … … 50 50 [StorableConstructor] 51 51 private AlbaTranslocationMoveMaker(bool deserializing) : base(deserializing) { } 52 52 private AlbaTranslocationMoveMaker(AlbaTranslocationMoveMaker original, Cloner cloner) 53 : base(original, cloner) { 54 } 53 55 public AlbaTranslocationMoveMaker() 54 56 : base() { 55 57 moveMaker = new TranslocationMoveMaker(); 56 58 } 57 59 public override IDeepCloneable Clone(Cloner cloner) { 60 return new AlbaTranslocationMoveMaker(this, cloner); 61 } 58 62 public override IOperation Apply() { 59 63 IOperation next = base.Apply(); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveSoftTabuCriterion.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 58 59 [StorableConstructor] 59 60 private AlbaTranslocationMoveSoftTabuCriterion(bool deserializing) : base(deserializing) { } 60 61 private AlbaTranslocationMoveSoftTabuCriterion(AlbaTranslocationMoveSoftTabuCriterion original, Cloner cloner) 62 : base(original, cloner) { 63 } 61 64 public AlbaTranslocationMoveSoftTabuCriterion() 62 65 : base() { 63 66 tabuChecker = new TranslocationMoveSoftTabuCriterion(); 64 67 } 68 public override IDeepCloneable Clone(Cloner cloner) { 69 return new AlbaTranslocationMoveSoftTabuCriterion(this, cloner); 70 } 65 71 } 66 72 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveTabuMaker.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; … … 58 59 [StorableConstructor] 59 60 private AlbaTranslocationMoveTabuMaker(bool deserializing) : base(deserializing) { } 60 61 private AlbaTranslocationMoveTabuMaker(AlbaTranslocationMoveTabuMaker original, Cloner cloner) 62 : base(original, cloner) { 63 } 61 64 public AlbaTranslocationMoveTabuMaker() 62 65 : base() { 63 66 moveTabuMaker = new TranslocationMoveTabuMaker(); 64 67 } 68 public override IDeepCloneable Clone(Cloner cloner) { 69 return new AlbaTranslocationMoveTabuMaker(this, cloner); 70 } 65 71 } 66 72 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Crossovers/GVRCrossover.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;25 using HeuristicLab.Optimization; 24 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using HeuristicLab.Optimization;28 using System.Collections.Generic;29 28 30 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.GVR { … … 38 37 [StorableConstructor] 39 38 private GVRCrossover(bool deserializing) : base(deserializing) { } 40 39 private GVRCrossover(GVRCrossover original, Cloner cloner) : base(original, cloner) { } 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new GVRCrossover(this, cloner); 42 } 41 43 public GVRCrossover() { 42 44 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 43 44 45 //remove unused parameters 45 46 Parameters.Remove("ReadyTime"); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/GVREncoding.cs
r4352 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.PermutationEncoding;26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using System.Drawing;28 using System.Collections.Generic;29 27 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 30 28 … … 75 73 return tours; 76 74 } 77 78 public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) { 79 GVREncoding clone = new GVREncoding(capacity, demand); 80 cloner.RegisterClonedObject(this, clone); 81 clone.Tours = (ItemList<Tour>)cloner.Clone(this.Tours); 82 83 return clone; 75 76 [StorableConstructor] 77 protected GVREncoding(bool deserializing) : base(deserializing) { } 78 protected GVREncoding(GVREncoding original, Cloner cloner) 79 : base(original, cloner) { 80 this.capacity = original.capacity; 81 this.demand = original.demand; 82 this.Tours = cloner.Clone(original.Tours); 84 83 } 85 84 public override IDeepCloneable Clone(Cloner cloner) { 85 return new GVREncoding(this, cloner); 86 } 86 87 public GVREncoding(DoubleValue capacity, DoubleArray demand) 87 88 : base() { 88 89 this.capacity = capacity; 89 90 this.demand = demand; 90 }91 92 [StorableConstructor]93 private GVREncoding(bool serializing)94 : base() {95 91 } 96 92 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRDisplacementManipulator.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.GVR { … … 33 31 [StorableConstructor] 34 32 private GVRDisplacementManipulator(bool deserializing) : base(deserializing) { } 35 33 private GVRDisplacementManipulator(GVRDisplacementManipulator original, Cloner cloner) : base(original, cloner) { } 34 public override IDeepCloneable Clone(Cloner cloner) { 35 return new GVRDisplacementManipulator(this, cloner); 36 } 36 37 public GVRDisplacementManipulator() 37 38 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRInsertionManipulator.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.GVR { … … 32 30 [StorableConstructor] 33 31 private GVRInsertionManipulator(bool deserializing) : base(deserializing) { } 34 35 public GVRInsertionManipulator()36 : base() {32 private GVRInsertionManipulator(GVRInsertionManipulator original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new GVRInsertionManipulator(this, cloner); 37 35 } 36 public GVRInsertionManipulator() : base() { } 38 37 39 38 protected override void Manipulate(IRandom random, GVREncoding individual) { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRInversionManipulator.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.GVR { … … 32 30 [StorableConstructor] 33 31 private GVRInversionManipulator(bool deserializing) : base(deserializing) { } 34 35 public GVRInversionManipulator()36 : base() {32 private GVRInversionManipulator(GVRInversionManipulator original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new GVRInversionManipulator(this, cloner); 37 35 } 36 public GVRInversionManipulator() : base() { } 38 37 39 38 protected override void Manipulate(IRandom random, GVREncoding individual) { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRManipulator.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.GVR { … … 37 36 [StorableConstructor] 38 37 protected GVRManipulator(bool deserializing) : base(deserializing) { } 39 38 protected GVRManipulator(GVRManipulator original, Cloner cloner) : base(original, cloner) { } 40 39 public GVRManipulator() { 41 40 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/GVR/Manipulators/GVRSwapManipulator.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.GVR { … … 32 30 [StorableConstructor] 33 31 private GVRSwapManipulator(bool deserializing) : base(deserializing) { } 34 32 private GVRSwapManipulator(GVRSwapManipulator original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new GVRSwapManipulator(this, cloner); 35 } 35 36 public GVRSwapManipulator() 36 37 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Creators/DefaultRepresentationCreator.cs
r4183 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 22 24 using HeuristicLab.Core; 23 using HeuristicLab.Data;24 using HeuristicLab.Operators;25 using HeuristicLab.Parameters;26 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using System.Collections.Generic;28 using HeuristicLab.Problems.VehicleRouting.Encodings;29 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;30 26 using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin; 31 27 … … 38 34 [StorableConstructor] 39 35 protected DefaultRepresentationCreator(bool deserializing) : base(deserializing) { } 36 protected DefaultRepresentationCreator(DefaultRepresentationCreator original, Cloner cloner) : base(original, cloner) { } 40 37 41 38 public DefaultRepresentationCreator() : base() { } … … 46 43 47 44 return base.Apply(); 48 } 45 } 49 46 } 50 47 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Creators/MultiVRPSolutionCreator.cs
r4352 r4722 23 23 using System.Linq; 24 24 using HeuristicLab.Collections; 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 27 using HeuristicLab.Data; 26 28 using HeuristicLab.Operators; 27 29 using HeuristicLab.Optimization; … … 29 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 32 using HeuristicLab.PluginInfrastructure; 31 using HeuristicLab.Data;32 33 33 34 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { … … 78 79 79 80 [StorableConstructor] 80 private MultiVRPSolutionCreator(bool deserializing) : base(deserializing) { } 81 protected MultiVRPSolutionCreator(bool deserializing) : base(deserializing) { } 82 protected MultiVRPSolutionCreator(MultiVRPSolutionCreator original, Cloner cloner) : base(original, cloner) { } 83 public override IDeepCloneable Clone(Cloner cloner) { 84 return new MultiVRPSolutionCreator(this, cloner); 85 } 86 81 87 public MultiVRPSolutionCreator() 82 88 : base() { 83 89 Parameters.Add(new LookupParameter<IVRPEncoding>("VRPTours", "The new VRP tours.")); 84 90 85 86 87 88 89 90 91 92 93 94 91 Parameters.Add(new ValueLookupParameter<IntValue>("Cities", "The city count.")); 92 Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The coordinates of the cities.")); 93 Parameters.Add(new LookupParameter<DoubleMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities.")); 94 Parameters.Add(new LookupParameter<BoolValue>("UseDistanceMatrix", "True if a distance matrix should be calculated and used for evaluation, otherwise false.")); 95 Parameters.Add(new LookupParameter<IntValue>("Vehicles", "The number of vehicles.")); 96 Parameters.Add(new LookupParameter<DoubleValue>("Capacity", "The capacity of each vehicle.")); 97 Parameters.Add(new LookupParameter<DoubleArray>("Demand", "The demand of each customer.")); 98 Parameters.Add(new LookupParameter<DoubleArray>("ReadyTime", "The ready time of each customer.")); 99 Parameters.Add(new LookupParameter<DoubleArray>("DueTime", "The due time of each customer.")); 100 Parameters.Add(new LookupParameter<DoubleArray>("ServiceTime", "The service time of each customer.")); 95 101 96 97 98 102 foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(IVRPCreator)).OrderBy(op => op.Name)) { 103 if (!typeof(MultiOperator<IVRPCreator>).IsAssignableFrom(type)) 104 Operators.Add((IVRPCreator)Activator.CreateInstance(type), true); 99 105 } 100 106 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Creators/PushForwardInsertionCreator.cs
r4352 r4722 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; 26 using HeuristicLab.Encodings.PermutationEncoding;27 27 using HeuristicLab.Optimization; 28 28 using HeuristicLab.Parameters; … … 60 60 [StorableConstructor] 61 61 private PushForwardCreator(bool deserializing) : base(deserializing) { } 62 private PushForwardCreator(PushForwardCreator original, Cloner cloner) : base(original, cloner) { } 63 public override IDeepCloneable Clone(Cloner cloner) { 64 return new PushForwardCreator(this, cloner); 65 } 62 66 63 67 public PushForwardCreator() -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Creators/RandomCreator.cs
r4183 r4722 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Data;26 using HeuristicLab.Encodings.PermutationEncoding;27 25 using HeuristicLab.Optimization; 28 26 using HeuristicLab.Parameters; … … 41 39 [StorableConstructor] 42 40 private RandomCreator(bool deserializing) : base(deserializing) { } 41 private RandomCreator(RandomCreator original, Cloner cloner) : base(original, cloner) { } 42 public override IDeepCloneable Clone(Cloner cloner) { 43 return new RandomCreator(this, cloner); 44 } 43 45 44 46 public RandomCreator() -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Crossovers/MultiVRPSolutionCrossover.cs
r4352 r4722 23 23 using System.Linq; 24 24 using HeuristicLab.Collections; 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 27 using HeuristicLab.Data; 26 28 using HeuristicLab.Operators; 27 29 using HeuristicLab.Optimization; … … 29 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 32 using HeuristicLab.PluginInfrastructure; 31 using HeuristicLab.Data;32 33 33 34 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { … … 82 83 83 84 [StorableConstructor] 84 private MultiVRPSolutionCrossover(bool deserializing) : base(deserializing) { } 85 protected MultiVRPSolutionCrossover(bool deserializing) : base(deserializing) { } 86 protected MultiVRPSolutionCrossover(MultiVRPSolutionCrossover original, Cloner cloner) : base(original, cloner) { } 87 public override IDeepCloneable Clone(Cloner cloner) { 88 return new MultiVRPSolutionCrossover(this, cloner); 89 } 85 90 public MultiVRPSolutionCrossover() 86 91 : base() { 87 92 Parameters.Add(new ScopeTreeLookupParameter<IVRPEncoding>("Parents", "The parent permutations which should be crossed.")); 88 93 ParentsParameter.ActualName = "VRPTours"; 89 94 Parameters.Add(new LookupParameter<IVRPEncoding>("Child", "The child permutation resulting from the crossover.")); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Crossovers/RandomParentCloneCrossover.cs
r4352 r4722 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 22 using HeuristicLab.Common; 26 23 using HeuristicLab.Core; 27 24 using HeuristicLab.Optimization; … … 39 36 [StorableConstructor] 40 37 private RandomParentCloneCrossover(bool deserializing) : base(deserializing) { } 38 private RandomParentCloneCrossover(RandomParentCloneCrossover original, Cloner cloner) : base(original, cloner) { } 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new RandomParentCloneCrossover(this, cloner); 41 } 42 41 43 42 44 public RandomParentCloneCrossover() … … 54 56 Parameters.Remove("ServiceTime"); 55 57 } 56 58 57 59 public override IOperation Apply() { 58 60 if (RandomParameter.ActualValue.Next() < 0.5) -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Manipulators/MultiVRPSolutionManipulator.cs
r4352 r4722 23 23 using System.Linq; 24 24 using HeuristicLab.Collections; 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 27 using HeuristicLab.Data; 26 28 using HeuristicLab.Operators; 27 29 using HeuristicLab.Optimization; … … 29 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 32 using HeuristicLab.PluginInfrastructure; 31 using HeuristicLab.Data;32 33 33 34 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { … … 78 79 79 80 [StorableConstructor] 80 private MultiVRPSolutionManipulator(bool deserializing) : base(deserializing) { } 81 protected MultiVRPSolutionManipulator(bool deserializing) : base(deserializing) { } 82 protected MultiVRPSolutionManipulator(MultiVRPSolutionManipulator original, Cloner cloner) : base(original, cloner) { } 83 public override IDeepCloneable Clone(Cloner cloner) { 84 return new MultiVRPSolutionManipulator(this, cloner); 85 } 81 86 public MultiVRPSolutionManipulator() 82 87 : base() { … … 97 102 if (!typeof(MultiOperator<IVRPManipulator>).IsAssignableFrom(type)) { 98 103 IVRPManipulator op = (IVRPManipulator)Activator.CreateInstance(type); 99 bool operatorChecked = true; 100 if (op is HeuristicLab.Problems.VehicleRouting.Encodings.Potvin.PotvinLocalSearchManipulator ||104 bool operatorChecked = true; 105 if (op is HeuristicLab.Problems.VehicleRouting.Encodings.Potvin.PotvinLocalSearchManipulator || 101 106 op is HeuristicLab.Problems.VehicleRouting.Encodings.Prins.PrinsLSManipulator) 102 107 operatorChecked = false; -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/Interfaces/IMultiVRPMoveGenerator.cs
r4205 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Core;23 using HeuristicLab.Encodings.PermutationEncoding;24 22 using HeuristicLab.Optimization; 25 23 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/Interfaces/IMultiVRPMoveOperator.cs
r4205 r4722 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.PermutationEncoding;24 using HeuristicLab.Optimization;25 23 26 24 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/Interfaces/IVRPMove.cs
r4352 r4722 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.PermutationEncoding;24 using HeuristicLab.Optimization;25 23 using HeuristicLab.Data; 26 24 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveEvaluator.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Encodings.PermutationEncoding;24 24 using HeuristicLab.Parameters; 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 36 36 [StorableConstructor] 37 37 private MultiVRPMoveEvaluator(bool deserializing) : base(deserializing) { } 38 private MultiVRPMoveEvaluator(MultiVRPMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new MultiVRPMoveEvaluator(this, cloner); 41 } 38 42 39 43 public MultiVRPMoveEvaluator() 40 44 : base() { 41 45 Parameters.Add(new LookupParameter<IVRPMove>("VRPMove", "The generated moves.")); 42 46 } 43 47 … … 53 57 CapacityParameter.ActualValue, 54 58 CoordinatesParameter.ActualValue, 55 FleetUsageFactor.ActualValue, 56 TimeFactor.ActualValue, 57 DistanceFactor.ActualValue, 58 OverloadPenalty.ActualValue, 59 FleetUsageFactor.ActualValue, 60 TimeFactor.ActualValue, 61 DistanceFactor.ActualValue, 62 OverloadPenalty.ActualValue, 59 63 TardinessPenalty.ActualValue, 60 64 DistanceMatrixParameter, -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveGenerator.cs
r4352 r4722 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using HeuristicLab.Collections; 26 using HeuristicLab.Common; 25 27 using HeuristicLab.Core; 28 using HeuristicLab.Data; 26 29 using HeuristicLab.Operators; 27 30 using HeuristicLab.Optimization; … … 29 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 33 using HeuristicLab.PluginInfrastructure; 31 using HeuristicLab.Data;32 using System.Collections.Generic;33 34 34 35 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { 35 36 [Item("MultiVRPMoveGenerator", "Randomly selects and applies its move generators.")] 36 37 [StorableClass] 37 public class MultiVRPMoveGenerator : CheckedMultiOperator<IMultiVRPMoveGenerator>, IMultiVRPMoveOperator, 38 public class MultiVRPMoveGenerator : CheckedMultiOperator<IMultiVRPMoveGenerator>, IMultiVRPMoveOperator, 38 39 IStochasticOperator, IMultiMoveGenerator { 39 40 public override bool CanChangeName { … … 97 98 98 99 [StorableConstructor] 99 private MultiVRPMoveGenerator(bool deserializing) : base(deserializing) { } 100 protected MultiVRPMoveGenerator(bool deserializing) : base(deserializing) { } 101 protected MultiVRPMoveGenerator(MultiVRPMoveGenerator original, Cloner cloner) : base(original, cloner) { } 102 public override IDeepCloneable Clone(Cloner cloner) { 103 return new MultiVRPMoveGenerator(this, cloner); 104 } 100 105 public MultiVRPMoveGenerator() 101 106 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveMaker.cs
r4416 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; 24 using HeuristicLab.Operators;25 25 using HeuristicLab.Optimization; 26 26 using HeuristicLab.Parameters; 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using System.Collections.Generic;29 28 30 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General {29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { 31 30 [Item("MultiVRPMoveMaker", "Peforms multiple moves on a given VRP encoding and updates the quality.")] 32 31 [StorableClass] … … 81 80 82 81 [StorableConstructor] 83 private LambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { } 82 protected LambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { } 83 protected LambdaInterchangeMoveMaker(LambdaInterchangeMoveMaker original, Cloner cloner) : base(original, cloner) { } 84 public override IDeepCloneable Clone(Cloner cloner) { 85 return new LambdaInterchangeMoveMaker(this, cloner); 86 } 84 87 85 88 public LambdaInterchangeMoveMaker() … … 112 115 DoubleValue moveQuality = MoveQualityParameter.ActualValue; 113 116 DoubleValue quality = QualityParameter.ActualValue; 114 117 115 118 //perform move 116 119 VRPToursParameter.ActualValue = move.MakeMove(); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/PermutationEncoding.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 using HeuristicLab.Problems.VehicleRouting.Encodings.General;29 using System;30 29 31 30 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { … … 48 47 : base() { 49 48 } 49 protected PermutationEncoding(PermutationEncoding original, Cloner cloner) 50 : base(original, cloner) { 51 } 52 50 53 51 54 public int IndexOf(int city) { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/TourEncoding.cs
r4352 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 23 using System.Drawing; 22 24 using HeuristicLab.Common; 23 25 using HeuristicLab.Core; 24 26 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.PermutationEncoding;26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using System.Drawing;28 using System.Collections.Generic;29 28 30 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.General { … … 35 34 get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Class; } 36 35 } 37 36 38 37 #region IVRPEncoding Members 39 38 public virtual List<Tour> GetTours(ILookupParameter<DoubleMatrix> distanceMatrix = null, int maxVehicles = int.MaxValue) { … … 51 50 52 51 public int Cities { 53 get 54 { 52 get { 55 53 int cities = 0; 56 54 … … 75 73 : base() { 76 74 } 75 protected TourEncoding(TourEncoding original, Cloner cloner) 76 : base(original, cloner) { 77 } 77 78 78 79 public static void ConvertFrom(IVRPEncoding encoding, TourEncoding solution, ILookupParameter<DoubleMatrix> distanceMatrix) { … … 82 83 public static void ConvertFrom(List<int> route, TourEncoding solution) { 83 84 solution.Tours = new ItemList<Tour>(); 84 85 85 86 Tour tour = new Tour(); 86 87 for (int i = 0; i < route.Count; i++) { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinCrossover.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;25 using HeuristicLab.Optimization; 24 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using HeuristicLab.Optimization;28 using System.Collections.Generic;29 28 30 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 38 37 [StorableConstructor] 39 38 protected PotvinCrossover(bool deserializing) : base(deserializing) { } 39 protected PotvinCrossover(PotvinCrossover original, Cloner cloner) 40 : base(original, cloner) { 41 } 40 42 41 43 public PotvinCrossover() { … … 68 70 protected bool Repair(IRandom random, PotvinEncoding solution, Tour newTour) { 69 71 bool success = true; 70 72 71 73 //remove duplicates from new tour 72 74 for (int i = 0; i < newTour.Cities.Count; i++) { … … 80 82 } 81 83 } 82 while (newTour.Cities.Contains(0))84 while (newTour.Cities.Contains(0)) 83 85 newTour.Cities.Remove(0); 84 86 … … 108 110 109 111 int route, place; 110 if (FindInsertionPlace(solution, unrouted, out route, out place)) {112 if (FindInsertionPlace(solution, unrouted, out route, out place)) { 111 113 solution.Tours[route].Cities.Insert(place, unrouted); 112 114 } else { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinRouteBasedCrossover.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.Potvin { … … 32 30 [StorableConstructor] 33 31 private PotvinRouteBasedCrossover(bool deserializing) : base(deserializing) { } 34 32 private PotvinRouteBasedCrossover(PotvinRouteBasedCrossover original, Cloner cloner) 33 : base(original, cloner) { 34 } 35 public override IDeepCloneable Clone(Cloner cloner) { 36 return new PotvinRouteBasedCrossover(this, cloner); 37 } 35 38 public PotvinRouteBasedCrossover() 36 39 : base() { } 37 40 38 41 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 39 42 PotvinEncoding child = parent2.Clone() as PotvinEncoding; … … 55 58 return child; 56 59 else { 57 if (random.NextDouble() < 0.5)60 if (random.NextDouble() < 0.5) 58 61 return parent1.Clone() as PotvinEncoding; 59 62 else -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinSequenceBasedCrossover.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.Potvin { … … 32 30 [StorableConstructor] 33 31 private PotvinSequenceBasedCrossover(bool deserializing) : base(deserializing) { } 32 private PotvinSequenceBasedCrossover(PotvinSequenceBasedCrossover original, Cloner cloner) 33 : base(original, cloner) { 34 } 35 public override IDeepCloneable Clone(Cloner cloner) { 36 return new PotvinSequenceBasedCrossover(this, cloner); 37 } 34 38 35 39 public PotvinSequenceBasedCrossover() 36 40 : base() { } 37 41 38 42 protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) { 39 43 PotvinEncoding child = parent1.Clone() as PotvinEncoding; -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/PotvinLocalSearchManipulator.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;25 using HeuristicLab.Data; 24 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using System.Collections.Generic;28 28 29 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 37 37 [StorableConstructor] 38 38 private PotvinLocalSearchManipulator(bool deserializing) : base(deserializing) { } 39 40 public PotvinLocalSearchManipulator() : base() { 39 private PotvinLocalSearchManipulator(PotvinLocalSearchManipulator original, Cloner cloner) 40 : base(original, cloner) { 41 } 42 public override IDeepCloneable Clone(Cloner cloner) { 43 return new PotvinLocalSearchManipulator(this, cloner); 44 } 45 public PotvinLocalSearchManipulator() 46 : base() { 41 47 Parameters.Add(new ValueParameter<IntValue>("Iterations", "The number of max iterations.", new IntValue(100))); 42 48 } … … 71 77 } 72 78 individual.Tours[currentTour].Cities.RemoveRange(currentCity, length); 73 79 74 80 currentCity++; 75 81 } … … 106 112 individual.Tours[insertionTour].Cities.InsertRange( 107 113 insertionPlace, 108 toBeInserted); 114 toBeInserted); 109 115 } 110 116 city++; … … 115 121 } 116 122 iterations++; 117 } while (insertionFound && 123 } while (insertionFound && 118 124 iterations < Iterations.Value.Value); 119 125 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/PotvinManipulator.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.Potvin { … … 37 36 [StorableConstructor] 38 37 protected PotvinManipulator(bool deserializing) : base(deserializing) { } 39 38 protected PotvinManipulator(PotvinManipulator original, Cloner cloner) 39 : base(original, cloner) { 40 } 40 41 public PotvinManipulator() { 41 42 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); … … 73 74 protected bool FindInsertionPlace(PotvinEncoding individual, int city, int routeToAvoid, out int route, out int place) { 74 75 return individual.FindInsertionPlace( 75 DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue, 76 DemandParameter.ActualValue, CapacityParameter.ActualValue, CoordinatesParameter.ActualValue, 76 DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue, 77 DemandParameter.ActualValue, CapacityParameter.ActualValue, CoordinatesParameter.ActualValue, 77 78 DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue, 78 79 city, routeToAvoid, out route, out place); 79 80 } 80 81 81 82 public override IOperation Apply() { 82 83 IVRPEncoding solution = VRPToursParameter.ActualValue; … … 84 85 VRPToursParameter.ActualValue = PotvinEncoding.ConvertFrom(solution, DistanceMatrixParameter); 85 86 } 86 87 87 88 Manipulate(RandomParameter.ActualValue, VRPToursParameter.ActualValue as PotvinEncoding); 88 89 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/PotvinOneLevelExchangeManipulator.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.Potvin { … … 33 31 [StorableConstructor] 34 32 private PotvinOneLevelExchangeMainpulator(bool deserializing) : base(deserializing) { } 33 private PotvinOneLevelExchangeMainpulator(PotvinOneLevelExchangeMainpulator original, Cloner cloner) 34 : base(original, cloner) { 35 } 36 public override IDeepCloneable Clone(Cloner cloner) { 37 return new PotvinOneLevelExchangeMainpulator(this, cloner); 38 } 39 public PotvinOneLevelExchangeMainpulator() : base() { } 35 40 36 public PotvinOneLevelExchangeMainpulator() : base() { }37 38 41 protected override void Manipulate(IRandom random, PotvinEncoding individual) { 39 42 int selectedIndex = SelectRandomTourBiasedByLength(random, individual); … … 52 55 53 56 route1.Cities.RemoveAll( 54 new System.Predicate<int>( 57 new System.Predicate<int>( 55 58 delegate(int val) { 56 return (replaced.Contains(val)); 59 return (replaced.Contains(val)); 57 60 } 58 61 ) -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/PotvinTwoLevelExchangeManipulator.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 using System.Collections.Generic;28 25 29 26 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 33 30 [StorableConstructor] 34 31 private PotvinTwoLevelExchangeManipulator(bool deserializing) : base(deserializing) { } 32 private PotvinTwoLevelExchangeManipulator(PotvinTwoLevelExchangeManipulator original, Cloner cloner) : base(original, cloner) { } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new PotvinTwoLevelExchangeManipulator(this, cloner); 35 } 36 public PotvinTwoLevelExchangeManipulator() : base() { } 35 37 36 public PotvinTwoLevelExchangeManipulator() : base() { }37 38 38 protected override void Manipulate(IRandom random, PotvinEncoding individual) { 39 39 int selectedIndex = SelectRandomTourBiasedByLength(random, individual); … … 54 54 if (FindInsertionPlace(individual, 55 55 customer2, selectedIndex, out route, out place)) { 56 56 individual.Tours[route].Cities.Insert(place, customer2); 57 57 route1.Cities.RemoveAt(customer1Position); 58 58 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/PotvinEncoding.cs
r4352 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.PermutationEncoding;26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using System.Drawing;28 using System.Collections.Generic;29 27 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 30 28 … … 32 30 [Item("PotvinEncoding", "Represents a potvin encoding of VRP solutions. It is implemented as described in Potvin, J.-Y. and Bengio, S. (1996). The Vehicle Routing Problem with Time Windows - Part II: Genetic Search. INFORMS Journal of Computing, 8:165–172.")] 33 31 [StorableClass] 34 public class PotvinEncoding : TourEncoding { 32 public class PotvinEncoding : TourEncoding { 35 33 [Storable] 36 34 public List<int> Unrouted { get; set; } 37 35 38 public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {39 PotvinEncoding clone = new PotvinEncoding();40 cloner.RegisterClonedObject(this, clone);41 clone.Tours = (ItemList<Tour>)cloner.Clone(this.Tours);42 clone.Unrouted = new List<int>(Unrouted);43 return clone;36 [StorableConstructor] 37 protected PotvinEncoding(bool deserializing) : base(deserializing) { } 38 protected PotvinEncoding(PotvinEncoding original, Cloner cloner) 39 : base(original, cloner) { 40 Tours = cloner.Clone(original.Tours); 41 Unrouted = new List<int>(original.Unrouted); 44 42 } 45 46 public PotvinEncoding(): base() {43 public PotvinEncoding() 44 : base() { 47 45 Unrouted = new List<int>(); 48 46 } 49 47 50 [StorableConstructor] 51 private PotvinEncoding(bool serializing) 52 : base() { 48 public override IDeepCloneable Clone(Cloner cloner) { 49 return new PotvinEncoding(this, cloner); 53 50 } 54 51 55 52 public static PotvinEncoding ConvertFrom(IVRPEncoding encoding, ILookupParameter<DoubleMatrix> distanceMatrix) { 56 53 PotvinEncoding solution = new PotvinEncoding(); … … 85 82 Tours[tour].Cities.Insert(i, city); 86 83 87 if (Tours[tour].Feasible(dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, 84 if (Tours[tour].Feasible(dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, 88 85 capacity, coordinates, distanceMatrix, useDistanceMatrix)) { 89 86 double newLength = Tours[tour].GetLength(coordinates, distanceMatrix, useDistanceMatrix); 90 87 91 88 double detour = newLength - length; -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Crossovers/PrinsCrossover.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.Data; 25 using HeuristicLab.Optimization; 24 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using HeuristicLab.Optimization;28 28 29 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins { … … 53 53 [StorableConstructor] 54 54 protected PrinsCrossover(bool deserializing) : base(deserializing) { } 55 55 protected PrinsCrossover(PrinsCrossover original, Cloner cloner) : base(original, cloner) { } 56 56 public PrinsCrossover() 57 57 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Crossovers/PrinsPermutationCrossover.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.Prins { … … 36 36 [StorableConstructor] 37 37 private PrinsPermutationCrossover(bool deserializing) : base(deserializing) { } 38 38 private PrinsPermutationCrossover(PrinsPermutationCrossover original, Cloner cloner) : base(original, cloner) { } 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new PrinsPermutationCrossover(this, cloner); 41 } 39 42 public PrinsPermutationCrossover() 40 43 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Interfaces/IPrinsOperator.cs
r4352 r4722 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 22 using HeuristicLab.Core; 27 23 using HeuristicLab.Data; -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Manipulators/PrinsExhaustiveLSManipulator.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.Prins { … … 33 31 [StorableConstructor] 34 32 private PrinsExhaustiveLSManipulator(bool deserializing) : base(deserializing) { } 35 33 private PrinsExhaustiveLSManipulator(PrinsExhaustiveLSManipulator original, Cloner cloner) : base(original, cloner) { } 34 public override IDeepCloneable Clone(Cloner cloner) { 35 return new PrinsExhaustiveLSManipulator(this, cloner); 36 } 36 37 public PrinsExhaustiveLSManipulator() 37 38 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Manipulators/PrinsLSManipulator.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;25 using HeuristicLab.Data; 24 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using System.Collections.Generic;28 28 29 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins { … … 37 37 [StorableConstructor] 38 38 protected PrinsLSManipulator(bool deserializing) : base(deserializing) { } 39 39 protected PrinsLSManipulator(PrinsLSManipulator original, Cloner cloner) : base(original, cloner) { } 40 40 public PrinsLSManipulator() 41 41 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Manipulators/PrinsManipulator.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.Data; 25 using HeuristicLab.Optimization; 24 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using HeuristicLab.Optimization;28 28 29 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins { … … 53 53 [StorableConstructor] 54 54 protected PrinsManipulator(bool deserializing) : base(deserializing) { } 55 55 protected PrinsManipulator(PrinsManipulator original, Cloner cloner) : base(original, cloner) { } 56 56 public PrinsManipulator() 57 57 : base() { … … 61 61 Parameters.Add(new LookupParameter<DoubleValue>("EvalOverloadPenalty", "The overload penalty considered in the evaluation.")); 62 62 Parameters.Add(new LookupParameter<DoubleValue>("EvalTardinessPenalty", "The tardiness penalty considered in the evaluation.")); 63 64 63 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators.")); 65 64 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Manipulators/PrinsPermutationManipulator.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.Prins { … … 36 36 [StorableConstructor] 37 37 private PrinsPermutationManipulator(bool deserializing) : base(deserializing) { } 38 38 private PrinsPermutationManipulator(PrinsPermutationManipulator original, Cloner cloner) : base(original, cloner) { } 39 public override IDeepCloneable Clone(Cloner cloner) { 40 return new PrinsPermutationManipulator(this, cloner); 41 } 39 42 public PrinsPermutationManipulator() 40 43 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/Manipulators/PrinsStochasticLSManipulator.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;25 using HeuristicLab.Data; 24 26 using HeuristicLab.Parameters; 25 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Data;27 using System.Collections.Generic;28 28 29 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins { … … 37 37 [StorableConstructor] 38 38 private PrinsStochasticLSManipulator(bool deserializing) : base(deserializing) { } 39 39 private PrinsStochasticLSManipulator(PrinsStochasticLSManipulator original, Cloner cloner) : base(original, cloner) { } 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new PrinsStochasticLSManipulator(this, cloner); 42 } 40 43 public PrinsStochasticLSManipulator() 41 44 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Prins/PrinsEncoding.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.Prins { … … 178 178 } 179 179 #endregion 180 181 public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) { 182 PrinsEncoding clone = new PrinsEncoding( 183 new Permutation(this.PermutationType, this.array), cities, 184 dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity, 185 fleetUsageFactor, timeFactor, distanceFactor, overloadPenalty, tardinessPenalty, 186 coordinates, useDistanceMatrix); 187 188 cloner.RegisterClonedObject(this, clone); 189 clone.readOnly = readOnly; 190 return clone; 191 } 192 180 181 [StorableConstructor] 182 protected PrinsEncoding(bool deserializing) : base(deserializing) { } 183 protected PrinsEncoding(PrinsEncoding original, Cloner cloner) 184 : base(original, cloner) { 185 this.cities = original.cities; 186 this.dueTimeArray = original.dueTimeArray; 187 this.serviceTimeArray = original.serviceTimeArray; 188 this.readyTimeArray = original.readyTimeArray; 189 this.demandArray = original.demandArray; 190 this.capacity = original.capacity; 191 this.fleetUsageFactor = original.fleetUsageFactor; 192 this.timeFactor = original.timeFactor; 193 this.distanceFactor = original.distanceFactor; 194 this.overloadPenalty = original.overloadPenalty; 195 this.tardinessPenalty = original.tardinessPenalty; 196 this.coordinates = original.coordinates; 197 this.useDistanceMatrix = original.useDistanceMatrix; 198 } 199 public override IDeepCloneable Clone(Cloner cloner) { 200 return new PrinsEncoding(this, cloner); 201 } 193 202 public PrinsEncoding(Permutation permutation, int cities, 194 203 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity, … … 211 220 } 212 221 213 [StorableConstructor]214 private PrinsEncoding(bool serializing)215 : base(serializing) {216 }217 218 222 public static PrinsEncoding ConvertFrom(IVRPEncoding encoding, int cities, 219 223 DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity, -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Tour.cs
r4174 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 22 24 using HeuristicLab.Core; 23 25 using HeuristicLab.Data; 24 using System.Collections.Generic;25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Common;27 27 28 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings { … … 32 32 public List<int> Cities { get; private set; } 33 33 34 [StorableConstructor] 35 protected Tour(bool deserializing) : base(deserializing) { } 36 protected Tour(Tour original, Cloner cloner) 37 : base(original, cloner) { 38 Cities = new List<int>(original.Cities); 39 } 34 40 public Tour() { 35 41 Cities = new List<int>(); … … 37 43 38 44 public override IDeepCloneable Clone(Cloner cloner) { 39 Tour clone = base.Clone(cloner) as Tour; 40 clone.Cities = new List<int>(Cities); 41 42 return clone; 45 return new Tour(this, cloner); 43 46 } 44 47 … … 63 66 return eval.Overload < double.Epsilon && eval.Tardiness < double.Epsilon; 64 67 } 65 66 public double GetLength(DoubleMatrix coordinates, 67 ILookupParameter<DoubleMatrix> distanceMatrix, 68 69 public double GetLength(DoubleMatrix coordinates, 70 ILookupParameter<DoubleMatrix> distanceMatrix, 68 71 BoolValue useDistanceMatrix) { 69 72 double length = 0; … … 79 82 for (int i = 1; i < cities.Count; i++) { 80 83 length += VRPUtilities.GetDistance( 81 cities[i - 1], cities[i], coordinates, distanceMatrix, useDistanceMatrix); 84 cities[i - 1], cities[i], coordinates, distanceMatrix, useDistanceMatrix); 82 85 } 83 86 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/VRPCreator.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Data;24 using HeuristicLab.Operators;25 24 using HeuristicLab.Parameters; 26 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 41 40 [StorableConstructor] 42 41 protected VRPCreator(bool deserializing) : base(deserializing) { } 43 42 protected VRPCreator(VRPCreator original, Cloner cloner) 43 : base(original, cloner) { 44 } 44 45 public VRPCreator() 45 46 : base() { 46 47 Parameters.Add(new LookupParameter<IVRPEncoding>("VRPTours", "The new VRP tours.")); 47 48 } 48 49 49 #endregion 50 50 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/VRPCrossover.cs
r4179 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Data;24 using HeuristicLab.Operators;25 24 using HeuristicLab.Parameters; 26 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 44 43 [StorableConstructor] 45 44 protected VRPCrossover(bool deserializing) : base(deserializing) { } 46 45 protected VRPCrossover(VRPCrossover original, Cloner cloner) 46 : base(original, cloner) { 47 } 47 48 public VRPCrossover() 48 49 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/VRPManipulator.cs
r4183 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Operators;24 24 using HeuristicLab.Parameters; 25 using HeuristicLab.Data;26 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 26 … … 40 39 [StorableConstructor] 41 40 protected VRPManipulator(bool deserializing) : base(deserializing) { } 42 41 protected VRPManipulator(VRPManipulator original, Cloner cloner) 42 : base(original, cloner) { 43 } 43 44 public VRPManipulator() 44 45 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/VRPMoveOperator.cs
r4179 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Operators;24 24 using HeuristicLab.Parameters; 25 using HeuristicLab.Data;26 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 26 … … 35 34 get { return (ILookupParameter<IVRPEncoding>)Parameters["VRPTours"]; } 36 35 } 37 36 38 37 #endregion 39 38 40 39 [StorableConstructor] 41 40 protected VRPMoveOperator(bool deserializing) : base(deserializing) { } 42 41 protected VRPMoveOperator(VRPMoveOperator original, Cloner cloner) : base(original, cloner) { } 43 42 public VRPMoveOperator() 44 43 : base() { -
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); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Evaluators/VRPEvaluator.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; 24 using HeuristicLab.Operators;25 25 using HeuristicLab.Parameters; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 82 82 } 83 83 84 [StorableConstructor] 85 private VRPEvaluator(bool deserializing) : base(deserializing) { } 86 private VRPEvaluator(VRPEvaluator original, Cloner cloner) 87 : base(original, cloner) { 88 } 84 89 public VRPEvaluator() 85 90 : base() { … … 98 103 } 99 104 105 public override IDeepCloneable Clone(Cloner cloner) { 106 return new VRPEvaluator(this, cloner); 107 } 108 100 109 private double CalculateFleetUsage() { 101 110 IVRPEncoding vrpSolution = VRPToursParameter.ActualValue; -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Interfaces/IVRPCreator.cs
r4352 r4722 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Data;24 23 using HeuristicLab.Optimization; 25 24 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Interfaces/IVRPCrossover.cs
r4150 r4722 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Optimization; 24 using HeuristicLab.Data;25 24 26 25 namespace HeuristicLab.Problems.VehicleRouting { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Interfaces/IVRPEncoding.cs
r4352 r4722 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 23 25 using HeuristicLab.Problems.VehicleRouting.Encodings; 24 using System.Collections.Generic;25 using HeuristicLab.Data;26 26 27 27 namespace HeuristicLab.Problems.VehicleRouting { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Interfaces/IVRPManipulator.cs
r4179 r4722 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Optimization; 24 using HeuristicLab.Data;25 24 26 25 namespace HeuristicLab.Problems.VehicleRouting { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Interfaces/IVRPMoveOperator.cs
r4179 r4722 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Optimization; 24 using HeuristicLab.Data;25 24 26 25 namespace HeuristicLab.Problems.VehicleRouting { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/MoveEvaluators/VRPMoveEvaluator.cs
r4179 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Data; 24 using HeuristicLab.Operators;25 25 using HeuristicLab.Optimization; 26 26 using HeuristicLab.Parameters; 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.Problems.VehicleRouting.Encodings;29 28 30 29 namespace HeuristicLab.Problems.VehicleRouting { … … 39 38 get { return (ILookupParameter<IVRPEncoding>)Parameters["VRPTours"]; } 40 39 } 41 40 42 41 public ILookupParameter<DoubleValue> FleetUsageFactor { 43 42 get { return (ILookupParameter<DoubleValue>)Parameters["EvalFleetUsageFactor"]; } … … 80 79 [StorableConstructor] 81 80 protected VRPMoveEvaluator(bool deserializing) : base(deserializing) { } 82 81 protected VRPMoveEvaluator(VRPMoveEvaluator original, Cloner cloner) : base(original, cloner) { } 83 82 protected VRPMoveEvaluator() 84 83 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/ORLIBParser.cs
r4352 r4722 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 23 using System.Globalization; 26 24 using System.IO; 27 using System.Globalization;28 25 29 26 namespace HeuristicLab.Problems.VehicleRouting { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VRPOperator.cs
r4352 r4722 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 23 25 using HeuristicLab.Operators; 24 26 using HeuristicLab.Parameters; 25 using HeuristicLab. Data;27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 28 using HeuristicLab.Problems.VehicleRouting.Encodings; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 using System;29 29 30 30 namespace HeuristicLab.Problems.VehicleRouting { … … 110 110 [StorableConstructor] 111 111 protected VRPOperator(bool deserializing) : base(deserializing) { } 112 112 protected VRPOperator(VRPOperator original, Cloner cloner) : base(original, cloner) { } 113 113 public VRPOperator() 114 114 : base() { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VRPSolution.cs
r4185 r4722 195 195 public VRPSolution() : base() { } 196 196 197 public VRPSolution(DoubleMatrix coordinates): base() { 197 public VRPSolution(DoubleMatrix coordinates) 198 : base() { 198 199 this.coordinates = coordinates; 199 200 } 200 201 201 public VRPSolution(DoubleMatrix coordinates, IVRPEncoding solution, DoubleValue quality, 202 DoubleValue distance, DoubleValue overload, DoubleValue tardiness, DoubleValue travelTime, 202 public VRPSolution(DoubleMatrix coordinates, IVRPEncoding solution, DoubleValue quality, 203 DoubleValue distance, DoubleValue overload, DoubleValue tardiness, DoubleValue travelTime, 203 204 DoubleValue vehicleUtilization, DoubleMatrix distanceMatrix, BoolValue useDistanceMatrix, 204 205 DoubleArray readyTime, DoubleArray dueTime, DoubleArray serviceTime) … … 222 223 private VRPSolution(bool deserializing) : base(deserializing) { } 223 224 225 private VRPSolution(VRPSolution original, Cloner cloner) 226 : base(original, cloner) { 227 coordinates = cloner.Clone(original.coordinates); 228 solution = cloner.Clone(original.solution); 229 quality = cloner.Clone(original.quality); 230 distance = cloner.Clone(original.distance); 231 overload = cloner.Clone(original.overload); 232 tardiness = cloner.Clone(original.tardiness); 233 travelTime = cloner.Clone(original.travelTime); 234 vehicleUtilization = cloner.Clone(original.vehicleUtilization); 235 distanceMatrix = cloner.Clone(original.distanceMatrix); 236 useDistanceMatrix = cloner.Clone(original.useDistanceMatrix); 237 readyTime = cloner.Clone(original.readyTime); 238 dueTime = cloner.Clone(original.dueTime); 239 serviceTime = cloner.Clone(original.serviceTime); 240 Initialize(); 241 } 242 224 243 [StorableHook(HookType.AfterDeserialization)] 244 private void AfterDeserialization() { 245 Initialize(); 246 } 225 247 private void Initialize() { 226 248 if (coordinates != null) RegisterCoordinatesEvents(); … … 235 257 236 258 public override IDeepCloneable Clone(Cloner cloner) { 237 VRPSolution clone = new VRPSolution(); 238 cloner.RegisterClonedObject(this, clone); 239 clone.coordinates = (DoubleMatrix)cloner.Clone(coordinates); 240 clone.solution = (IVRPEncoding)cloner.Clone(solution); 241 clone.quality = (DoubleValue)cloner.Clone(quality); 242 clone.distance = (DoubleValue)cloner.Clone(distance); 243 clone.overload = (DoubleValue)cloner.Clone(overload); 244 clone.tardiness = (DoubleValue)cloner.Clone(tardiness); 245 clone.travelTime = (DoubleValue)cloner.Clone(travelTime); 246 clone.vehicleUtilization = (DoubleValue)cloner.Clone(vehicleUtilization); 247 clone.distanceMatrix = (DoubleMatrix)cloner.Clone(distanceMatrix); 248 clone.useDistanceMatrix = (BoolValue)cloner.Clone(useDistanceMatrix); 249 clone.readyTime = (DoubleArray)cloner.Clone(readyTime); 250 clone.dueTime = (DoubleArray)cloner.Clone(dueTime); 251 clone.serviceTime = (DoubleArray)cloner.Clone(serviceTime); 252 clone.Initialize(); 253 return clone; 259 return new VRPSolution(this, cloner); 254 260 } 255 261 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VRPUtilities.cs
r4619 r4722 21 21 22 22 using System; 23 using System.Drawing;24 using HeuristicLab.Common;25 23 using HeuristicLab.Core; 26 24 using HeuristicLab.Data; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 25 29 26 namespace HeuristicLab.Problems.VehicleRouting { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs
r4626 r4722 197 197 [StorableConstructor] 198 198 private VehicleRoutingProblem(bool deserializing) : base(deserializing) { } 199 199 private VehicleRoutingProblem(VehicleRoutingProblem original, Cloner cloner) 200 : base(original, cloner) { 201 operators = original.operators.Select(x => (IOperator)cloner.Clone(x)).ToList(); 202 DistanceMatrixParameter.Value = DistanceMatrixParameter.Value; 203 AttachEventHandlers(); 204 } 200 205 public VehicleRoutingProblem() 201 206 : base() { … … 237 242 238 243 public override IDeepCloneable Clone(Cloner cloner) { 239 VehicleRoutingProblem clone = (VehicleRoutingProblem)base.Clone(cloner); 240 clone.operators = operators.Select(x => (IOperator)cloner.Clone(x)).ToList(); 241 clone.DistanceMatrixParameter.Value = DistanceMatrixParameter.Value; 242 clone.AttachEventHandlers(); 243 return clone; 244 return new VehicleRoutingProblem(this, cloner); 244 245 } 245 246 … … 454 455 455 456 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); 456 457 457 458 EvaluatorParameter.ValueChanged += new EventHandler(EvaluatorParameter_ValueChanged); 458 459 Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged); … … 563 564 private void ParameterizeOperators() { 564 565 foreach (IVRPOperator op in Operators.OfType<IVRPOperator>()) { 565 if (op.CoordinatesParameter != null) op.CoordinatesParameter.ActualName = CoordinatesParameter.Name;566 if (op.DistanceMatrixParameter != null) op.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name;567 if (op.UseDistanceMatrixParameter != null) op.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name;568 if (op.VehiclesParameter != null) op.VehiclesParameter.ActualName = VehiclesParameter.Name;569 if (op.CapacityParameter != null) op.CapacityParameter.ActualName = CapacityParameter.Name;570 if (op.DemandParameter != null) op.DemandParameter.ActualName = DemandParameter.Name;571 if (op.ReadyTimeParameter != null) op.ReadyTimeParameter.ActualName = ReadyTimeParameter.Name;572 if (op.DueTimeParameter != null) op.DueTimeParameter.ActualName = DueTimeParameter.Name;573 if (op.ServiceTimeParameter != null) op.ServiceTimeParameter.ActualName = ServiceTimeParameter.Name;574 } 575 566 if (op.CoordinatesParameter != null) op.CoordinatesParameter.ActualName = CoordinatesParameter.Name; 567 if (op.DistanceMatrixParameter != null) op.DistanceMatrixParameter.ActualName = DistanceMatrixParameter.Name; 568 if (op.UseDistanceMatrixParameter != null) op.UseDistanceMatrixParameter.ActualName = UseDistanceMatrixParameter.Name; 569 if (op.VehiclesParameter != null) op.VehiclesParameter.ActualName = VehiclesParameter.Name; 570 if (op.CapacityParameter != null) op.CapacityParameter.ActualName = CapacityParameter.Name; 571 if (op.DemandParameter != null) op.DemandParameter.ActualName = DemandParameter.Name; 572 if (op.ReadyTimeParameter != null) op.ReadyTimeParameter.ActualName = ReadyTimeParameter.Name; 573 if (op.DueTimeParameter != null) op.DueTimeParameter.ActualName = DueTimeParameter.Name; 574 if (op.ServiceTimeParameter != null) op.ServiceTimeParameter.ActualName = ServiceTimeParameter.Name; 575 } 576 576 577 foreach (IVRPMoveOperator op in Operators.OfType<IVRPMoveOperator>()) { 577 578 op.VRPToursParameter.ActualName = SolutionCreator.VRPToursParameter.ActualName; … … 641 642 if (parser.Vehicles != -1) 642 643 Vehicles.Value = parser.Vehicles; 643 else 644 else 644 645 Vehicles.Value = problemSize - 1; 645 646 Capacity.Value = parser.Capacity;
Note: See TracChangeset
for help on using the changeset viewer.