Free cookie consent management tool by TermsFeed Policy Generator

source: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftMove.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: 3.8 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("PotvinPDShiftMove", "Item that describes a shift move on a PDP representation.")]
34  [StorableClass]
35  public class PotvinPDShiftMove: 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    public PotvinPDShiftMove(): base() {
49      City = -1;
50      Tour = -1;
51
52      Individual = null;
53    }
54
55    public PotvinPDShiftMove(int city, int oldTour, int tour, PotvinEncoding individual) {
56      City = city;
57      OldTour = oldTour;
58      Tour = tour;
59
60      this.Individual = individual.Clone() as PotvinEncoding;
61    }
62
63    public override IDeepCloneable Clone(Cloner cloner) {
64      return new PotvinPDShiftMove(this, cloner);
65    }
66
67    protected PotvinPDShiftMove(PotvinPDShiftMove original, Cloner cloner)
68      : base(original, cloner) {
69      this.City = original.City;
70      this.OldTour = original.OldTour;
71      this.Tour = original.Tour;
72
73      this.Individual = cloner.Clone(Individual) as PotvinEncoding;
74    }
75
76    #region IVRPMove Members
77
78    private static PotvinPDShiftMoveEvaluator moveEvaluator;
79    public VRPMoveEvaluator GetMoveEvaluator() {
80      if (moveEvaluator == null)
81        moveEvaluator = new PotvinPDShiftMoveEvaluator();
82
83      return moveEvaluator;
84    }
85
86    private static PotvinPDShiftMoveMaker moveMaker;
87    public VRPMoveMaker GetMoveMaker() {
88      if (moveMaker == null)
89        moveMaker = new PotvinPDShiftMoveMaker();
90
91      return moveMaker;
92    }
93
94    private static PotvinPDShiftMoveTabuMaker tabuMaker;
95    public ITabuMaker GetTabuMaker() {
96      if (tabuMaker == null)
97        tabuMaker = new PotvinPDShiftMoveTabuMaker();
98
99      return tabuMaker;
100    }
101
102    private static PotvinPDShiftTabuCriterion tabuChecker;
103    public ITabuChecker GetTabuChecker() {
104      if (tabuChecker == null) {
105        tabuChecker = new PotvinPDShiftTabuCriterion();
106        tabuChecker.UseAspirationCriterion.Value = false;
107      }
108
109      return tabuChecker;
110    }
111
112    private static PotvinPDShiftTabuCriterion softTabuChecker;
113    public ITabuChecker GetSoftTabuChecker() {
114      if (softTabuChecker == null) {
115        softTabuChecker = new PotvinPDShiftTabuCriterion();
116        softTabuChecker.UseAspirationCriterion.Value = true;
117      }
118
119      return softTabuChecker;
120    }
121    #endregion
122  }
123}
Note: See TracBrowser for help on using the repository browser.