Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4205


Ignore:
Timestamp:
08/12/10 18:42:54 (12 years ago)
Author:
svonolfe
Message:

Added MultiVRPMove (#1039)

Location:
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3
Files:
9 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/LambdaInterchangeMove.cs

    r4204 r4205  
    2525using HeuristicLab.Common;
    2626using System.Collections.Generic;
     27using HeuristicLab.Problems.VehicleRouting.Encodings.General;
     28using HeuristicLab.Data;
    2729
    2830namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    2931  [Item("InversionMove", "Item that describes a lambda move on an Alba VRP representation.")]
    3032  [StorableClass]
    31   public class LambdaInterchangeMove: Item {
     33  public class LambdaInterchangeMove: Item, IVRPMove {
    3234    [Storable]
    3335    public int Tour1 { get; protected set; }
     
    8385      return clone;
    8486    }
     87
     88    #region IVRPMove Members
     89
     90    public TourEvaluation GetMoveQuality(
     91      IVRPEncoding individual,
     92      DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray,
     93      DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates,
     94      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor,
     95      DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
     96      ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) {
     97        return LambdaInterchangeMoveEvaluator.GetMoveQuality(individual as AlbaEncoding, this,
     98          dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity,
     99          coordinates, fleetUsageFactor, timeFactor, distanceFactor,
     100          overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix);
     101    }
     102
     103    public void MakeMove(IRandom random, IVRPEncoding individual) {
     104      LambdaInterchangeMoveMaker.Apply(individual as AlbaEncoding, this);
     105    }
     106
     107    #endregion
    85108  }
    86109}
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/LambdaInterchangeMoveEvaluator.cs

    r4204 r4205  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
     27using HeuristicLab.Data;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting {
     
    4243    }
    4344
    44     protected override TourEvaluation GetMoveQuality() {
    45       LambdaInterchangeMove move = LambdaInterchangeMoveParameter.ActualValue;
    46       //perform move
    47       AlbaEncoding newSolution = VRPToursParameter.ActualValue.Clone() as AlbaEncoding;
     45    public static TourEvaluation GetMoveQuality(AlbaEncoding individual, LambdaInterchangeMove move,
     46      DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray,
     47      DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates,
     48      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor,
     49      DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
     50      ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) {
     51      AlbaEncoding newSolution = individual.Clone() as AlbaEncoding;
    4852      LambdaInterchangeMoveMaker.Apply(newSolution, move);
    4953
    5054      return VRPEvaluator.Evaluate(
    51         newSolution,
     55        newSolution, dueTimeArray, serviceTimeArray, readyTimeArray,
     56        demandArray, capacity, fleetUsageFactor, timeFactor, distanceFactor,
     57        overloadPenalty, tardinessPenalty, coordinates, distanceMatrix, useDistanceMatrix);
     58    }
     59
     60    protected override TourEvaluation GetMoveQuality() {
     61      return GetMoveQuality(
     62        VRPToursParameter.ActualValue as AlbaEncoding, LambdaInterchangeMoveParameter.ActualValue,
    5263        DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue,
    53         DemandParameter.ActualValue, CapacityParameter.ActualValue,
    54         FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue, TardinessPenalty.ActualValue,
    55         CoordinatesParameter.ActualValue, DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue);
     64        DemandParameter.ActualValue, CapacityParameter.ActualValue, CoordinatesParameter.ActualValue,
     65        FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue,
     66        TardinessPenalty.ActualValue, DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue);
    5667    }
    5768  }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/StochasticLambdaInterchangeSingleMoveGenerator.cs

    r4204 r4205  
    2727using HeuristicLab.Parameters;
    2828using System.Collections.Generic;
     29using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    3132  [Item("StochasticLambdaInterchangeSingleMoveGenerator", "Generates one random lambda interchange move from a given Alba VRP encoding.")]
    3233  [StorableClass]
    33   public sealed class StochasticLambdaInterchangeSingleMoveGenerator : LambdaInterchangeMoveGenerator, IStochasticOperator, ISingleMoveGenerator, IAlbaLambdaInterchangeMoveOperator {
     34  public sealed class StochasticLambdaInterchangeSingleMoveGenerator : LambdaInterchangeMoveGenerator,
     35    IStochasticOperator, ISingleMoveGenerator, IAlbaLambdaInterchangeMoveOperator, IMultiVRPMoveGenerator {
     36    #region IMultiVRPMoveOperator Members
     37
     38    public ILookupParameter VRPMoveParameter {
     39      get { return (ILookupParameter)Parameters["LambdaInterchangeMove"]; }
     40    }
     41
     42    #endregion
     43   
    3444    public ILookupParameter<IRandom> RandomParameter {
    3545      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/SimpleLocalSearch/SimpleLocalSearchMove.cs

    r4204 r4205  
    2424using HeuristicLab.Encodings.PermutationEncoding;
    2525using HeuristicLab.Common;
     26using HeuristicLab.Problems.VehicleRouting.Encodings.General;
     27using HeuristicLab.Data;
    2628
    2729namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    2830  [Item("InversionMove", "Item that describes a simple local search move on an Alba VRP representation.")]
    2931  [StorableClass]
    30   public class SimpleLocalSearchMove : TwoIndexMove {
     32  public class SimpleLocalSearchMove : TwoIndexMove, IVRPMove {
    3133    public SimpleLocalSearchMove()
    3234      : base() {
     
    5153      return clone;
    5254    }
     55
     56    #region IVRPMove Members
     57
     58    public TourEvaluation GetMoveQuality(
     59      IVRPEncoding individual,
     60      DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray,
     61      DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates,
     62      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor,
     63      DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
     64      ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) {
     65        return SimpleLocalSearchMoveEvaluator.GetMoveQuality(individual as AlbaEncoding, this,
     66          dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity,
     67          coordinates, fleetUsageFactor, timeFactor, distanceFactor,
     68          overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix);
     69    }
     70
     71    public void MakeMove(IRandom random, IVRPEncoding individual) {
     72      SimpleLocalSearchMoveMaker.Apply(individual as AlbaEncoding, this);
     73    }
     74
     75    #endregion
    5376  }
    5477}
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/SimpleLocalSearch/SimpleLocalSearchMoveEvaluator.cs

    r4204 r4205  
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2626using HeuristicLab.Problems.VehicleRouting.Encodings.Alba;
     27using HeuristicLab.Data;
    2728
    2829namespace HeuristicLab.Problems.VehicleRouting {
     
    4243    }
    4344
    44     protected override TourEvaluation GetMoveQuality() {
    45       SimpleLocalSearchMove move = SimpleLocalSearchMoveParameter.ActualValue;
    46       //perform move
    47       AlbaEncoding newSolution = VRPToursParameter.ActualValue.Clone() as AlbaEncoding;
     45    public static TourEvaluation GetMoveQuality(AlbaEncoding individual, SimpleLocalSearchMove move,
     46      DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray,
     47      DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates,
     48      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor,
     49      DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
     50      ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) {
     51      AlbaEncoding newSolution = individual.Clone() as AlbaEncoding;
    4852      SimpleLocalSearchMoveMaker.Apply(newSolution, move);
    4953
    5054      return VRPEvaluator.Evaluate(
    51         newSolution,
     55        newSolution, dueTimeArray, serviceTimeArray, readyTimeArray,
     56        demandArray, capacity, fleetUsageFactor, timeFactor, distanceFactor,
     57        overloadPenalty, tardinessPenalty, coordinates, distanceMatrix, useDistanceMatrix);
     58    }
     59
     60    protected override TourEvaluation GetMoveQuality() {
     61      return GetMoveQuality(
     62        VRPToursParameter.ActualValue as AlbaEncoding, SimpleLocalSearchMoveParameter.ActualValue,
    5263        DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue,
    53         DemandParameter.ActualValue, CapacityParameter.ActualValue,
    54         FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue, TardinessPenalty.ActualValue,
    55         CoordinatesParameter.ActualValue, DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue);
     64        DemandParameter.ActualValue, CapacityParameter.ActualValue, CoordinatesParameter.ActualValue,
     65        FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue,
     66        TardinessPenalty.ActualValue, DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue);
    5667    }
    5768  }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/SimpleLocalSearch/StochasticSimpleLocalSearchSingleMoveGenerator.cs

    r4204 r4205  
    2727using HeuristicLab.Parameters;
    2828using System.Collections.Generic;
     29using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    3132  [Item("StochasticSimpleLocalSearchSingleMoveGenerator", "Generates one random simple local search move from a given Alba VRP encoding.")]
    3233  [StorableClass]
    33   public sealed class StochasticSimpleLocalSearchSingleMoveGenerator : SimpleLocalSearchMoveGenerator, IStochasticOperator, ISingleMoveGenerator, IAlbaSimpleLocalSearchMoveOperator {
     34  public sealed class StochasticSimpleLocalSearchSingleMoveGenerator : SimpleLocalSearchMoveGenerator,
     35    IStochasticOperator, ISingleMoveGenerator, IAlbaSimpleLocalSearchMoveOperator, IMultiVRPMoveGenerator {
     36    #region IMultiVRPMoveOperator Members
     37
     38    public ILookupParameter VRPMoveParameter {
     39      get { return (ILookupParameter)Parameters["SimpleLocalSearchMove"]; }
     40    }
     41
     42    #endregion
     43   
    3444    public ILookupParameter<IRandom> RandomParameter {
    3545      get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/HeuristicLab.Problems.VehicleRouting-3.3.csproj

    r4204 r4205  
    134134    <Compile Include="Encodings\General\Crossovers\MultiVRPCrossover.cs" />
    135135    <Compile Include="Encodings\General\Creators\RandomCreator.cs" />
     136    <Compile Include="Encodings\General\Moves\Interfaces\IMultiVRPMoveGenerator.cs" />
     137    <Compile Include="Encodings\General\Moves\Interfaces\IVRPMove.cs" />
     138    <Compile Include="Encodings\General\Moves\Interfaces\IMultiVRPMoveOperator.cs" />
     139    <Compile Include="Encodings\General\Moves\MultiVRPMoveOperator\MultiVRPMoveEvaluator.cs" />
     140    <Compile Include="Encodings\General\Moves\MultiVRPMoveOperator\MultiVRPMoveMaker.cs" />
     141    <Compile Include="Encodings\General\Moves\MultiVRPMoveOperator\MultiVRPMoveGenerator.cs" />
    136142    <Compile Include="Encodings\Potvin\Crossovers\SequenceBasedCrossover2.cs" />
    137143    <Compile Include="Encodings\Potvin\Crossovers\RouteBasedCrossover.cs" />
Note: See TracChangeset for help on using the changeset viewer.