Changeset 8053 for trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators
- Timestamp:
- 06/19/12 13:17:29 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators/PrinsExhaustiveLSManipulator.cs
r4752 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using HeuristicLab.Core;23 using HeuristicLab.Encodings.PermutationEncoding;24 using HeuristicLab.Parameters;25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;26 using HeuristicLab.Data;27 22 using System.Collections.Generic; 28 23 using HeuristicLab.Common; 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 26 30 27 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins { 31 28 [Item("PrinsExhaustiveLSManipulator", "An operator which manipulates a VRP representation by using the exhaustive Prins local search. It is implemented as described in Prins, C. (2004). A simple and effective evolutionary algorithm for the vehicle routing problem. Computers & Operations Research, 12:1985-2002.")] 32 29 [StorableClass] 33 public sealed class PrinsExhaustiveLSManipulator : PrinsLSManipulator { 30 public sealed class PrinsExhaustiveLSManipulator : PrinsLSManipulator { 34 31 [StorableConstructor] 35 32 private PrinsExhaustiveLSManipulator(bool deserializing) : base(deserializing) { } … … 79 76 80 77 iterations++; 81 } while (improvement && 78 } while (improvement && 82 79 iterations < Iterations.Value.Value); 83 80 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators/PrinsLSManipulator.cs
r7855 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 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 using HeuristicLab.Common;29 28 using HeuristicLab.Problems.VehicleRouting.Interfaces; 30 29 … … 36 35 get { return (IValueParameter<IntValue>)Parameters["Iterations"]; } 37 36 } 38 37 39 38 [StorableConstructor] 40 39 protected PrinsLSManipulator(bool deserializing) : base(deserializing) { } … … 60 59 if (individual[i] == city) 61 60 index = i; 62 61 63 62 i++; 64 63 } … … 78 77 if (tours[i].Stops.Contains(city)) 79 78 found = tours[i]; 80 79 81 80 i++; 82 81 } … … 184 183 int parentIndex = 0; 185 184 186 while (childIndex < child.Length) {185 while (childIndex < child.Length) { 187 186 if (parent[parentIndex] == u) { 188 187 child[childIndex] = v; … … 227 226 228 227 while (i < child.Length) { 229 if (parent[i] == x) {228 if (parent[i] == x) { 230 229 child[i] = y; 231 } else if (parent[i] == v) {230 } else if (parent[i] == v) { 232 231 child[i] = x; 233 } else if (parent[i] == y) {232 } else if (parent[i] == y) { 234 233 child[i] = v; 235 234 } else { … … 302 301 int x = tour.Stops[iu + 1] - 1; 303 302 304 if (x != v)303 if (x != v) 305 304 Swap(u, x, v, parent, child); 306 305 } … … 343 342 if (x != v && y != u) 344 343 Swap(x, v, parent, child); 345 346 344 } 345 } 347 346 } 348 347 } … … 393 392 } 394 393 395 protected PrinsEncoding Manipulate(PrinsEncoding individual, 394 protected PrinsEncoding Manipulate(PrinsEncoding individual, 396 395 double originalQuality, int u, int v) { 397 396 PrinsEncoding child = null; -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators/PrinsManipulator.cs
r4752 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 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 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 29 28 using HeuristicLab.Problems.VehicleRouting.Interfaces; 30 using HeuristicLab.Common;31 29 32 30 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins { -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators/PrinsPermutationManipulator.cs
r5867 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 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 using HeuristicLab.Common;28 27 29 28 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins { … … 40 39 public PrinsPermutationManipulator() 41 40 : base() { 42 41 Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("InnerManipulator", "The permutation manipulator.", new TranslocationManipulator())); 43 42 } 44 43 -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators/PrinsStochasticLSManipulator.cs
r4752 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 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 using HeuristicLab.Common;29 28 30 29 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins { … … 35 34 get { return (IValueParameter<IntValue>)Parameters["SampleSize"]; } 36 35 } 37 36 38 37 [StorableConstructor] 39 38 private PrinsStochasticLSManipulator(bool deserializing) : base(deserializing) { } … … 41 40 public PrinsStochasticLSManipulator() 42 41 : base() { 43 42 Parameters.Add(new ValueParameter<IntValue>("SampleSize", "The sample size.", new IntValue(200))); 44 43 } 45 44 … … 65 64 while (!improvement && 66 65 samples < SampleSize.Value.Value) { 67 68 66 int u = random.Next(ProblemInstance.Cities.Value); 67 int v = random.Next(ProblemInstance.Cities.Value); 69 68 70 71 69 child = Manipulate(individual, 70 originalQuality, u, v); 72 71 73 72 improvement = child != null; 74 73 75 74 samples++; 76 75 } 77 76 … … 83 82 84 83 iterations++; 85 } while (improvement && 84 } while (improvement && 86 85 iterations < Iterations.Value.Value); 87 86 }
Note: See TracChangeset
for help on using the changeset viewer.