Changeset 7865
- Timestamp:
- 05/22/12 09:53:07 (13 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4
- Files:
-
- 1 added
- 2 deleted
- 2 edited
- 11 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Creators/RandomCreator.cs
r7543 r7865 33 33 [Item("RandomCreator", "Creates a randomly initialized VRP solution.")] 34 34 [StorableClass] 35 public sealed class RandomCreator : DefaultRepresentationCreator, IStochasticOperator {35 public sealed class RandomCreator : AlbaCreator, IStochasticOperator { 36 36 #region IStochasticOperator Members 37 37 public ILookupParameter<IRandom> RandomParameter { … … 56 56 } 57 57 58 pr otected override List<int> CreateSolution() {58 private List<int> CreateSolution() { 59 59 int cities = ProblemInstance.Cities.Value; 60 60 int vehicles = ProblemInstance.Vehicles.Value; … … 88 88 return new List<int>(perm); 89 89 } 90 91 public override IOperation Apply() { 92 //choose default encoding here 93 VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(CreateSolution(), ProblemInstance); 94 95 return base.Apply(); 96 } 90 97 } 91 98 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/IPotvinTwoOptStarMoveOperator.cs
r7774 r7865 26 26 27 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 28 public interface IPotvin OnePointCrossoverMoveOperator : IVRPMoveOperator {29 ILookupParameter<Potvin OnePointCrossoverMove> OnePointCrossoverMoveParameter { get; }28 public interface IPotvinTwoOptStarMoveOperator : IVRPMoveOperator { 29 ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter { get; } 30 30 } 31 31 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarExhaustiveMoveGenerator.cs
r7774 r7865 30 30 31 31 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 32 [Item("Potvin OnePointCrossoverExhaustiveMoveGenerator", "Generates customer relocationmoves from a given VRP encoding.")]32 [Item("PotvinTwoOptStarExhaustiveMoveGenerator", "Generates two opt star moves from a given VRP encoding.")] 33 33 [StorableClass] 34 public sealed class Potvin OnePointCrossoverExhaustiveMoveGenerator : PotvinOnePointCrossoverMoveGenerator, IExhaustiveMoveGenerator {34 public sealed class PotvinTwoOptStarExhaustiveMoveGenerator : PotvinTwoOptStarMoveGenerator, IExhaustiveMoveGenerator { 35 35 public override IDeepCloneable Clone(Cloner cloner) { 36 return new Potvin OnePointCrossoverExhaustiveMoveGenerator(this, cloner);36 return new PotvinTwoOptStarExhaustiveMoveGenerator(this, cloner); 37 37 } 38 38 39 39 [StorableConstructor] 40 private Potvin OnePointCrossoverExhaustiveMoveGenerator(bool deserializing) : base(deserializing) { }40 private PotvinTwoOptStarExhaustiveMoveGenerator(bool deserializing) : base(deserializing) { } 41 41 42 public Potvin OnePointCrossoverExhaustiveMoveGenerator()42 public PotvinTwoOptStarExhaustiveMoveGenerator() 43 43 : base() { 44 44 } 45 45 46 private Potvin OnePointCrossoverExhaustiveMoveGenerator(PotvinOnePointCrossoverMoveGenerator original, Cloner cloner)46 private PotvinTwoOptStarExhaustiveMoveGenerator(PotvinTwoOptStarMoveGenerator original, Cloner cloner) 47 47 : base(original, cloner) { 48 48 } 49 49 50 protected override Potvin OnePointCrossoverMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) {51 List<Potvin OnePointCrossoverMove> result = new List<PotvinOnePointCrossoverMove>();50 protected override PotvinTwoOptStarMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) { 51 List<PotvinTwoOptStarMove> result = new List<PotvinTwoOptStarMove>(); 52 52 53 53 for (int tour1 = 0; tour1 < individual.Tours.Count; tour1++) { … … 57 57 if ((index1 != individual.Tours[tour1].Stops.Count || index2 != individual.Tours[tour2].Stops.Count) && 58 58 (index1 != 0 || index2 != 0)) 59 result.Add(new Potvin OnePointCrossoverMove(tour1, index1, tour2, index2, individual));59 result.Add(new PotvinTwoOptStarMove(tour1, index1, tour2, index2, individual)); 60 60 } 61 61 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMove.cs
r7774 r7865 31 31 32 32 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 33 [Item("Potvin OnePointCrossoverMove", "Item that describes a relocationmove on a VRP representation.")]33 [Item("PotvinTwoOptStarMove", "Item that describes a two opt star move on a VRP representation.")] 34 34 [StorableClass] 35 public class Potvin OnePointCrossoverMove: Item, IVRPMove {35 public class PotvinTwoOptStarMove: Item, IVRPMove { 36 36 [Storable] 37 37 public IVRPEncoding Individual { get; protected set; } … … 49 49 public int X2 { get; protected set; } 50 50 51 public Potvin OnePointCrossoverMove(): base() {51 public PotvinTwoOptStarMove(): base() { 52 52 X1 = -1; 53 53 Tour1 = -1; … … 58 58 } 59 59 60 public Potvin OnePointCrossoverMove(int tour1, int x1, int tour2, int x2, PotvinEncoding individual) {60 public PotvinTwoOptStarMove(int tour1, int x1, int tour2, int x2, PotvinEncoding individual) { 61 61 Tour1 = tour1; 62 62 X1 = x1; … … 68 68 69 69 public override IDeepCloneable Clone(Cloner cloner) { 70 return new Potvin OnePointCrossoverMove(this, cloner);70 return new PotvinTwoOptStarMove(this, cloner); 71 71 } 72 72 73 protected Potvin OnePointCrossoverMove(PotvinOnePointCrossoverMove original, Cloner cloner)73 protected PotvinTwoOptStarMove(PotvinTwoOptStarMove original, Cloner cloner) 74 74 : base(original, cloner) { 75 75 this.Tour1 = original.Tour1; … … 84 84 85 85 public VRPMoveEvaluator GetMoveEvaluator() { 86 return new Potvin OnePointCrossoverMoveEvaluator();86 return new PotvinTwoOptStarMoveEvaluator(); 87 87 } 88 88 89 89 public VRPMoveMaker GetMoveMaker() { 90 return new Potvin OnePointCrossoverMoveMaker();90 return new PotvinTwoOptStarMoveMaker(); 91 91 } 92 92 93 93 public ITabuMaker GetTabuMaker() { 94 return new Potvin OnePointCrossoverMoveTabuMaker();94 return new PotvinTwoOptStarMoveTabuMaker(); 95 95 } 96 96 97 97 public ITabuChecker GetTabuChecker() { 98 return new Potvin OnePointCrossoverMoveTabuCriterion();98 return new PotvinTwoOptStarMoveTabuCriterion(); 99 99 } 100 100 101 101 public ITabuChecker GetSoftTabuChecker() { 102 Potvin OnePointCrossoverMoveTabuCriterion tabuChecker = new PotvinOnePointCrossoverMoveTabuCriterion();102 PotvinTwoOptStarMoveTabuCriterion tabuChecker = new PotvinTwoOptStarMoveTabuCriterion(); 103 103 tabuChecker.UseAspirationCriterion.Value = true; 104 104 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveAttribute.cs
r7774 r7865 26 26 27 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 28 [Item("Potvin OnePointCrossoverMoveAttribute", "Customer relocationmove attribute")]28 [Item("PotvinTwoOptStarMoveAttribute", "Two opt star move attribute")] 29 29 [StorableClass] 30 public class Potvin OnePointCrossoverMoveAttribute : VRPMoveAttribute {30 public class PotvinTwoOptStarMoveAttribute : VRPMoveAttribute { 31 31 [Storable] 32 32 public int Tour { get; private set; } … … 42 42 43 43 [StorableConstructor] 44 protected Potvin OnePointCrossoverMoveAttribute(bool deserializing) : base(deserializing) { }45 protected Potvin OnePointCrossoverMoveAttribute(PotvinOnePointCrossoverMoveAttribute original, Cloner cloner)44 protected PotvinTwoOptStarMoveAttribute(bool deserializing) : base(deserializing) { } 45 protected PotvinTwoOptStarMoveAttribute(PotvinTwoOptStarMoveAttribute original, Cloner cloner) 46 46 : base(original, cloner) { 47 47 this.Tour = original.Tour; … … 51 51 this.Tardiness = original.Tardiness; 52 52 } 53 public Potvin OnePointCrossoverMoveAttribute(double moveQuality, int tour, int city,53 public PotvinTwoOptStarMoveAttribute(double moveQuality, int tour, int city, 54 54 double distance, double overload, double tardiness) 55 55 : base(moveQuality) { … … 62 62 63 63 public override IDeepCloneable Clone(Cloner cloner) { 64 return new Potvin OnePointCrossoverMoveAttribute(this, cloner);64 return new PotvinTwoOptStarMoveAttribute(this, cloner); 65 65 } 66 66 … … 70 70 71 71 public override bool Equals(object obj) { 72 if (obj is Potvin OnePointCrossoverMoveAttribute) {73 Potvin OnePointCrossoverMoveAttribute other = obj as PotvinOnePointCrossoverMoveAttribute;72 if (obj is PotvinTwoOptStarMoveAttribute) { 73 PotvinTwoOptStarMoveAttribute other = obj as PotvinTwoOptStarMoveAttribute; 74 74 75 75 return Tour == other.Tour && City == other.City; -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveEvaluator.cs
r7774 r7865 29 29 30 30 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 31 [Item("Potvin OnePointCrossoverMoveEvaluator", "Evaluates a customer relocationmove for a VRP representation. ")]31 [Item("PotvinTwoOptStarMoveEvaluator", "Evaluates a two opt star move for a VRP representation. ")] 32 32 [StorableClass] 33 public sealed class Potvin OnePointCrossoverMoveEvaluator : PotvinMoveEvaluator, IPotvinOnePointCrossoverMoveOperator {34 public ILookupParameter<Potvin OnePointCrossoverMove> OnePointCrossoverMoveParameter {35 get { return (ILookupParameter<Potvin OnePointCrossoverMove>)Parameters["PotvinOnePointCrossoverMove"]; }33 public sealed class PotvinTwoOptStarMoveEvaluator : PotvinMoveEvaluator, IPotvinTwoOptStarMoveOperator { 34 public ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter { 35 get { return (ILookupParameter<PotvinTwoOptStarMove>)Parameters["PotvinTwoOptStarMove"]; } 36 36 } 37 37 38 38 public override ILookupParameter VRPMoveParameter { 39 get { return OnePointCrossoverMoveParameter; }39 get { return TwoOptStarMoveParameter; } 40 40 } 41 41 [StorableConstructor] 42 private Potvin OnePointCrossoverMoveEvaluator(bool deserializing) : base(deserializing) { }42 private PotvinTwoOptStarMoveEvaluator(bool deserializing) : base(deserializing) { } 43 43 44 public Potvin OnePointCrossoverMoveEvaluator()44 public PotvinTwoOptStarMoveEvaluator() 45 45 : base() { 46 Parameters.Add(new LookupParameter<Potvin OnePointCrossoverMove>("PotvinOnePointCrossoverMove", "The move that should be evaluated."));46 Parameters.Add(new LookupParameter<PotvinTwoOptStarMove>("PotvinTwoOptStarMove", "The move that should be evaluated.")); 47 47 } 48 48 49 49 public override IDeepCloneable Clone(Cloner cloner) { 50 return new Potvin OnePointCrossoverMoveEvaluator(this, cloner);50 return new PotvinTwoOptStarMoveEvaluator(this, cloner); 51 51 } 52 52 53 private Potvin OnePointCrossoverMoveEvaluator(PotvinOnePointCrossoverMoveEvaluator original, Cloner cloner)53 private PotvinTwoOptStarMoveEvaluator(PotvinTwoOptStarMoveEvaluator original, Cloner cloner) 54 54 : base(original, cloner) { 55 55 } 56 56 57 57 protected override void EvaluateMove() { 58 Potvin OnePointCrossoverMove move = OnePointCrossoverMoveParameter.ActualValue;58 PotvinTwoOptStarMove move = TwoOptStarMoveParameter.ActualValue; 59 59 60 PotvinEncoding newSolution = OnePointCrossoverMoveParameter.ActualValue.Individual.Clone() as PotvinEncoding;61 Potvin OnePointCrossoverMoveMaker.Apply(newSolution, move, ProblemInstance);60 PotvinEncoding newSolution = TwoOptStarMoveParameter.ActualValue.Individual.Clone() as PotvinEncoding; 61 PotvinTwoOptStarMoveMaker.Apply(newSolution, move, ProblemInstance); 62 62 63 63 UpdateEvaluation(newSolution); -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveGenerator.cs
r7774 r7865 30 30 31 31 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 32 [Item("Potvin OnePointCrossoverMoveGenerator", "Generates customer relocationmoves from a given VRP encoding.")]32 [Item("PotvinTwoOptStarMoveGenerator", "Generates two opt star moves from a given VRP encoding.")] 33 33 [StorableClass] 34 public abstract class Potvin OnePointCrossoverMoveGenerator : PotvinMoveGenerator, IPotvinOnePointCrossoverMoveOperator {35 public ILookupParameter<Potvin OnePointCrossoverMove> OnePointCrossoverMoveParameter {36 get { return (ILookupParameter<Potvin OnePointCrossoverMove>)Parameters["PotvinOnePointCrossoverMove"]; }34 public abstract class PotvinTwoOptStarMoveGenerator : PotvinMoveGenerator, IPotvinTwoOptStarMoveOperator { 35 public ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter { 36 get { return (ILookupParameter<PotvinTwoOptStarMove>)Parameters["PotvinTwoOptStarMove"]; } 37 37 } 38 38 39 39 public override ILookupParameter VRPMoveParameter { 40 get { return OnePointCrossoverMoveParameter; }40 get { return TwoOptStarMoveParameter; } 41 41 } 42 42 … … 46 46 47 47 [StorableConstructor] 48 protected Potvin OnePointCrossoverMoveGenerator(bool deserializing) : base(deserializing) { }48 protected PotvinTwoOptStarMoveGenerator(bool deserializing) : base(deserializing) { } 49 49 50 public Potvin OnePointCrossoverMoveGenerator()50 public PotvinTwoOptStarMoveGenerator() 51 51 : base() { 52 Parameters.Add(new LookupParameter<Potvin OnePointCrossoverMove>("PotvinOnePointCrossoverMove", "The moves that should be generated in subscopes."));52 Parameters.Add(new LookupParameter<PotvinTwoOptStarMove>("PotvinTwoOptStarMove", "The moves that should be generated in subscopes.")); 53 53 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes.")); 54 54 } 55 55 56 protected Potvin OnePointCrossoverMoveGenerator(PotvinOnePointCrossoverMoveGenerator original, Cloner cloner)56 protected PotvinTwoOptStarMoveGenerator(PotvinTwoOptStarMoveGenerator original, Cloner cloner) 57 57 : base(original, cloner) { 58 58 } 59 59 60 protected abstract Potvin OnePointCrossoverMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance);60 protected abstract PotvinTwoOptStarMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance); 61 61 62 62 public override IOperation Apply() { … … 64 64 65 65 PotvinEncoding individual = VRPToursParameter.ActualValue as PotvinEncoding; 66 Potvin OnePointCrossoverMove[] moves = GenerateMoves(individual, ProblemInstance);66 PotvinTwoOptStarMove[] moves = GenerateMoves(individual, ProblemInstance); 67 67 Scope[] moveScopes = new Scope[moves.Length]; 68 68 for (int i = 0; i < moveScopes.Length; i++) { 69 69 moveScopes[i] = new Scope(i.ToString()); 70 moveScopes[i].Variables.Add(new Variable( OnePointCrossoverMoveParameter.ActualName, moves[i]));70 moveScopes[i].Variables.Add(new Variable(TwoOptStarMoveParameter.ActualName, moves[i])); 71 71 } 72 72 CurrentScopeParameter.ActualValue.SubScopes.AddRange(moveScopes); -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveMaker.cs
r7774 r7865 33 33 34 34 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 35 [Item("Potvin OnePointCrossoverMoveMaker", "Peforms the customer relocationmove on a given VRP encoding and updates the quality.")]35 [Item("PotvinTwoOptStarMoveMaker", "Peforms the two opt star move on a given VRP encoding and updates the quality.")] 36 36 [StorableClass] 37 public class Potvin OnePointCrossoverMoveMaker : PotvinMoveMaker, IPotvinOnePointCrossoverMoveOperator, IMoveMaker {38 public ILookupParameter<Potvin OnePointCrossoverMove> OnePointCrossoverMoveParameter {39 get { return (ILookupParameter<Potvin OnePointCrossoverMove>)Parameters["PotvinOnePointCrossoverMove"]; }37 public class PotvinTwoOptStarMoveMaker : PotvinMoveMaker, IPotvinTwoOptStarMoveOperator, IMoveMaker { 38 public ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter { 39 get { return (ILookupParameter<PotvinTwoOptStarMove>)Parameters["PotvinTwoOptStarMove"]; } 40 40 } 41 41 42 42 public override ILookupParameter VRPMoveParameter { 43 get { return OnePointCrossoverMoveParameter; }43 get { return TwoOptStarMoveParameter; } 44 44 } 45 45 46 46 [StorableConstructor] 47 private Potvin OnePointCrossoverMoveMaker(bool deserializing) : base(deserializing) { }47 private PotvinTwoOptStarMoveMaker(bool deserializing) : base(deserializing) { } 48 48 49 public Potvin OnePointCrossoverMoveMaker()49 public PotvinTwoOptStarMoveMaker() 50 50 : base() { 51 Parameters.Add(new LookupParameter<Potvin OnePointCrossoverMove>("PotvinOnePointCrossoverMove", "The moves that should be made."));51 Parameters.Add(new LookupParameter<PotvinTwoOptStarMove>("PotvinTwoOptStarMove", "The moves that should be made.")); 52 52 } 53 53 54 54 public override IDeepCloneable Clone(Cloner cloner) { 55 return new Potvin OnePointCrossoverMoveMaker(this, cloner);55 return new PotvinTwoOptStarMoveMaker(this, cloner); 56 56 } 57 57 58 protected Potvin OnePointCrossoverMoveMaker(PotvinOnePointCrossoverMoveMaker original, Cloner cloner)58 protected PotvinTwoOptStarMoveMaker(PotvinTwoOptStarMoveMaker original, Cloner cloner) 59 59 : base(original, cloner) { 60 60 } 61 61 62 public static void GetSegments(Potvin OnePointCrossoverMove move, out List<int> segmentX1, out List<int> segmentX2) {62 public static void GetSegments(PotvinTwoOptStarMove move, out List<int> segmentX1, out List<int> segmentX2) { 63 63 PotvinEncoding solution = move.Individual as PotvinEncoding; 64 64 … … 82 82 } 83 83 84 public static void Apply(PotvinEncoding solution, Potvin OnePointCrossoverMove move, IVRPProblemInstance problemInstance) {84 public static void Apply(PotvinEncoding solution, PotvinTwoOptStarMove move, IVRPProblemInstance problemInstance) { 85 85 List<int> segmentX1; 86 86 List<int> segmentX2; … … 100 100 101 101 protected override void PerformMove() { 102 Potvin OnePointCrossoverMove move = OnePointCrossoverMoveParameter.ActualValue;102 PotvinTwoOptStarMove move = TwoOptStarMoveParameter.ActualValue; 103 103 104 104 PotvinEncoding newSolution = move.Individual.Clone() as PotvinEncoding; -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveTabuCriterion.cs
r7774 r7865 32 32 33 33 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 34 [Item("Potvin OnePointCrossoverTabuCriterion", @"Checks if a certain customer relocationmove is tabu.")]34 [Item("PotvinTwoOptStarTabuCriterion", @"Checks if a certain two opt star move is tabu.")] 35 35 [StorableClass] 36 public class Potvin OnePointCrossoverMoveTabuCriterion : SingleSuccessorOperator, IPotvinOnePointCrossoverMoveOperator, ITabuChecker, IPotvinOperator, IVRPMoveOperator {36 public class PotvinTwoOptStarMoveTabuCriterion : SingleSuccessorOperator, IPotvinTwoOptStarMoveOperator, ITabuChecker, IPotvinOperator, IVRPMoveOperator { 37 37 public override bool CanChangeName { 38 38 get { return false; } 39 39 } 40 40 41 public ILookupParameter<Potvin OnePointCrossoverMove> OnePointCrossoverMoveParameter {42 get { return (ILookupParameter<Potvin OnePointCrossoverMove>)Parameters["PotvinOnePointCrossoverMove"]; }41 public ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter { 42 get { return (ILookupParameter<PotvinTwoOptStarMove>)Parameters["PotvinTwoOptStarMove"]; } 43 43 } 44 44 public ILookupParameter VRPMoveParameter { 45 get { return OnePointCrossoverMoveParameter; }45 get { return TwoOptStarMoveParameter; } 46 46 } 47 47 public ILookupParameter<IVRPEncoding> VRPToursParameter { … … 84 84 85 85 [StorableConstructor] 86 protected Potvin OnePointCrossoverMoveTabuCriterion(bool deserializing) : base(deserializing) { }87 protected Potvin OnePointCrossoverMoveTabuCriterion(PotvinOnePointCrossoverMoveTabuCriterion original, Cloner cloner) : base(original, cloner) { }88 public Potvin OnePointCrossoverMoveTabuCriterion()86 protected PotvinTwoOptStarMoveTabuCriterion(bool deserializing) : base(deserializing) { } 87 protected PotvinTwoOptStarMoveTabuCriterion(PotvinTwoOptStarMoveTabuCriterion original, Cloner cloner) : base(original, cloner) { } 88 public PotvinTwoOptStarMoveTabuCriterion() 89 89 : base() { 90 Parameters.Add(new LookupParameter<Potvin OnePointCrossoverMove>("PotvinOnePointCrossoverMove", "The moves that should be made."));90 Parameters.Add(new LookupParameter<PotvinTwoOptStarMove>("PotvinTwoOptStarMove", "The moves that should be made.")); 91 91 Parameters.Add(new LookupParameter<IVRPEncoding>("VRPTours", "The VRP tours considered in the move.")); 92 92 Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The VRP problem instance")); … … 104 104 105 105 public override IDeepCloneable Clone(Cloner cloner) { 106 return new Potvin OnePointCrossoverMoveTabuCriterion(this, cloner);106 return new PotvinTwoOptStarMoveTabuCriterion(this, cloner); 107 107 } 108 108 … … 112 112 bool useAspiration = UseAspirationCriterion.Value; 113 113 bool isTabu = false; 114 Potvin OnePointCrossoverMove move = OnePointCrossoverMoveParameter.ActualValue;114 PotvinTwoOptStarMove move = TwoOptStarMoveParameter.ActualValue; 115 115 116 116 List<int> segmentX1; 117 117 List<int> segmentX2; 118 Potvin OnePointCrossoverMoveMaker.GetSegments(move, out segmentX1, out segmentX2);118 PotvinTwoOptStarMoveMaker.GetSegments(move, out segmentX1, out segmentX2); 119 119 120 120 foreach (IItem tabuMove in tabuList) { 121 Potvin OnePointCrossoverMoveAttribute attribute = tabuMove as PotvinOnePointCrossoverMoveAttribute;121 PotvinTwoOptStarMoveAttribute attribute = tabuMove as PotvinTwoOptStarMoveAttribute; 122 122 123 123 if (attribute != null) { -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveTabuMaker.cs
r7774 r7865 32 32 33 33 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 34 [Item("Potvin OnePointCrossoverMoveTabuMaker", "Declares a given exchangemove as tabu.")]34 [Item("PotvinTwoOptStarMoveTabuMaker", "Declares a given two opt star move as tabu.")] 35 35 [StorableClass] 36 public class Potvin OnePointCrossoverMoveTabuMaker : SingleSuccessorOperator, ITabuMaker, IPotvinOnePointCrossoverMoveOperator, IPotvinOperator, IVRPMoveOperator {36 public class PotvinTwoOptStarMoveTabuMaker : SingleSuccessorOperator, ITabuMaker, IPotvinTwoOptStarMoveOperator, IPotvinOperator, IVRPMoveOperator { 37 37 public LookupParameter<ItemList<IItem>> TabuListParameter { 38 38 get { return (LookupParameter<ItemList<IItem>>)Parameters["TabuList"]; } … … 52 52 53 53 54 public ILookupParameter<Potvin OnePointCrossoverMove> OnePointCrossoverMoveParameter {55 get { return (ILookupParameter<Potvin OnePointCrossoverMove>)Parameters["PotvinOnePointCrossoverMove"]; }54 public ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter { 55 get { return (ILookupParameter<PotvinTwoOptStarMove>)Parameters["PotvinTwoOptStarMove"]; } 56 56 } 57 57 public ILookupParameter VRPMoveParameter { 58 get { return OnePointCrossoverMoveParameter; }58 get { return TwoOptStarMoveParameter; } 59 59 } 60 60 public ILookupParameter<IVRPEncoding> VRPToursParameter { … … 76 76 77 77 [StorableConstructor] 78 protected Potvin OnePointCrossoverMoveTabuMaker(bool deserializing) : base(deserializing) { }79 protected Potvin OnePointCrossoverMoveTabuMaker(PotvinOnePointCrossoverMoveTabuMaker original, Cloner cloner) : base(original, cloner) { }80 public Potvin OnePointCrossoverMoveTabuMaker()78 protected PotvinTwoOptStarMoveTabuMaker(bool deserializing) : base(deserializing) { } 79 protected PotvinTwoOptStarMoveTabuMaker(PotvinTwoOptStarMoveTabuMaker original, Cloner cloner) : base(original, cloner) { } 80 public PotvinTwoOptStarMoveTabuMaker() 81 81 : base() { 82 82 Parameters.Add(new LookupParameter<ItemList<IItem>>("TabuList", "The tabu list where move attributes are stored.")); … … 86 86 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, else if it is a minimization problem.")); 87 87 88 Parameters.Add(new LookupParameter<Potvin OnePointCrossoverMove>("PotvinOnePointCrossoverMove", "The moves that should be made."));88 Parameters.Add(new LookupParameter<PotvinTwoOptStarMove>("PotvinTwoOptStarMove", "The moves that should be made.")); 89 89 Parameters.Add(new LookupParameter<IVRPEncoding>("VRPTours", "The VRP tours considered in the move.")); 90 90 Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The VRP problem instance")); … … 96 96 97 97 public override IDeepCloneable Clone(Cloner cloner) { 98 return new Potvin OnePointCrossoverMoveTabuMaker(this, cloner);98 return new PotvinTwoOptStarMoveTabuMaker(this, cloner); 99 99 } 100 100 … … 123 123 tardiness = TardinessParameter.ActualValue.Value; 124 124 125 Potvin OnePointCrossoverMove move = OnePointCrossoverMoveParameter.ActualValue;125 PotvinTwoOptStarMove move = TwoOptStarMoveParameter.ActualValue; 126 126 double moveQuality = MoveQualityParameter.ActualValue.Value; 127 127 double quality = QualityParameter.ActualValue.Value; … … 131 131 List<int> segmentX1; 132 132 List<int> segmentX2; 133 Potvin OnePointCrossoverMoveMaker.GetSegments(move, out segmentX1, out segmentX2);133 PotvinTwoOptStarMoveMaker.GetSegments(move, out segmentX1, out segmentX2); 134 134 135 135 foreach (int city in segmentX1) { 136 tabuList.Add(new Potvin OnePointCrossoverMoveAttribute(baseQuality, move.Tour1, city, distance, overload, tardiness));136 tabuList.Add(new PotvinTwoOptStarMoveAttribute(baseQuality, move.Tour1, city, distance, overload, tardiness)); 137 137 } 138 138 139 139 foreach (int city in segmentX2) { 140 tabuList.Add(new Potvin OnePointCrossoverMoveAttribute(baseQuality, move.Tour2, city, distance, overload, tardiness));140 tabuList.Add(new PotvinTwoOptStarMoveAttribute(baseQuality, move.Tour2, city, distance, overload, tardiness)); 141 141 } 142 142 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMultiMoveGenerator.cs
r7774 r7865 32 32 33 33 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 34 [Item("Potvin OnePointCrossoverMultiMoveGenerator", "Generates customer relocationmoves from a given VRP encoding.")]34 [Item("PotvinTwoOptStarMultiMoveGenerator", "Generates two opt star moves from a given VRP encoding.")] 35 35 [StorableClass] 36 public sealed class Potvin OnePointCrossoverMultiMoveGenerator : PotvinOnePointCrossoverMoveGenerator, IMultiMoveGenerator, IMultiVRPMoveGenerator {36 public sealed class PotvinTwoOptStarMultiMoveGenerator : PotvinTwoOptStarMoveGenerator, IMultiMoveGenerator, IMultiVRPMoveGenerator { 37 37 public ILookupParameter<IRandom> RandomParameter { 38 38 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } … … 44 44 45 45 public override IDeepCloneable Clone(Cloner cloner) { 46 return new Potvin OnePointCrossoverMultiMoveGenerator(this, cloner);46 return new PotvinTwoOptStarMultiMoveGenerator(this, cloner); 47 47 } 48 48 49 49 [StorableConstructor] 50 private Potvin OnePointCrossoverMultiMoveGenerator(bool deserializing) : base(deserializing) { }50 private PotvinTwoOptStarMultiMoveGenerator(bool deserializing) : base(deserializing) { } 51 51 52 public Potvin OnePointCrossoverMultiMoveGenerator()52 public PotvinTwoOptStarMultiMoveGenerator() 53 53 : base() { 54 54 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); … … 56 56 } 57 57 58 private Potvin OnePointCrossoverMultiMoveGenerator(PotvinOnePointCrossoverMoveGenerator original, Cloner cloner)58 private PotvinTwoOptStarMultiMoveGenerator(PotvinTwoOptStarMoveGenerator original, Cloner cloner) 59 59 : base(original, cloner) { 60 60 } 61 61 62 protected override Potvin OnePointCrossoverMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) {63 List<Potvin OnePointCrossoverMove> result = new List<PotvinOnePointCrossoverMove>();62 protected override PotvinTwoOptStarMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) { 63 List<PotvinTwoOptStarMove> result = new List<PotvinTwoOptStarMove>(); 64 64 65 65 for (int i = 0; i < SampleSizeParameter.ActualValue.Value; i++) { 66 result.Add(Potvin OnePointCrossoverSingleMoveGenerator.Apply(individual, ProblemInstance, RandomParameter.ActualValue));66 result.Add(PotvinTwoOptStarSingleMoveGenerator.Apply(individual, ProblemInstance, RandomParameter.ActualValue)); 67 67 } 68 68 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarSingleMoveGenerator.cs
r7774 r7865 32 32 33 33 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { 34 [Item("Potvin OnePointCrossoverSingleMoveGenerator", "Generates a single customer relocationmove from a given VRP encoding.")]34 [Item("PotvinTwoOptStarSingleMoveGenerator", "Generates a single two opt star move from a given VRP encoding.")] 35 35 [StorableClass] 36 public sealed class Potvin OnePointCrossoverSingleMoveGenerator : PotvinOnePointCrossoverMoveGenerator,36 public sealed class PotvinTwoOptStarSingleMoveGenerator : PotvinTwoOptStarMoveGenerator, 37 37 ISingleMoveGenerator { 38 38 #region IMultiVRPMoveOperator Members 39 39 40 40 public override ILookupParameter VRPMoveParameter { 41 get { return (ILookupParameter)Parameters["Potvin OnePointCrossoverMove"]; }41 get { return (ILookupParameter)Parameters["PotvinTwoOptStarMove"]; } 42 42 } 43 43 … … 49 49 50 50 public override IDeepCloneable Clone(Cloner cloner) { 51 return new Potvin OnePointCrossoverSingleMoveGenerator(this, cloner);51 return new PotvinTwoOptStarSingleMoveGenerator(this, cloner); 52 52 } 53 53 54 54 [StorableConstructor] 55 private Potvin OnePointCrossoverSingleMoveGenerator(bool deserializing) : base(deserializing) { }55 private PotvinTwoOptStarSingleMoveGenerator(bool deserializing) : base(deserializing) { } 56 56 57 public Potvin OnePointCrossoverSingleMoveGenerator()57 public PotvinTwoOptStarSingleMoveGenerator() 58 58 : base() { 59 59 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator.")); 60 60 } 61 61 62 private Potvin OnePointCrossoverSingleMoveGenerator(PotvinOnePointCrossoverMoveGenerator original, Cloner cloner)62 private PotvinTwoOptStarSingleMoveGenerator(PotvinTwoOptStarMoveGenerator original, Cloner cloner) 63 63 : base(original, cloner) { 64 64 } 65 65 66 public static Potvin OnePointCrossoverMove Apply(PotvinEncoding individual, IVRPProblemInstance problemInstance, IRandom rand) {66 public static PotvinTwoOptStarMove Apply(PotvinEncoding individual, IVRPProblemInstance problemInstance, IRandom rand) { 67 67 int route1Idx = rand.Next(individual.Tours.Count); 68 68 int route2Idx = rand.Next(individual.Tours.Count - 1); … … 76 76 int x2 = rand.Next(route2.Stops.Count + 1); 77 77 78 return new Potvin OnePointCrossoverMove(route1Idx, x1, route2Idx, x2, individual);78 return new PotvinTwoOptStarMove(route1Idx, x1, route2Idx, x2, individual); 79 79 } 80 80 81 protected override Potvin OnePointCrossoverMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) {82 List<Potvin OnePointCrossoverMove> result = new List<PotvinOnePointCrossoverMove>();81 protected override PotvinTwoOptStarMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) { 82 List<PotvinTwoOptStarMove> result = new List<PotvinTwoOptStarMove>(); 83 83 84 Potvin OnePointCrossoverMove move = Apply(individual, ProblemInstance, RandomParameter.ActualValue);84 PotvinTwoOptStarMove move = Apply(individual, ProblemInstance, RandomParameter.ActualValue); 85 85 if (move != null) 86 86 result.Add(move); -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj
r7855 r7865 179 179 <Compile Include="Analyzer\ConstraintRelaxation\TimeWindowed\TimeWindowRelaxationVRPAnalyzer.cs" /> 180 180 <Compile Include="Analyzer\VRPSolution.cs" /> 181 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\IPotvinOnePointCrossoverMoveOperator.cs" />182 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\PotvinOnePointCrossoverExhaustiveMoveGenerator.cs" />183 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\PotvinOnePointCrossoverMove.cs" />184 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\PotvinOnePointCrossoverMoveAttribute.cs" />185 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\PotvinOnePointCrossoverMoveEvaluator.cs" />186 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\PotvinOnePointCrossoverMoveGenerator.cs" />187 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\PotvinOnePointCrossoverMoveMaker.cs" />188 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\PotvinOnePointCrossoverMoveTabuCriterion.cs" />189 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\PotvinOnePointCrossoverMoveTabuMaker.cs" />190 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\PotvinOnePointCrossoverMultiMoveGenerator.cs" />191 <Compile Include="Encodings\Potvin\Moves\ OnePointCrossover\PotvinOnePointCrossoverSingleMoveGenerator.cs" />181 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\IPotvinTwoOptStarMoveOperator.cs" /> 182 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarExhaustiveMoveGenerator.cs" /> 183 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarMove.cs" /> 184 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarMoveAttribute.cs" /> 185 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarMoveEvaluator.cs" /> 186 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarMoveGenerator.cs" /> 187 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarMoveMaker.cs" /> 188 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarMoveTabuCriterion.cs" /> 189 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarMoveTabuMaker.cs" /> 190 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarMultiMoveGenerator.cs" /> 191 <Compile Include="Encodings\Potvin\Moves\TwoOptStar\PotvinTwoOptStarSingleMoveGenerator.cs" /> 192 192 <Compile Include="Interfaces\IVRPLocalSearchManipulator.cs" /> 193 193 <Compile Include="Properties\AssemblyInfo.cs" /> 194 194 <Compile Include="Encodings\Alba\AlbaEncoding.cs" /> 195 <Compile Include="Encodings\Alba\Creators\DefaultRepresentationCreator.cs" />196 195 <Compile Include="Encodings\Alba\Creators\RandomCreator.cs" /> 197 196 <Compile Include="Encodings\Alba\Creators\AlbaCreator.cs" />
Note: See TracChangeset
for help on using the changeset viewer.