Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/09/10 13:29:06 (14 years ago)
Author:
svonolfe
Message:

Refactored VRP in preparation for the code review (#1039)

Location:
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings
Files:
3 added
2 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/AlbaEncoding.cs

    r4174 r4177  
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    30   [Item("AlbaEncoding", "Represents an alba encoding of VRP solutions.")]
     30  [Item("AlbaEncoding", "Represents an Alba encoding of VRP solutions. It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")]
    3131  [StorableClass]
    3232  class AlbaEncoding : Permutation, IVRPEncoding {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Creators/AlbaPermutationCreator.cs

    r4068 r4177  
    3030
    3131namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    32   [Item("AlbaPermutationCreator", "An operator which creates a new alba VRP representation.")]
     32  [Item("AlbaPermutationCreator", "An operator which creates a new Alba VRP representation.")]
    3333  [StorableClass]
    3434  public sealed class AlbaPermutationCreator : VRPCreator, IStochasticOperator {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Creators/AlbaPushForwardInsertionCreator.cs

    r4154 r4177  
    3131
    3232namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    33   [Item("AlbaPushForwardCreator", "An operator which creates a new alba VRP representation using the push forward insertion heuristic.")]
     33  [Item("AlbaPushForwardCreator", "An operator which creates a new Alba VRP representation using the push forward insertion heuristic.  It is implemented as described in Sam, and Thangiah, R. (1999). A Hybrid Genetic Algorithms, Simulated Annealing and Tabu Search Heuristic for Vehicle Routing Problems with Time Windows. Practical Handbook of Genetic Algorithms, Volume III, pp 347–381.")]
    3434  [StorableClass]
    3535  public sealed class AlbaPushForwardCreator : PushForwardCreator {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaCrossover.cs

    r4154 r4177  
    2727
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     29  [Item("AlbaCrossover", "An operator which crosses two Alba VRP representations.")]
    2930  [StorableClass]
    30   public abstract class AlbaCrossover : VRPCrossover {   
    31     protected virtual void Crossover() {
     31  public sealed class AlbaCrossover : VRPCrossover {   
     32    public IValueLookupParameter<IPermutationCrossover> PermutationCrossoverParameter {
     33      get { return (IValueLookupParameter<IPermutationCrossover>)Parameters["PermutationCrossover"]; }
     34    }
     35
     36    public AlbaCrossover()
     37      : base() {
     38      Parameters.Add(new ValueLookupParameter<IPermutationCrossover>("PermutationCrossover", "The permutation crossover.", new EdgeRecombinationCrossover()));
     39    }
     40
     41    void Crossover() {
     42      PermutationCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName;
     43      IAtomicOperation op = this.ExecutionContext.CreateOperation(
     44        PermutationCrossoverParameter.ActualValue, this.ExecutionContext.Scope);
     45      op.Operator.Execute((IExecutionContext)op);
     46
     47      string childName = PermutationCrossoverParameter.ActualValue.ChildParameter.ActualName;
     48      if (ExecutionContext.Scope.Variables.ContainsKey(childName)) {
     49        Permutation permutation = ExecutionContext.Scope.Variables[childName].Value as Permutation;
     50        ExecutionContext.Scope.Variables.Remove(childName);
     51
     52        ChildParameter.ActualValue = new AlbaEncoding(permutation, Cities);
     53      } else
     54        ChildParameter.ActualValue = null;
    3255    }
    3356
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaManipulator.cs

    r4154 r4177  
    2727
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     29  [Item("AlbaManipulator", "An operator which manipulates an alba VRP representation.")]
    2930  [StorableClass]
    30   public abstract class AlbaManipulator : VRPManipulator {   
    31     protected virtual void Manipulate() {
     31  public sealed class AlbaManipulator : VRPManipulator {   
     32    public IValueLookupParameter<IPermutationManipulator> PermutationManipulatorParameter {
     33      get { return (IValueLookupParameter<IPermutationManipulator>)Parameters["PermutationManipulator"]; }
    3234    }
    33    
     35
     36    public AlbaManipulator()
     37      : base() {
     38      Parameters.Add(new ValueLookupParameter<IPermutationManipulator>("PermutationManipulator", "The permutation manipulator.", new TranslocationManipulator()));
     39    }
     40
    3441    public override IOperation Apply() {
    3542      IVRPEncoding solution = VRPSolutionParameter.ActualValue;
     
    3845      }
    3946     
    40       Manipulate();
     47      OperationCollection next = new OperationCollection(base.Apply());
    4148
    42       return base.Apply();
     49      IPermutationManipulator op = PermutationManipulatorParameter.ActualValue;
     50      if (op != null) {
     51        op.PermutationParameter.ActualName = VRPSolutionParameter.ActualName;
     52        next.Insert(0, ExecutionContext.CreateOperation(op));
     53      }
     54
     55      return next;
    4356    }
    4457  }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveMaker.cs

    r4068 r4177  
    2626
    2727namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    28   [Item("AlbaTranslocationMoveMaker", "An operator which makes translocation moves for the alba representation.")]
     28  [Item("AlbaTranslocationMoveMaker", "An operator which makes translocation moves for the Alba representation.")]
    2929  [StorableClass]
    3030  public abstract class AlbaMoveMaker : AlbaMoveOperator {
     
    6060      get { return (ILookupParameter<DoubleValue>)Parameters["Tardiness"]; }
    6161    }
     62   
    6263
    6364    public AlbaMoveMaker()
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveOperator.cs

    r4154 r4177  
    2727
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    29   [Item("AlbaMoveOperator", "A move operator for an alba VRP representation.")]
     29  [Item("AlbaMoveOperator", "A move operator for an Alba VRP representation.")]
    3030  [StorableClass]
    3131  public abstract class AlbaMoveOperator : VRPMoveOperator {   
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveEvaluator.cs

    r4068 r4177  
    2727
    2828namespace HeuristicLab.Problems.VehicleRouting {
    29   [Item("AlbaTranslocationMoveEvaluator", "Evaluates a translocation or insertion move (3-opt) for the VRP.")]
     29  [Item("AlbaTranslocationMoveEvaluator", "Evaluates a translocation or insertion move (3-opt) for the Alba representation.")]
    3030  [StorableClass]
    3131  public sealed class AlbaTranslocationMoveEvaluator : VRPMoveEvaluator {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveGenerator.cs

    r4154 r4177  
    2929
    3030namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    31   [Item("AlbaTranslocationMoveGenerator", "An operator which generates translocation moves for the alba representation.")]
     31  [Item("AlbaTranslocationMoveGenerator", "An operator which generates translocation moves for the Alba representation.")]
    3232  [StorableClass]
    3333  public sealed class AlbaTranslocationMoveGenerator : AlbaMoveOperator, IAlbaTranslocationMoveOperator, IMultiMoveGenerator {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveHardTabuCriterion.cs

    r4068 r4177  
    2727
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    29   [Item("AlbaTranslocationMoveHardTabuCriterion", "An operator which checks if translocation moves are tabu using a hard criterion.")]
     29  [Item("AlbaTranslocationMoveHardTabuCriterion", "An operator which checks if translocation moves are tabu using a hard criterion for the Alba representation.")]
    3030  [StorableClass]
    3131  public sealed class AlbaTranslocationMoveHardTabuCriterion : AlbaMoveOperator, IAlbaTranslocationMoveOperator, ITabuChecker {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveMaker.cs

    r4068 r4177  
    2727
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    29   [Item("AlbaTranslocationMoveMaker", "An operator which makes translocation moves for the alba representation.")]
     29  [Item("AlbaTranslocationMoveMaker", "An operator which makes translocation moves for the Alba representation.")]
    3030  [StorableClass]
    31   public sealed class AlbaTranslocationMoveMaker : AlbaMoveMaker, IAlbaTranslocationMoveOperator, IMoveMaker {
     31  public sealed class AlbaTranslocationMoveMaker : AlbaMoveMaker, IAlbaTranslocationMoveOperator, IVRPMoveMaker {
    3232    private TranslocationMoveMaker moveMaker;
    3333    protected override IPermutationMoveOperator PermutationMoveOperatorParameter {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveSoftTabuCriterion.cs

    r4068 r4177  
    2727
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    29   [Item("AlbaTranslocationMoveSoftTabuCriterion", "An operator which checks if translocation moves are tabu using a soft criterion.")]
     29  [Item("AlbaTranslocationMoveSoftTabuCriterion", "An operator which checks if translocation moves are tabu using a soft criterion for the Alba representation.")]
    3030  [StorableClass]
    3131  public sealed class AlbaTranslocationMoveSoftTabuCriterion : AlbaMoveOperator, IAlbaTranslocationMoveOperator, ITabuChecker {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveTabuMaker.cs

    r4068 r4177  
    2727
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    29   [Item("AlbaTranslocationMoveTabuMaker", "An operator which makes translocation moves tabu for the alba representation.")]
     29  [Item("AlbaTranslocationMoveTabuMaker", "An operator which makes translocation moves tabu for the Alba representation.")]
    3030  [StorableClass]
    3131  public sealed class AlbaTranslocationMoveTabuMaker : AlbaMoveOperator, IAlbaTranslocationMoveOperator, ITabuMaker {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/PushForwardInsertionCreator.cs

    r4154 r4177  
    3131namespace HeuristicLab.Problems.VehicleRouting.Encodings.General {
    3232  [StorableClass]
     33  //The push forward insertion heuristic.  It is implemented as described in Sam, and Thangiah, R. (1999). A Hybrid Genetic Algorithms, Simulated Annealing and Tabu Search Heuristic for Vehicle Routing Problems with Time Windows. Practical Handbook of Genetic Algorithms, Volume III, pp 347–381.
    3334  public abstract class PushForwardCreator : IntListRepresentationCreator, IStochasticOperator {
    3435    #region IStochasticOperator Members
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Creators/PotvinPushForwardInsertionCreator.cs

    r4154 r4177  
    3131
    3232namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    33   [Item("PotvinPushForwardCreator", "An operator which creates a new Potvin VRP representation using the push forward insertion heuristic.")]
     33  [Item("PotvinPushForwardCreator", "An operator which creates a new Potvin VRP representation using the push forward insertion heuristic. It is implemented as described in Sam, and Thangiah, R. (1999). A Hybrid Genetic Algorithms, Simulated Annealing and Tabu Search Heuristic for Vehicle Routing Problems with Time Windows. Practical Handbook of Genetic Algorithms, Volume III, pp 347–381.")]
    3434  [StorableClass]
    3535  public sealed class PotvinPushForwardCreator : PushForwardCreator {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinSBXCrossover.cs

    r4174 r4177  
    2727
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    29   [Item("PotvinSBXCrossover", "The SBX crossover for the Potvin VRP representations.")]
     29  [Item("PotvinSBXCrossover", "The SBX crossover for the Potvin VRP representations.  It is implemented as described in Potvin, J.-Y. and Bengio, S. (1996). The Vehicle Routing Problem with Time Windows - Part II: Genetic Search. INFORMS Journal of Computing, 8:165–172.")]
    3030  [StorableClass]
    3131  public sealed class PotvinSBXCrossover : PotvinCrossover {
     
    7272          child.Unrouted.Add(city);
    7373
    74       if(Repair(random, child, newTour))
     74      if (Repair(random, child, newTour))
    7575        return child;
    76       else
    77         return parent1.Clone() as PotvinEncoding;
     76      else {
     77        if(random.NextDouble() < 0.5)
     78          return parent1.Clone() as PotvinEncoding;
     79        else
     80          return parent2.Clone() as PotvinEncoding;
     81      }
    7882    }
    7983  }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/Potvin1MManipulator.cs

    r4174 r4177  
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    30   [Item("Potvin1MMainpulator", "The one-level exchange operator which manipulates a Potvin VRP representation.")]
     30  [Item("Potvin1MMainpulator", "The one-level exchange operator which manipulates a Potvin VRP representation.  It is implemented as described in Potvin, J.-Y. and Bengio, S. (1996). The Vehicle Routing Problem with Time Windows - Part II: Genetic Search. INFORMS Journal of Computing, 8:165–172.")]
    3131  [StorableClass]
    3232  public sealed class Potvin1MMainpulator : PotvinManipulator {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Manipulators/Potvin2MManipulator.cs

    r4174 r4177  
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    30   [Item("Potvin2MMainpulator", "The two-level exchange operator which manipulates a Potvin VRP representation.")]
     30  [Item("Potvin2MMainpulator", "The two-level exchange operator which manipulates a Potvin VRP representation.  It is implemented as described in Potvin, J.-Y. and Bengio, S. (1996). The Vehicle Routing Problem with Time Windows - Part II: Genetic Search. INFORMS Journal of Computing, 8:165–172.")]
    3131  [StorableClass]
    3232  public sealed class Potvin2MMainpulator : PotvinManipulator {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/PotvinEncoding.cs

    r4174 r4177  
    2929
    3030namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    31   [Item("PotvinEncoding", "Represents a potvin encoding of VRP solutions.")]
     31  [Item("PotvinEncoding", "Represents a potvin encoding of VRP solutions. It is implemented as described in Potvin, J.-Y. and Bengio, S. (1996). The Vehicle Routing Problem with Time Windows - Part II: Genetic Search. INFORMS Journal of Computing, 8:165–172.")]
    3232  [StorableClass]
    3333  public class PotvinEncoding : Item, IVRPEncoding {
Note: See TracChangeset for help on using the changeset viewer.