Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/12 13:17:29 (13 years ago)
Author:
ascheibe
Message:

#1722 fixed more licensing information and source formatting

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  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
    22 using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
    24 using HeuristicLab.Parameters;
    25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    2722using System.Collections.Generic;
    2823using HeuristicLab.Common;
     24using HeuristicLab.Core;
     25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2926
    3027namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins {
    3128  [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.")]
    3229  [StorableClass]
    33   public sealed class PrinsExhaustiveLSManipulator : PrinsLSManipulator {   
     30  public sealed class PrinsExhaustiveLSManipulator : PrinsLSManipulator {
    3431    [StorableConstructor]
    3532    private PrinsExhaustiveLSManipulator(bool deserializing) : base(deserializing) { }
     
    7976
    8077        iterations++;
    81       } while (improvement && 
     78      } while (improvement &&
    8279        iterations < Iterations.Value.Value);
    8380    }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators/PrinsLSManipulator.cs

    r7855 r8053  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
     22using System.Collections.Generic;
     23using HeuristicLab.Common;
    2224using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
     25using HeuristicLab.Data;
    2426using HeuristicLab.Parameters;
    2527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    27 using System.Collections.Generic;
    28 using HeuristicLab.Common;
    2928using HeuristicLab.Problems.VehicleRouting.Interfaces;
    3029
     
    3635      get { return (IValueParameter<IntValue>)Parameters["Iterations"]; }
    3736    }
    38        
     37
    3938    [StorableConstructor]
    4039    protected PrinsLSManipulator(bool deserializing) : base(deserializing) { }
     
    6059        if (individual[i] == city)
    6160          index = i;
    62        
     61
    6362        i++;
    6463      }
     
    7877        if (tours[i].Stops.Contains(city))
    7978          found = tours[i];
    80        
     79
    8180        i++;
    8281      }
     
    184183      int parentIndex = 0;
    185184
    186       while(childIndex < child.Length) {
     185      while (childIndex < child.Length) {
    187186        if (parent[parentIndex] == u) {
    188187          child[childIndex] = v;
     
    227226
    228227      while (i < child.Length) {
    229         if(parent[i] == x) {
     228        if (parent[i] == x) {
    230229          child[i] = y;
    231         } else if(parent[i] == v) {
     230        } else if (parent[i] == v) {
    232231          child[i] = x;
    233         } else if(parent[i] == y) {
     232        } else if (parent[i] == y) {
    234233          child[i] = v;
    235234        } else {
     
    302301          int x = tour.Stops[iu + 1] - 1;
    303302
    304           if(x != v)
     303          if (x != v)
    305304            Swap(u, x, v, parent, child);
    306305        }
     
    343342              if (x != v && y != u)
    344343                Swap(x, v, parent, child);
    345              }
    346            }
     344            }
     345          }
    347346        }
    348347      }
     
    393392    }
    394393
    395     protected PrinsEncoding Manipulate(PrinsEncoding individual, 
     394    protected PrinsEncoding Manipulate(PrinsEncoding individual,
    396395      double originalQuality, int u, int v) {
    397396      PrinsEncoding child = null;
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators/PrinsManipulator.cs

    r4752 r8053  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
     24using HeuristicLab.Optimization;
    2425using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    27 using HeuristicLab.Optimization;
    2827using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    2928using HeuristicLab.Problems.VehicleRouting.Interfaces;
    30 using HeuristicLab.Common;
    3129
    3230namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators/PrinsPermutationManipulator.cs

    r5867 r8053  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.PermutationEncoding;
    2425using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    27 using HeuristicLab.Common;
    2827
    2928namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins {
     
    4039    public PrinsPermutationManipulator()
    4140      : base() {
    42         Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("InnerManipulator", "The permutation manipulator.", new TranslocationManipulator()));
     41      Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("InnerManipulator", "The permutation manipulator.", new TranslocationManipulator()));
    4342    }
    4443
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/Manipulators/PrinsStochasticLSManipulator.cs

    r4752 r8053  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
     22using System.Collections.Generic;
     23using HeuristicLab.Common;
    2224using HeuristicLab.Core;
    23 using HeuristicLab.Encodings.PermutationEncoding;
     25using HeuristicLab.Data;
    2426using HeuristicLab.Parameters;
    2527using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Data;
    27 using System.Collections.Generic;
    28 using HeuristicLab.Common;
    2928
    3029namespace HeuristicLab.Problems.VehicleRouting.Encodings.Prins {
     
    3534      get { return (IValueParameter<IntValue>)Parameters["SampleSize"]; }
    3635    }
    37    
     36
    3837    [StorableConstructor]
    3938    private PrinsStochasticLSManipulator(bool deserializing) : base(deserializing) { }
     
    4140    public PrinsStochasticLSManipulator()
    4241      : base() {
    43         Parameters.Add(new ValueParameter<IntValue>("SampleSize", "The sample size.", new IntValue(200)));
     42      Parameters.Add(new ValueParameter<IntValue>("SampleSize", "The sample size.", new IntValue(200)));
    4443    }
    4544
     
    6564        while (!improvement &&
    6665          samples < SampleSize.Value.Value) {
    67             int u = random.Next(ProblemInstance.Cities.Value);
    68             int v = random.Next(ProblemInstance.Cities.Value);
     66          int u = random.Next(ProblemInstance.Cities.Value);
     67          int v = random.Next(ProblemInstance.Cities.Value);
    6968
    70             child = Manipulate(individual,
    71                   originalQuality, u, v);
     69          child = Manipulate(individual,
     70                originalQuality, u, v);
    7271
    73             improvement = child != null;
     72          improvement = child != null;
    7473
    75             samples++;
     74          samples++;
    7675        }
    7776
     
    8382
    8483        iterations++;
    85       } while (improvement && 
     84      } while (improvement &&
    8685        iterations < Iterations.Value.Value);
    8786    }
Note: See TracChangeset for help on using the changeset viewer.