Free cookie consent management tool by TermsFeed Policy Generator

source: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeMove.cs @ 6773

Last change on this file since 6773 was 6773, checked in by svonolfe, 13 years ago

Added moves for pickup and delivery problems (#1177)

File size: 4.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Core;
23using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
24using HeuristicLab.Encodings.PermutationEncoding;
25using HeuristicLab.Common;
26using System.Collections.Generic;
27using HeuristicLab.Problems.VehicleRouting.Encodings.General;
28using HeuristicLab.Data;
29using HeuristicLab.Problems.VehicleRouting.Interfaces;
30using HeuristicLab.Optimization;
31
32namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
33  [Item("PotvinPDExchangeMove", "Item that describes a exchange move on a PDP representation.")]
34  [StorableClass]
35  public class PotvinPDExchangeMove: Item, IVRPMove {
36    [Storable]
37    public IVRPEncoding Individual { get; protected set; }
38   
39    [Storable]
40    public int City { get; protected set; }
41
42    [Storable]
43    public int OldTour { get; protected set; }
44
45    [Storable]
46    public int Tour { get; protected set; }
47
48    [Storable]
49    public int Replaced { get; protected set; }
50   
51    public PotvinPDExchangeMove(): base() {
52      City = -1;
53      Tour = -1;
54
55      Individual = null;
56    }
57
58    public PotvinPDExchangeMove(int city, int oldTour, int tour, int replaced, PotvinEncoding individual) {
59      City = city;
60      OldTour = oldTour;
61      Tour = tour;
62      Replaced = replaced;
63
64      this.Individual = individual.Clone() as PotvinEncoding;
65    }
66
67    public override IDeepCloneable Clone(Cloner cloner) {
68      return new PotvinPDExchangeMove(this, cloner);
69    }
70
71    protected PotvinPDExchangeMove(PotvinPDExchangeMove original, Cloner cloner)
72      : base(original, cloner) {
73      this.City = original.City;
74      this.OldTour = original.OldTour;
75      this.Tour = original.Tour;
76      this.Replaced = original.Replaced;
77
78      this.Individual = cloner.Clone(Individual) as PotvinEncoding;
79    }
80
81    #region IVRPMove Members
82
83    private static PotvinPDExchangeMoveEvaluator moveEvaluator;
84    public VRPMoveEvaluator GetMoveEvaluator() {
85      if (moveEvaluator == null)
86        moveEvaluator = new PotvinPDExchangeMoveEvaluator();
87
88      return moveEvaluator;
89    }
90
91    private static PotvinPDExchangeMoveMaker moveMaker;
92    public VRPMoveMaker GetMoveMaker() {
93      if (moveMaker == null)
94        moveMaker = new PotvinPDExchangeMoveMaker();
95
96      return moveMaker;
97    }
98
99    private static PotvinPDExchangeMoveTabuMaker tabuMaker;
100    public ITabuMaker GetTabuMaker() {
101      if (tabuMaker == null)
102        tabuMaker = new PotvinPDExchangeMoveTabuMaker();
103
104      return tabuMaker;
105    }
106
107    private static PotvinPDExchangeTabuCriterion tabuChecker;
108    public ITabuChecker GetTabuChecker() {
109      if (tabuChecker == null) {
110        tabuChecker = new PotvinPDExchangeTabuCriterion();
111        tabuChecker.UseAspirationCriterion.Value = false;
112      }
113
114      return tabuChecker;
115    }
116
117    private static PotvinPDExchangeTabuCriterion softTabuChecker;
118    public ITabuChecker GetSoftTabuChecker() {
119      if (softTabuChecker == null) {
120        softTabuChecker = new PotvinPDExchangeTabuCriterion();
121        softTabuChecker.UseAspirationCriterion.Value = true;
122      }
123
124      return softTabuChecker;
125    }
126
127    #endregion
128  }
129}
Note: See TracBrowser for help on using the repository browser.