Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/04/10 17:34:02 (14 years ago)
Author:
svonolfe
Message:

Further improved the VRP design (#1039)

Location:
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings
Files:
13 edited

Legend:

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

    r4150 r4154  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaCrossover.cs

    r4150 r4154  
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    2929  [StorableClass]
    30   public abstract class AlbaCrossover : VRPCrossover {
    31     public ILookupParameter<IntValue> VehiclesParameter {
    32       get { return (ILookupParameter<IntValue>)Parameters["Vehicles"]; }
    33     }
    34 
    35     public AlbaCrossover()
    36       : base() {
    37         Parameters.Add(new LookupParameter<IntValue>("Vehicles", "The vehicles count."));
    38     }
    39    
     30  public abstract class AlbaCrossover : VRPCrossover {   
    4031    protected virtual void Crossover() {
    4132    }
    4233
    4334    public override IOperation Apply() {
    44       int cities = 0;
    45 
    4635      ItemArray<IVRPEncoding> parents = new ItemArray<IVRPEncoding>(ParentsParameter.ActualValue.Length);
    4736      for (int i = 0; i < ParentsParameter.ActualValue.Length; i++) {
    4837        IVRPEncoding solution = ParentsParameter.ActualValue[i];
    49         cities = solution.Cities;
     38
    5039        if (!(solution is AlbaEncoding)) {
    5140          parents[i] = AlbaEncoding.ConvertFrom(solution, VehiclesParameter.ActualValue.Value);
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Crossovers/AlbaPermutationCrossover.cs

    r4150 r4154  
    3939
    4040    protected override void Crossover() {
    41       int cities = ParentsParameter.ActualValue[0].Cities;
    42 
    4341      PermutationCrossoverParameter.ActualValue.ParentsParameter.ActualName = ParentsParameter.ActualName;
    4442      IAtomicOperation op = this.ExecutionContext.CreateOperation(
     
    5149        ExecutionContext.Scope.Variables.Remove(childName);
    5250
    53         ChildParameter.ActualValue = new AlbaEncoding(permutation, cities);
     51        ChildParameter.ActualValue = new AlbaEncoding(permutation, Cities);
    5452      } else
    5553        ChildParameter.ActualValue = null;
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Manipulators/AlbaManipulator.cs

    r4150 r4154  
    2828namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    2929  [StorableClass]
    30   public abstract class AlbaManipulator : VRPManipulator {
    31     public ILookupParameter<IntValue> VehiclesParameter {
    32       get { return (ILookupParameter<IntValue>)Parameters["Vehicles"]; }
    33     }
    34 
    35     public AlbaManipulator()
    36       : base() {
    37         Parameters.Add(new LookupParameter<IntValue>("Vehicles", "The vehicles count."));
    38     }
    39    
     30  public abstract class AlbaManipulator : VRPManipulator {   
    4031    protected virtual void Manipulate() {
    4132    }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveOperator.cs

    r4150 r4154  
    2929  [Item("AlbaMoveOperator", "A move operator for an alba VRP representation.")]
    3030  [StorableClass]
    31   public abstract class AlbaMoveOperator : VRPMoveOperator {
    32     public ILookupParameter<IntValue> VehiclesParameter {
    33       get { return (ILookupParameter<IntValue>)Parameters["Vehicles"]; }
    34     }
    35 
    36     public AlbaMoveOperator()
    37       : base() {
    38       Parameters.Add(new LookupParameter<IntValue>("Vehicles", "The vehicles count."));
    39     }
    40    
     31  public abstract class AlbaMoveOperator : VRPMoveOperator {   
    4132    [Storable]
    4233    protected abstract IPermutationMoveOperator PermutationMoveOperatorParameter { get; set; }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveGenerator.cs

    r4068 r4154  
    8282      Permutation permutation = VRPSolutionParameter.ActualValue as Permutation;
    8383      string moveName = TranslocationMoveGeneratorParameter.ActualValue.TranslocationMoveParameter.Name;
    84       int cities = VRPSolutionParameter.ActualValue.Cities;
    8584
    8685      List<Scope> toBeDeleted = new List<Scope>();
     
    9392            if (move.Index1 - 1 >= 0 &&
    9493              move.Index3 - 1 >= 0)
    95               criteria1 = (permutation[move.Index1] >= cities &&
    96                 permutation[move.Index1 - 1] >= cities &&
    97                 permutation[move.Index3 - 1] >= cities);
     94              criteria1 = (permutation[move.Index1] >= Cities &&
     95                permutation[move.Index1 - 1] >= Cities &&
     96                permutation[move.Index3 - 1] >= Cities);
    9897
    9998            int index3 = move.Index3 + (move.Index2 - move.Index1) + 1;
     
    101100            if (move.Index2 + 1 < permutation.Length &&
    102101              index3 < permutation.Length)
    103               criteria2 = (permutation[move.Index2] >= cities &&
    104                 permutation[move.Index2 + 1] >= cities &&
    105                 permutation[index3] >= cities);
     102              criteria2 = (permutation[move.Index2] >= Cities &&
     103                permutation[move.Index2 + 1] >= Cities &&
     104                permutation[index3] >= Cities);
    106105
    107106            if (criteria1 && criteria2)
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/IntListRepresentationCreator.cs

    r4150 r4154  
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2727using System.Collections.Generic;
     28using HeuristicLab.Problems.VehicleRouting.Encodings;
    2829
    29 namespace HeuristicLab.Problems.VehicleRouting {
     30namespace HeuristicLab.Problems.VehicleRouting.Encodings.General {
    3031  [StorableClass]
    3132  public abstract class IntListRepresentationCreator : VRPCreator {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/PushForwardInsertionCreator.cs

    r4150 r4154  
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3030
    31 namespace HeuristicLab.Problems.VehicleRouting {
     31namespace HeuristicLab.Problems.VehicleRouting.Encodings.General {
    3232  [StorableClass]
    3333  public abstract class PushForwardCreator : IntListRepresentationCreator, IStochasticOperator {
     
    199199       *-----------------------------------------------------------------------------
    200200       */
    201       for (int i = 1; i <= CitiesParameter.ActualValue.Value; i++) {
     201      for (int i = 1; i <= Cities; i++) {
    202202        distance = Distance(i, 0);
    203203        if (CoordinatesParameter.ActualValue[i, 0] < x0) distance = -distance;
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Creators/PotvinPushForwardInsertionCreator.cs

    r4150 r4154  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/VRPCreator.cs

    r4068 r4154  
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2727
    28 namespace HeuristicLab.Problems.VehicleRouting {
     28namespace HeuristicLab.Problems.VehicleRouting.Encodings {
    2929  [StorableClass]
    30   public abstract class VRPCreator : SingleSuccessorOperator, IVRPCreator {
     30  public abstract class VRPCreator : VRPOperator, IVRPCreator {
    3131    public override bool CanChangeName {
    3232      get { return false; }
     
    3434
    3535    #region IVRPCreator Members
    36     public IValueLookupParameter<IntValue> CitiesParameter {
    37       get { return (IValueLookupParameter<IntValue>)Parameters["Cities"]; }
    38     }
    3936    public ILookupParameter<IVRPEncoding> VRPSolutionParameter {
    4037      get { return (ILookupParameter<IVRPEncoding>)Parameters["VRPSolution"]; }
    4138    }
    42     public ILookupParameter<DoubleMatrix> CoordinatesParameter {
    43       get { return (ILookupParameter<DoubleMatrix>)Parameters["Coordinates"]; }
    44     }
    45     public ILookupParameter<DoubleMatrix> DistanceMatrixParameter {
    46       get { return (ILookupParameter<DoubleMatrix>)Parameters["DistanceMatrix"]; }
    47     }
    48     public ILookupParameter<BoolValue> UseDistanceMatrixParameter {
    49       get { return (ILookupParameter<BoolValue>)Parameters["UseDistanceMatrix"]; }
    50     }
    51     public ILookupParameter<IntValue> VehiclesParameter {
    52       get { return (ILookupParameter<IntValue>)Parameters["Vehicles"]; }
    53     }
    54     public ILookupParameter<DoubleValue> CapacityParameter {
    55       get { return (ILookupParameter<DoubleValue>)Parameters["Capacity"]; }
    56     }
    57     public ILookupParameter<DoubleArray> DemandParameter {
    58       get { return (ILookupParameter<DoubleArray>)Parameters["Demand"]; }
    59     }
    60     public ILookupParameter<DoubleArray> ReadyTimeParameter {
    61       get { return (ILookupParameter<DoubleArray>)Parameters["ReadyTime"]; }
    62     }
    63     public ILookupParameter<DoubleArray> DueTimeParameter {
    64       get { return (ILookupParameter<DoubleArray>)Parameters["DueTime"]; }
    65     }
    66     public ILookupParameter<DoubleArray> ServiceTimeParameter {
    67       get { return (ILookupParameter<DoubleArray>)Parameters["ServiceTime"]; }
    68     }
     39   
     40      public IValueLookupParameter<IntValue> CitiesParameter {
     41        get { return (IValueLookupParameter<IntValue>)Parameters["Cities"]; }
     42      }
    6943
    7044    public VRPCreator()
    7145      : base() {
    72       Parameters.Add(new ValueLookupParameter<IntValue>("Cities", "The city count."));
    73       Parameters.Add(new LookupParameter<IntValue>("Vehicles", "The vehicles count."));
    74       Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The coordinates of the cities."));
    75       Parameters.Add(new LookupParameter<DoubleMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
    76       Parameters.Add(new LookupParameter<BoolValue>("UseDistanceMatrix", "True if a distance matrix should be calculated and used for evaluation, otherwise false."));
    77       Parameters.Add(new LookupParameter<DoubleValue>("Capacity", "The capacity of each vehicle."));
    78       Parameters.Add(new LookupParameter<DoubleArray>("Demand", "The demand of each customer."));
    79       Parameters.Add(new LookupParameter<DoubleArray>("ReadyTime", "The ready time of each customer."));
    80       Parameters.Add(new LookupParameter<DoubleArray>("DueTime", "The due time of each customer."));
    81       Parameters.Add(new LookupParameter<DoubleArray>("ServiceTime", "The service time of each customer."));
    82 
    8346      Parameters.Add(new LookupParameter<IVRPEncoding>("VRPSolution", "The new VRP solution."));
    8447    }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/VRPCrossover.cs

    r4150 r4154  
    2626
    2727namespace HeuristicLab.Problems.VehicleRouting.Encodings {
    28   public abstract class VRPCrossover : SingleSuccessorOperator, IVRPCrossover {
     28  public abstract class VRPCrossover : VRPOperator, IVRPCrossover {
    2929    #region IVRPCrossover Members
    3030
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/VRPManipulator.cs

    r4150 r4154  
    2626
    2727namespace HeuristicLab.Problems.VehicleRouting.Encodings {
    28   public abstract class VRPManipulator : SingleSuccessorOperator, IVRPManipulator {
     28  public abstract class VRPManipulator : VRPOperator, IVRPManipulator {
    2929    #region IVRPManipulator Members
    3030
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/VRPMoveOperator.cs

    r4150 r4154  
    2626
    2727namespace HeuristicLab.Problems.VehicleRouting.Encodings {
    28   public abstract class VRPMoveOperator : SingleSuccessorOperator, IVRPMoveOperator {
     28  public abstract class VRPMoveOperator : VRPOperator, IVRPMoveOperator {
    2929    #region IVRPManipulator Members
    3030
Note: See TracChangeset for help on using the changeset viewer.