Changeset 4722 for trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers
- Timestamp:
- 11/06/10 01:56:04 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 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/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;
Note: See TracChangeset
for help on using the changeset viewer.