Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/22/12 09:53:07 (13 years ago)
Author:
svonolfe
Message:

Fixed naming of moves (#1177)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings
Files:
1 added
2 deleted
1 edited
11 copied

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Creators/RandomCreator.cs

    r7543 r7865  
    3333  [Item("RandomCreator", "Creates a randomly initialized VRP solution.")]
    3434  [StorableClass]
    35   public sealed class RandomCreator : DefaultRepresentationCreator, IStochasticOperator {
     35  public sealed class RandomCreator : AlbaCreator, IStochasticOperator {
    3636    #region IStochasticOperator Members
    3737    public ILookupParameter<IRandom> RandomParameter {
     
    5656    }
    5757
    58     protected override List<int> CreateSolution() {
     58    private List<int> CreateSolution() {
    5959      int cities = ProblemInstance.Cities.Value;
    6060      int vehicles = ProblemInstance.Vehicles.Value;
     
    8888      return new List<int>(perm);
    8989    }
     90
     91    public override IOperation Apply() {
     92      //choose default encoding here
     93      VRPToursParameter.ActualValue = AlbaEncoding.ConvertFrom(CreateSolution(), ProblemInstance);
     94
     95      return base.Apply();
     96    }
    9097  }
    9198}
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/IPotvinTwoOptStarMoveOperator.cs

    r7774 r7865  
    2626
    2727namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    28   public interface IPotvinOnePointCrossoverMoveOperator : IVRPMoveOperator {
    29     ILookupParameter<PotvinOnePointCrossoverMove> OnePointCrossoverMoveParameter { get; }
     28  public interface IPotvinTwoOptStarMoveOperator : IVRPMoveOperator {
     29    ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter { get; }
    3030  }
    3131}
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarExhaustiveMoveGenerator.cs

    r7774 r7865  
    3030
    3131namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    32   [Item("PotvinOnePointCrossoverExhaustiveMoveGenerator", "Generates customer relocation moves from a given VRP encoding.")]
     32  [Item("PotvinTwoOptStarExhaustiveMoveGenerator", "Generates two opt star moves from a given VRP encoding.")]
    3333  [StorableClass]
    34   public sealed class PotvinOnePointCrossoverExhaustiveMoveGenerator : PotvinOnePointCrossoverMoveGenerator, IExhaustiveMoveGenerator {
     34  public sealed class PotvinTwoOptStarExhaustiveMoveGenerator : PotvinTwoOptStarMoveGenerator, IExhaustiveMoveGenerator {
    3535    public override IDeepCloneable Clone(Cloner cloner) {
    36       return new PotvinOnePointCrossoverExhaustiveMoveGenerator(this, cloner);
     36      return new PotvinTwoOptStarExhaustiveMoveGenerator(this, cloner);
    3737    }
    3838
    3939    [StorableConstructor]
    40     private PotvinOnePointCrossoverExhaustiveMoveGenerator(bool deserializing) : base(deserializing) { }
     40    private PotvinTwoOptStarExhaustiveMoveGenerator(bool deserializing) : base(deserializing) { }
    4141
    42     public PotvinOnePointCrossoverExhaustiveMoveGenerator()
     42    public PotvinTwoOptStarExhaustiveMoveGenerator()
    4343      : base() {
    4444    }
    4545
    46     private PotvinOnePointCrossoverExhaustiveMoveGenerator(PotvinOnePointCrossoverMoveGenerator original, Cloner cloner)
     46    private PotvinTwoOptStarExhaustiveMoveGenerator(PotvinTwoOptStarMoveGenerator original, Cloner cloner)
    4747      : base(original, cloner) {
    4848    }
    4949
    50     protected override PotvinOnePointCrossoverMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) {
    51       List<PotvinOnePointCrossoverMove> result = new List<PotvinOnePointCrossoverMove>();
     50    protected override PotvinTwoOptStarMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) {
     51      List<PotvinTwoOptStarMove> result = new List<PotvinTwoOptStarMove>();
    5252
    5353      for (int tour1 = 0; tour1 < individual.Tours.Count; tour1++) {
     
    5757              if ((index1 != individual.Tours[tour1].Stops.Count || index2 != individual.Tours[tour2].Stops.Count) &&
    5858                  (index1 != 0 || index2 != 0))
    59                 result.Add(new PotvinOnePointCrossoverMove(tour1, index1, tour2, index2, individual));
     59                result.Add(new PotvinTwoOptStarMove(tour1, index1, tour2, index2, individual));
    6060            }
    6161          }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMove.cs

    r7774 r7865  
    3131
    3232namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    33   [Item("PotvinOnePointCrossoverMove", "Item that describes a relocation move on a VRP representation.")]
     33  [Item("PotvinTwoOptStarMove", "Item that describes a two opt star move on a VRP representation.")]
    3434  [StorableClass]
    35   public class PotvinOnePointCrossoverMove: Item, IVRPMove {
     35  public class PotvinTwoOptStarMove: Item, IVRPMove {
    3636    [Storable]
    3737    public IVRPEncoding Individual { get; protected set; }
     
    4949    public int X2 { get; protected set; }
    5050   
    51     public PotvinOnePointCrossoverMove(): base() {
     51    public PotvinTwoOptStarMove(): base() {
    5252      X1 = -1;
    5353      Tour1 = -1;
     
    5858    }
    5959
    60     public PotvinOnePointCrossoverMove(int tour1, int x1, int tour2, int x2, PotvinEncoding individual) {
     60    public PotvinTwoOptStarMove(int tour1, int x1, int tour2, int x2, PotvinEncoding individual) {
    6161      Tour1 = tour1;
    6262      X1 = x1;
     
    6868
    6969    public override IDeepCloneable Clone(Cloner cloner) {
    70       return new PotvinOnePointCrossoverMove(this, cloner);
     70      return new PotvinTwoOptStarMove(this, cloner);
    7171    }
    7272
    73     protected PotvinOnePointCrossoverMove(PotvinOnePointCrossoverMove original, Cloner cloner)
     73    protected PotvinTwoOptStarMove(PotvinTwoOptStarMove original, Cloner cloner)
    7474      : base(original, cloner) {
    7575      this.Tour1 = original.Tour1;
     
    8484
    8585    public VRPMoveEvaluator GetMoveEvaluator() {
    86       return new PotvinOnePointCrossoverMoveEvaluator();
     86      return new PotvinTwoOptStarMoveEvaluator();
    8787    }
    8888
    8989    public VRPMoveMaker GetMoveMaker() {
    90       return new PotvinOnePointCrossoverMoveMaker();
     90      return new PotvinTwoOptStarMoveMaker();
    9191    }
    9292
    9393    public ITabuMaker GetTabuMaker() {
    94       return new PotvinOnePointCrossoverMoveTabuMaker();
     94      return new PotvinTwoOptStarMoveTabuMaker();
    9595    }
    9696
    9797    public ITabuChecker GetTabuChecker() {
    98       return new PotvinOnePointCrossoverMoveTabuCriterion();
     98      return new PotvinTwoOptStarMoveTabuCriterion();
    9999    }
    100100
    101101    public ITabuChecker GetSoftTabuChecker() {
    102       PotvinOnePointCrossoverMoveTabuCriterion tabuChecker = new PotvinOnePointCrossoverMoveTabuCriterion();
     102      PotvinTwoOptStarMoveTabuCriterion tabuChecker = new PotvinTwoOptStarMoveTabuCriterion();
    103103      tabuChecker.UseAspirationCriterion.Value = true;
    104104
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveAttribute.cs

    r7774 r7865  
    2626
    2727namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    28   [Item("PotvinOnePointCrossoverMoveAttribute", "Customer relocation move attribute")]
     28  [Item("PotvinTwoOptStarMoveAttribute", "Two opt star move attribute")]
    2929  [StorableClass]
    30   public class PotvinOnePointCrossoverMoveAttribute : VRPMoveAttribute {
     30  public class PotvinTwoOptStarMoveAttribute : VRPMoveAttribute {
    3131    [Storable]
    3232    public int Tour { get; private set; }
     
    4242
    4343    [StorableConstructor]
    44     protected PotvinOnePointCrossoverMoveAttribute(bool deserializing) : base(deserializing) { }
    45     protected PotvinOnePointCrossoverMoveAttribute(PotvinOnePointCrossoverMoveAttribute original, Cloner cloner)
     44    protected PotvinTwoOptStarMoveAttribute(bool deserializing) : base(deserializing) { }
     45    protected PotvinTwoOptStarMoveAttribute(PotvinTwoOptStarMoveAttribute original, Cloner cloner)
    4646      : base(original, cloner) {
    4747        this.Tour = original.Tour;
     
    5151        this.Tardiness = original.Tardiness;
    5252    }
    53     public PotvinOnePointCrossoverMoveAttribute(double moveQuality, int tour, int city,
     53    public PotvinTwoOptStarMoveAttribute(double moveQuality, int tour, int city,
    5454      double distance, double overload, double tardiness)
    5555      : base(moveQuality) {
     
    6262
    6363    public override IDeepCloneable Clone(Cloner cloner) {
    64       return new PotvinOnePointCrossoverMoveAttribute(this, cloner);
     64      return new PotvinTwoOptStarMoveAttribute(this, cloner);
    6565    }
    6666
     
    7070
    7171    public override bool Equals(object obj) {
    72       if (obj is PotvinOnePointCrossoverMoveAttribute) {
    73         PotvinOnePointCrossoverMoveAttribute other = obj as PotvinOnePointCrossoverMoveAttribute;
     72      if (obj is PotvinTwoOptStarMoveAttribute) {
     73        PotvinTwoOptStarMoveAttribute other = obj as PotvinTwoOptStarMoveAttribute;
    7474
    7575        return Tour == other.Tour && City == other.City;
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveEvaluator.cs

    r7774 r7865  
    2929
    3030namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    31   [Item("PotvinOnePointCrossoverMoveEvaluator", "Evaluates a customer relocation move for a VRP representation. ")]
     31  [Item("PotvinTwoOptStarMoveEvaluator", "Evaluates a two opt star move for a VRP representation. ")]
    3232  [StorableClass]
    33   public sealed class PotvinOnePointCrossoverMoveEvaluator : PotvinMoveEvaluator, IPotvinOnePointCrossoverMoveOperator {
    34     public ILookupParameter<PotvinOnePointCrossoverMove> OnePointCrossoverMoveParameter {
    35       get { return (ILookupParameter<PotvinOnePointCrossoverMove>)Parameters["PotvinOnePointCrossoverMove"]; }
     33  public sealed class PotvinTwoOptStarMoveEvaluator : PotvinMoveEvaluator, IPotvinTwoOptStarMoveOperator {
     34    public ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter {
     35      get { return (ILookupParameter<PotvinTwoOptStarMove>)Parameters["PotvinTwoOptStarMove"]; }
    3636    }
    3737
    3838    public override ILookupParameter VRPMoveParameter {
    39       get { return OnePointCrossoverMoveParameter; }
     39      get { return TwoOptStarMoveParameter; }
    4040    }
    4141    [StorableConstructor]
    42     private PotvinOnePointCrossoverMoveEvaluator(bool deserializing) : base(deserializing) { }
     42    private PotvinTwoOptStarMoveEvaluator(bool deserializing) : base(deserializing) { }
    4343
    44     public PotvinOnePointCrossoverMoveEvaluator()
     44    public PotvinTwoOptStarMoveEvaluator()
    4545      : base() {
    46        Parameters.Add(new LookupParameter<PotvinOnePointCrossoverMove>("PotvinOnePointCrossoverMove", "The move that should be evaluated."));
     46       Parameters.Add(new LookupParameter<PotvinTwoOptStarMove>("PotvinTwoOptStarMove", "The move that should be evaluated."));
    4747    }
    4848
    4949    public override IDeepCloneable Clone(Cloner cloner) {
    50       return new PotvinOnePointCrossoverMoveEvaluator(this, cloner);
     50      return new PotvinTwoOptStarMoveEvaluator(this, cloner);
    5151    }
    5252
    53     private PotvinOnePointCrossoverMoveEvaluator(PotvinOnePointCrossoverMoveEvaluator original, Cloner cloner)
     53    private PotvinTwoOptStarMoveEvaluator(PotvinTwoOptStarMoveEvaluator original, Cloner cloner)
    5454      : base(original, cloner) {
    5555    }
    5656
    5757    protected override void EvaluateMove() {
    58       PotvinOnePointCrossoverMove move = OnePointCrossoverMoveParameter.ActualValue;
     58      PotvinTwoOptStarMove move = TwoOptStarMoveParameter.ActualValue;
    5959
    60       PotvinEncoding newSolution = OnePointCrossoverMoveParameter.ActualValue.Individual.Clone() as PotvinEncoding;
    61       PotvinOnePointCrossoverMoveMaker.Apply(newSolution, move, ProblemInstance);
     60      PotvinEncoding newSolution = TwoOptStarMoveParameter.ActualValue.Individual.Clone() as PotvinEncoding;
     61      PotvinTwoOptStarMoveMaker.Apply(newSolution, move, ProblemInstance);
    6262
    6363      UpdateEvaluation(newSolution);
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveGenerator.cs

    r7774 r7865  
    3030
    3131namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    32   [Item("PotvinOnePointCrossoverMoveGenerator", "Generates customer relocation moves from a given VRP encoding.")]
     32  [Item("PotvinTwoOptStarMoveGenerator", "Generates two opt star moves from a given VRP encoding.")]
    3333  [StorableClass]
    34   public abstract class PotvinOnePointCrossoverMoveGenerator : PotvinMoveGenerator, IPotvinOnePointCrossoverMoveOperator {
    35     public ILookupParameter<PotvinOnePointCrossoverMove> OnePointCrossoverMoveParameter {
    36       get { return (ILookupParameter<PotvinOnePointCrossoverMove>)Parameters["PotvinOnePointCrossoverMove"]; }
     34  public abstract class PotvinTwoOptStarMoveGenerator : PotvinMoveGenerator, IPotvinTwoOptStarMoveOperator {
     35    public ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter {
     36      get { return (ILookupParameter<PotvinTwoOptStarMove>)Parameters["PotvinTwoOptStarMove"]; }
    3737    }
    3838
    3939    public override ILookupParameter VRPMoveParameter {
    40       get { return OnePointCrossoverMoveParameter; }
     40      get { return TwoOptStarMoveParameter; }
    4141    }
    4242
     
    4646
    4747    [StorableConstructor]
    48     protected PotvinOnePointCrossoverMoveGenerator(bool deserializing) : base(deserializing) { }
     48    protected PotvinTwoOptStarMoveGenerator(bool deserializing) : base(deserializing) { }
    4949
    50     public PotvinOnePointCrossoverMoveGenerator()
     50    public PotvinTwoOptStarMoveGenerator()
    5151      : base() {
    52         Parameters.Add(new LookupParameter<PotvinOnePointCrossoverMove>("PotvinOnePointCrossoverMove", "The moves that should be generated in subscopes."));
     52        Parameters.Add(new LookupParameter<PotvinTwoOptStarMove>("PotvinTwoOptStarMove", "The moves that should be generated in subscopes."));
    5353        Parameters.Add(new ScopeParameter("CurrentScope", "The current scope where the moves should be added as subscopes."));
    5454    }
    5555
    56     protected PotvinOnePointCrossoverMoveGenerator(PotvinOnePointCrossoverMoveGenerator original, Cloner cloner)
     56    protected PotvinTwoOptStarMoveGenerator(PotvinTwoOptStarMoveGenerator original, Cloner cloner)
    5757      : base(original, cloner) {
    5858    }
    5959
    60     protected abstract PotvinOnePointCrossoverMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance);
     60    protected abstract PotvinTwoOptStarMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance);
    6161
    6262    public override IOperation Apply() {
     
    6464
    6565      PotvinEncoding individual = VRPToursParameter.ActualValue as PotvinEncoding;
    66       PotvinOnePointCrossoverMove[] moves = GenerateMoves(individual, ProblemInstance);
     66      PotvinTwoOptStarMove[] moves = GenerateMoves(individual, ProblemInstance);
    6767      Scope[] moveScopes = new Scope[moves.Length];
    6868      for (int i = 0; i < moveScopes.Length; i++) {
    6969        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]));
    7171      }
    7272      CurrentScopeParameter.ActualValue.SubScopes.AddRange(moveScopes);
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveMaker.cs

    r7774 r7865  
    3333
    3434namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    35   [Item("PotvinOnePointCrossoverMoveMaker", "Peforms the customer relocation move 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.")]
    3636  [StorableClass]
    37   public class PotvinOnePointCrossoverMoveMaker : PotvinMoveMaker, IPotvinOnePointCrossoverMoveOperator, IMoveMaker {
    38     public ILookupParameter<PotvinOnePointCrossoverMove> OnePointCrossoverMoveParameter {
    39       get { return (ILookupParameter<PotvinOnePointCrossoverMove>)Parameters["PotvinOnePointCrossoverMove"]; }
     37  public class PotvinTwoOptStarMoveMaker : PotvinMoveMaker, IPotvinTwoOptStarMoveOperator, IMoveMaker {
     38    public ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter {
     39      get { return (ILookupParameter<PotvinTwoOptStarMove>)Parameters["PotvinTwoOptStarMove"]; }
    4040    }
    4141
    4242    public override ILookupParameter VRPMoveParameter {
    43          get { return OnePointCrossoverMoveParameter; }
     43         get { return TwoOptStarMoveParameter; }
    4444    }
    4545
    4646    [StorableConstructor]
    47     private PotvinOnePointCrossoverMoveMaker(bool deserializing) : base(deserializing) { }
     47    private PotvinTwoOptStarMoveMaker(bool deserializing) : base(deserializing) { }
    4848
    49     public PotvinOnePointCrossoverMoveMaker()
     49    public PotvinTwoOptStarMoveMaker()
    5050      : base() {
    51       Parameters.Add(new LookupParameter<PotvinOnePointCrossoverMove>("PotvinOnePointCrossoverMove", "The moves that should be made."));
     51      Parameters.Add(new LookupParameter<PotvinTwoOptStarMove>("PotvinTwoOptStarMove", "The moves that should be made."));
    5252    }
    5353
    5454    public override IDeepCloneable Clone(Cloner cloner) {
    55       return new PotvinOnePointCrossoverMoveMaker(this, cloner);
     55      return new PotvinTwoOptStarMoveMaker(this, cloner);
    5656    }
    5757
    58     protected PotvinOnePointCrossoverMoveMaker(PotvinOnePointCrossoverMoveMaker original, Cloner cloner)
     58    protected PotvinTwoOptStarMoveMaker(PotvinTwoOptStarMoveMaker original, Cloner cloner)
    5959      : base(original, cloner) {
    6060    }
    6161
    62     public static void GetSegments(PotvinOnePointCrossoverMove move, out List<int> segmentX1, out List<int> segmentX2) {
     62    public static void GetSegments(PotvinTwoOptStarMove move, out List<int> segmentX1, out List<int> segmentX2) {
    6363      PotvinEncoding solution = move.Individual as PotvinEncoding;
    6464     
     
    8282    }
    8383
    84     public static void Apply(PotvinEncoding solution, PotvinOnePointCrossoverMove move, IVRPProblemInstance problemInstance) {
     84    public static void Apply(PotvinEncoding solution, PotvinTwoOptStarMove move, IVRPProblemInstance problemInstance) {
    8585      List<int> segmentX1;
    8686      List<int> segmentX2;
     
    100100       
    101101    protected override void PerformMove() {
    102       PotvinOnePointCrossoverMove move = OnePointCrossoverMoveParameter.ActualValue;
     102      PotvinTwoOptStarMove move = TwoOptStarMoveParameter.ActualValue;
    103103
    104104      PotvinEncoding newSolution = move.Individual.Clone() as PotvinEncoding;
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveTabuCriterion.cs

    r7774 r7865  
    3232
    3333namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    34   [Item("PotvinOnePointCrossoverTabuCriterion", @"Checks if a certain customer relocation move is tabu.")]
     34  [Item("PotvinTwoOptStarTabuCriterion", @"Checks if a certain two opt star move is tabu.")]
    3535  [StorableClass]
    36   public class PotvinOnePointCrossoverMoveTabuCriterion : SingleSuccessorOperator, IPotvinOnePointCrossoverMoveOperator, ITabuChecker, IPotvinOperator, IVRPMoveOperator {
     36  public class PotvinTwoOptStarMoveTabuCriterion : SingleSuccessorOperator, IPotvinTwoOptStarMoveOperator, ITabuChecker, IPotvinOperator, IVRPMoveOperator {
    3737    public override bool CanChangeName {
    3838      get { return false; }
    3939    }
    4040
    41     public ILookupParameter<PotvinOnePointCrossoverMove> OnePointCrossoverMoveParameter {
    42       get { return (ILookupParameter<PotvinOnePointCrossoverMove>)Parameters["PotvinOnePointCrossoverMove"]; }
     41    public ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter {
     42      get { return (ILookupParameter<PotvinTwoOptStarMove>)Parameters["PotvinTwoOptStarMove"]; }
    4343    }
    4444    public ILookupParameter VRPMoveParameter {
    45       get { return OnePointCrossoverMoveParameter; }
     45      get { return TwoOptStarMoveParameter; }
    4646    }
    4747    public ILookupParameter<IVRPEncoding> VRPToursParameter {
     
    8484
    8585    [StorableConstructor]
    86     protected PotvinOnePointCrossoverMoveTabuCriterion(bool deserializing) : base(deserializing) { }
    87     protected PotvinOnePointCrossoverMoveTabuCriterion(PotvinOnePointCrossoverMoveTabuCriterion original, Cloner cloner) : base(original, cloner) { }
    88     public PotvinOnePointCrossoverMoveTabuCriterion()
     86    protected PotvinTwoOptStarMoveTabuCriterion(bool deserializing) : base(deserializing) { }
     87    protected PotvinTwoOptStarMoveTabuCriterion(PotvinTwoOptStarMoveTabuCriterion original, Cloner cloner) : base(original, cloner) { }
     88    public PotvinTwoOptStarMoveTabuCriterion()
    8989      : base() {
    90       Parameters.Add(new LookupParameter<PotvinOnePointCrossoverMove>("PotvinOnePointCrossoverMove", "The moves that should be made."));
     90      Parameters.Add(new LookupParameter<PotvinTwoOptStarMove>("PotvinTwoOptStarMove", "The moves that should be made."));
    9191      Parameters.Add(new LookupParameter<IVRPEncoding>("VRPTours", "The VRP tours considered in the move."));
    9292      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The VRP problem instance"));
     
    104104
    105105    public override IDeepCloneable Clone(Cloner cloner) {
    106       return new PotvinOnePointCrossoverMoveTabuCriterion(this, cloner);
     106      return new PotvinTwoOptStarMoveTabuCriterion(this, cloner);
    107107    }
    108108
     
    112112      bool useAspiration = UseAspirationCriterion.Value;
    113113      bool isTabu = false;
    114       PotvinOnePointCrossoverMove move = OnePointCrossoverMoveParameter.ActualValue;
     114      PotvinTwoOptStarMove move = TwoOptStarMoveParameter.ActualValue;
    115115
    116116      List<int> segmentX1;
    117117      List<int> segmentX2;
    118       PotvinOnePointCrossoverMoveMaker.GetSegments(move, out segmentX1, out segmentX2);
     118      PotvinTwoOptStarMoveMaker.GetSegments(move, out segmentX1, out segmentX2);
    119119
    120120      foreach (IItem tabuMove in tabuList) {
    121         PotvinOnePointCrossoverMoveAttribute attribute = tabuMove as PotvinOnePointCrossoverMoveAttribute;
     121        PotvinTwoOptStarMoveAttribute attribute = tabuMove as PotvinTwoOptStarMoveAttribute;
    122122
    123123        if (attribute != null) {
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMoveTabuMaker.cs

    r7774 r7865  
    3232
    3333namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    34   [Item("PotvinOnePointCrossoverMoveTabuMaker", "Declares a given exchange move as tabu.")]
     34  [Item("PotvinTwoOptStarMoveTabuMaker", "Declares a given two opt star move as tabu.")]
    3535  [StorableClass]
    36   public class PotvinOnePointCrossoverMoveTabuMaker : SingleSuccessorOperator, ITabuMaker, IPotvinOnePointCrossoverMoveOperator, IPotvinOperator, IVRPMoveOperator {
     36  public class PotvinTwoOptStarMoveTabuMaker : SingleSuccessorOperator, ITabuMaker, IPotvinTwoOptStarMoveOperator, IPotvinOperator, IVRPMoveOperator {
    3737    public LookupParameter<ItemList<IItem>> TabuListParameter {
    3838      get { return (LookupParameter<ItemList<IItem>>)Parameters["TabuList"]; }
     
    5252
    5353
    54     public ILookupParameter<PotvinOnePointCrossoverMove> OnePointCrossoverMoveParameter {
    55       get { return (ILookupParameter<PotvinOnePointCrossoverMove>)Parameters["PotvinOnePointCrossoverMove"]; }
     54    public ILookupParameter<PotvinTwoOptStarMove> TwoOptStarMoveParameter {
     55      get { return (ILookupParameter<PotvinTwoOptStarMove>)Parameters["PotvinTwoOptStarMove"]; }
    5656    }
    5757    public ILookupParameter VRPMoveParameter {
    58       get { return OnePointCrossoverMoveParameter; }
     58      get { return TwoOptStarMoveParameter; }
    5959    }
    6060    public ILookupParameter<IVRPEncoding> VRPToursParameter {
     
    7676
    7777    [StorableConstructor]
    78     protected PotvinOnePointCrossoverMoveTabuMaker(bool deserializing) : base(deserializing) { }
    79     protected PotvinOnePointCrossoverMoveTabuMaker(PotvinOnePointCrossoverMoveTabuMaker original, Cloner cloner) : base(original, cloner) { }
    80     public PotvinOnePointCrossoverMoveTabuMaker()
     78    protected PotvinTwoOptStarMoveTabuMaker(bool deserializing) : base(deserializing) { }
     79    protected PotvinTwoOptStarMoveTabuMaker(PotvinTwoOptStarMoveTabuMaker original, Cloner cloner) : base(original, cloner) { }
     80    public PotvinTwoOptStarMoveTabuMaker()
    8181      : base() {
    8282      Parameters.Add(new LookupParameter<ItemList<IItem>>("TabuList", "The tabu list where move attributes are stored."));
     
    8686      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, else if it is a minimization problem."));
    8787
    88       Parameters.Add(new LookupParameter<PotvinOnePointCrossoverMove>("PotvinOnePointCrossoverMove", "The moves that should be made."));
     88      Parameters.Add(new LookupParameter<PotvinTwoOptStarMove>("PotvinTwoOptStarMove", "The moves that should be made."));
    8989      Parameters.Add(new LookupParameter<IVRPEncoding>("VRPTours", "The VRP tours considered in the move."));
    9090      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The VRP problem instance"));
     
    9696
    9797    public override IDeepCloneable Clone(Cloner cloner) {
    98       return new PotvinOnePointCrossoverMoveTabuMaker(this, cloner);
     98      return new PotvinTwoOptStarMoveTabuMaker(this, cloner);
    9999    }
    100100
     
    123123        tardiness = TardinessParameter.ActualValue.Value;
    124124
    125       PotvinOnePointCrossoverMove move = OnePointCrossoverMoveParameter.ActualValue;
     125      PotvinTwoOptStarMove move = TwoOptStarMoveParameter.ActualValue;
    126126      double moveQuality = MoveQualityParameter.ActualValue.Value;
    127127      double quality = QualityParameter.ActualValue.Value;
     
    131131      List<int> segmentX1;
    132132      List<int> segmentX2;
    133       PotvinOnePointCrossoverMoveMaker.GetSegments(move, out segmentX1, out segmentX2);
     133      PotvinTwoOptStarMoveMaker.GetSegments(move, out segmentX1, out segmentX2);
    134134
    135135      foreach (int city in segmentX1) {
    136         tabuList.Add(new PotvinOnePointCrossoverMoveAttribute(baseQuality, move.Tour1, city, distance, overload, tardiness));
     136        tabuList.Add(new PotvinTwoOptStarMoveAttribute(baseQuality, move.Tour1, city, distance, overload, tardiness));
    137137      }
    138138
    139139      foreach (int city in segmentX2) {
    140         tabuList.Add(new PotvinOnePointCrossoverMoveAttribute(baseQuality, move.Tour2, city, distance, overload, tardiness));
     140        tabuList.Add(new PotvinTwoOptStarMoveAttribute(baseQuality, move.Tour2, city, distance, overload, tardiness));
    141141      }
    142142     
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarMultiMoveGenerator.cs

    r7774 r7865  
    3232
    3333namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    34   [Item("PotvinOnePointCrossoverMultiMoveGenerator", "Generates customer relocation moves from a given VRP encoding.")]
     34  [Item("PotvinTwoOptStarMultiMoveGenerator", "Generates two opt star moves from a given VRP encoding.")]
    3535  [StorableClass]
    36   public sealed class PotvinOnePointCrossoverMultiMoveGenerator : PotvinOnePointCrossoverMoveGenerator, IMultiMoveGenerator, IMultiVRPMoveGenerator {
     36  public sealed class PotvinTwoOptStarMultiMoveGenerator : PotvinTwoOptStarMoveGenerator, IMultiMoveGenerator, IMultiVRPMoveGenerator {
    3737    public ILookupParameter<IRandom> RandomParameter {
    3838      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
     
    4444
    4545    public override IDeepCloneable Clone(Cloner cloner) {
    46       return new PotvinOnePointCrossoverMultiMoveGenerator(this, cloner);
     46      return new PotvinTwoOptStarMultiMoveGenerator(this, cloner);
    4747    }
    4848
    4949    [StorableConstructor]
    50     private PotvinOnePointCrossoverMultiMoveGenerator(bool deserializing) : base(deserializing) { }
     50    private PotvinTwoOptStarMultiMoveGenerator(bool deserializing) : base(deserializing) { }
    5151
    52     public PotvinOnePointCrossoverMultiMoveGenerator()
     52    public PotvinTwoOptStarMultiMoveGenerator()
    5353      : base() {
    5454      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
     
    5656    }
    5757
    58     private PotvinOnePointCrossoverMultiMoveGenerator(PotvinOnePointCrossoverMoveGenerator original, Cloner cloner)
     58    private PotvinTwoOptStarMultiMoveGenerator(PotvinTwoOptStarMoveGenerator original, Cloner cloner)
    5959      : base(original, cloner) {
    6060    }
    6161
    62     protected override PotvinOnePointCrossoverMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) {
    63       List<PotvinOnePointCrossoverMove> result = new List<PotvinOnePointCrossoverMove>();
     62    protected override PotvinTwoOptStarMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) {
     63      List<PotvinTwoOptStarMove> result = new List<PotvinTwoOptStarMove>();
    6464
    6565      for (int i = 0; i < SampleSizeParameter.ActualValue.Value; i++) {
    66         result.Add(PotvinOnePointCrossoverSingleMoveGenerator.Apply(individual, ProblemInstance, RandomParameter.ActualValue));
     66        result.Add(PotvinTwoOptStarSingleMoveGenerator.Apply(individual, ProblemInstance, RandomParameter.ActualValue));
    6767      }
    6868
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/TwoOptStar/PotvinTwoOptStarSingleMoveGenerator.cs

    r7774 r7865  
    3232
    3333namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    34   [Item("PotvinOnePointCrossoverSingleMoveGenerator", "Generates a single customer relocation move from a given VRP encoding.")]
     34  [Item("PotvinTwoOptStarSingleMoveGenerator", "Generates a single two opt star move from a given VRP encoding.")]
    3535  [StorableClass]
    36   public sealed class PotvinOnePointCrossoverSingleMoveGenerator : PotvinOnePointCrossoverMoveGenerator,
     36  public sealed class PotvinTwoOptStarSingleMoveGenerator : PotvinTwoOptStarMoveGenerator,
    3737    ISingleMoveGenerator {
    3838    #region IMultiVRPMoveOperator Members
    3939
    4040    public override ILookupParameter VRPMoveParameter {
    41       get { return (ILookupParameter)Parameters["PotvinOnePointCrossoverMove"]; }
     41      get { return (ILookupParameter)Parameters["PotvinTwoOptStarMove"]; }
    4242    }
    4343
     
    4949
    5050    public override IDeepCloneable Clone(Cloner cloner) {
    51       return new PotvinOnePointCrossoverSingleMoveGenerator(this, cloner);
     51      return new PotvinTwoOptStarSingleMoveGenerator(this, cloner);
    5252    }
    5353
    5454    [StorableConstructor]
    55     private PotvinOnePointCrossoverSingleMoveGenerator(bool deserializing) : base(deserializing) { }
     55    private PotvinTwoOptStarSingleMoveGenerator(bool deserializing) : base(deserializing) { }
    5656
    57     public PotvinOnePointCrossoverSingleMoveGenerator()
     57    public PotvinTwoOptStarSingleMoveGenerator()
    5858      : base() {
    5959      Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator."));
    6060    }
    6161
    62     private PotvinOnePointCrossoverSingleMoveGenerator(PotvinOnePointCrossoverMoveGenerator original, Cloner cloner)
     62    private PotvinTwoOptStarSingleMoveGenerator(PotvinTwoOptStarMoveGenerator original, Cloner cloner)
    6363      : base(original, cloner) {
    6464    }
    6565
    66     public static PotvinOnePointCrossoverMove Apply(PotvinEncoding individual, IVRPProblemInstance problemInstance, IRandom rand) {
     66    public static PotvinTwoOptStarMove Apply(PotvinEncoding individual, IVRPProblemInstance problemInstance, IRandom rand) {
    6767      int route1Idx = rand.Next(individual.Tours.Count);
    6868      int route2Idx = rand.Next(individual.Tours.Count - 1);
     
    7676      int x2 = rand.Next(route2.Stops.Count + 1);
    7777
    78       return new PotvinOnePointCrossoverMove(route1Idx, x1, route2Idx, x2, individual);
     78      return new PotvinTwoOptStarMove(route1Idx, x1, route2Idx, x2, individual);
    7979    }
    8080
    81     protected override PotvinOnePointCrossoverMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) {
    82       List<PotvinOnePointCrossoverMove> result = new List<PotvinOnePointCrossoverMove>();
     81    protected override PotvinTwoOptStarMove[] GenerateMoves(PotvinEncoding individual, IVRPProblemInstance problemInstance) {
     82      List<PotvinTwoOptStarMove> result = new List<PotvinTwoOptStarMove>();
    8383
    84       PotvinOnePointCrossoverMove move = Apply(individual, ProblemInstance, RandomParameter.ActualValue);
     84      PotvinTwoOptStarMove move = Apply(individual, ProblemInstance, RandomParameter.ActualValue);
    8585      if (move != null)
    8686        result.Add(move);
Note: See TracChangeset for help on using the changeset viewer.