Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6772


Ignore:
Timestamp:
09/15/11 16:32:43 (13 years ago)
Author:
svonolfe
Message:

Added support for multiple moves in tabu search (#1177)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMove.cs

    r5867 r6772  
    2727using HeuristicLab.Data;
    2828using HeuristicLab.Problems.VehicleRouting.Interfaces;
     29using HeuristicLab.Optimization;
    2930
    3031namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    6869    }
    6970
     71    public ITabuMaker GetTabuMaker() {
     72      return null;
     73    }
     74
     75    public ITabuChecker GetTabuChecker() {
     76      return null;
     77    }
     78
     79    public ITabuChecker GetSoftTabuChecker() {
     80      return null;
     81    }
     82
    7083    #endregion
    7184  }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMove.cs

    r4752 r6772  
    2828using HeuristicLab.Data;
    2929using HeuristicLab.Problems.VehicleRouting.Interfaces;
     30using HeuristicLab.Optimization;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    106107    }
    107108
     109    public ITabuMaker GetTabuMaker() {
     110      return null;
     111    }
     112
     113    public ITabuChecker GetTabuChecker() {
     114      return null;
     115    }
     116
     117    public ITabuChecker GetSoftTabuChecker() {
     118      return null;
     119    }
     120
    108121    #endregion
    109122  }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMove.cs

    r4752 r6772  
    2828using HeuristicLab.Data;
    2929using HeuristicLab.Problems.VehicleRouting.Interfaces;
     30using HeuristicLab.Optimization;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
     
    6970    }
    7071
     72    public ITabuMaker GetTabuMaker() {
     73      return new AlbaTranslocationMoveTabuMaker();
     74    }
     75
     76    public ITabuChecker GetTabuChecker() {
     77      return new AlbaTranslocationMoveHardTabuCriterion();
     78    }
     79
     80    public ITabuChecker GetSoftTabuChecker() {
     81      return new AlbaTranslocationMoveSoftTabuCriterion();
     82    }
     83
    7184    #endregion
    7285  }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Moves/Interfaces/IVRPMove.cs

    r4370 r6772  
    3030    VRPMoveEvaluator GetMoveEvaluator();
    3131    VRPMoveMaker GetMoveMaker();
     32    ITabuMaker GetTabuMaker();
     33    ITabuChecker GetTabuChecker();
     34    ITabuChecker GetSoftTabuChecker();
    3235  }
    3336}
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveEvaluator.cs

    r5867 r6772  
    5252    }
    5353
    54     protected override void EvaluateMove() {
     54    protected override void EvaluateMove() { }
     55
     56    public override IOperation Apply() {
    5557      IVRPMove move = VRPMoveParameter.ActualValue as IVRPMove;
    5658
    5759      VRPMoveEvaluator moveEvaluator = move.GetMoveEvaluator();
    5860      moveEvaluator.VRPMoveParameter.ActualName = VRPMoveParameter.Name;
    59       IAtomicOperation op = this.ExecutionContext.CreateOperation(moveEvaluator);
    60       op.Operator.Execute((IExecutionContext)op, CancellationToken);
     61
     62      OperationCollection next = new OperationCollection(base.Apply());
     63      next.Insert(0, ExecutionContext.CreateOperation(moveEvaluator));
     64
     65      return next;
    6166    }
    6267  }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveGenerator.cs

    r4752 r6772  
    3939  [StorableClass]
    4040  public class MultiVRPMoveGenerator : CheckedMultiOperator<IMultiVRPMoveGenerator>, IMultiVRPMoveOperator,
    41     IStochasticOperator, IMultiMoveGenerator, IGeneralVRPOperator, IMultiVRPOperator {
     41    IStochasticOperator, IMoveGenerator, IGeneralVRPOperator, IMultiVRPOperator {
    4242    public override bool CanChangeName {
    4343      get { return false; }
    4444    }
    4545
    46     public IValueLookupParameter<IntValue> SampleSizeParameter {
    47       get { return (IValueLookupParameter<IntValue>)Parameters["SampleSize"]; }
     46    public IValueLookupParameter<IntValue> SelectedOperatorsParameter {
     47      get { return (IValueLookupParameter<IntValue>)Parameters["SelectedOperators"]; }
    4848    }
    4949
     
    8080    public MultiVRPMoveGenerator()
    8181      : base() {
    82       Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate."));
     82      Parameters.Add(new ValueLookupParameter<IntValue>("SelectedOperators", "The number of selected operators.", new IntValue(1)));
    8383      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
    8484      Parameters.Add(new ValueLookupParameter<DoubleArray>("Probabilities", "The array of relative probabilities for each operator.", new DoubleArray()));
     
    158158      OperationCollection next = new OperationCollection(base.Apply());
    159159
    160       for (int i = 0; i < SampleSizeParameter.ActualValue.Value; i++) {
     160      for (int i = 0; i < SelectedOperatorsParameter.ActualValue.Value; i++) {
    161161        IRandom random = RandomParameter.ActualValue;
    162162        DoubleArray probabilities = ProbabilitiesParameter.ActualValue;
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/CustomerRelocation/PotvinCustomerRelocationMove.cs

    r6751 r6772  
    2828using HeuristicLab.Data;
    2929using HeuristicLab.Problems.VehicleRouting.Interfaces;
     30using HeuristicLab.Optimization;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
     
    8384    }
    8485
     86    public ITabuMaker GetTabuMaker() {
     87      return new PotvinCustomerRelocationMoveTabuMaker();
     88    }
     89
     90    public ITabuChecker GetTabuChecker() {
     91      return new PotvinCustomerRelocationMoveTabuCriterion();
     92    }
     93
     94    public ITabuChecker GetSoftTabuChecker() {
     95      PotvinCustomerRelocationMoveTabuCriterion tabuChecker = new PotvinCustomerRelocationMoveTabuCriterion();
     96      tabuChecker.UseAspirationCriterion.Value = true;
     97
     98      return tabuChecker;
     99    }
     100
    85101    #endregion
    86102  }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/CustomerRelocation/PotvinCustomerRelocationMoveTabuCriterion.cs

    r5127 r6772  
    3232  [Item("PotvinCustomerRelocationTabuCriterion", @"Checks if a certain customer relocation move is tabu.")]
    3333  [StorableClass]
    34   public class PotvinCustomerRelocationMoveTabuCriterion : SingleSuccessorOperator, IPotvinCustomerRelocationMoveOperator, ITabuChecker, IPotvinOperator {
     34  public class PotvinCustomerRelocationMoveTabuCriterion : SingleSuccessorOperator, IPotvinCustomerRelocationMoveOperator, ITabuChecker, IPotvinOperator, IVRPMoveOperator {
    3535    public override bool CanChangeName {
    3636      get { return false; }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj

    r6753 r6772  
    183183    <Compile Include="Encodings\General\Moves\Interfaces\IMultiVRPMoveOperator.cs" />
    184184    <Compile Include="Encodings\General\Moves\Interfaces\IVRPMove.cs" />
     185    <Compile Include="Encodings\General\Moves\MultiVRPMoveOperator\MultiVRPMoveTabuMaker.cs" />
     186    <Compile Include="Encodings\General\Moves\MultiVRPMoveOperator\MultiVRPMoveTabuChecker.cs" />
    185187    <Compile Include="Encodings\General\Moves\MultiVRPMoveOperator\MultiVRPMoveEvaluator.cs" />
    186188    <Compile Include="Encodings\General\Moves\MultiVRPMoveOperator\MultiVRPMoveGenerator.cs" />
Note: See TracChangeset for help on using the changeset viewer.