- Timestamp:
- 11/06/10 01:56:04 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/CloningRefactoring (added) merged: 4656-4693,4696-4697,4711-4714,4718-4719
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting
- Property svn:mergeinfo changed
/branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting (added) merged: 4686-4687,4689-4693,4696-4697
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/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 }
Note: See TracChangeset
for help on using the changeset viewer.