Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMove.cs @ 15529

Last change on this file since 15529 was 14185, checked in by swagner, 8 years ago

#2526: Updated year of copyrights in license headers

File size: 3.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2016 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 System;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Optimization;
26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
27using HeuristicLab.Problems.VehicleRouting.Encodings.General;
28using HeuristicLab.Problems.VehicleRouting.Interfaces;
29
30namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
31  [Item("PotvinPDRearrangeMove", "Item that describes a rearrange move on a PDP representation.")]
32  [StorableClass]
33  public class PotvinPDRearrangeMove : Item, IVRPMove {
34    [Storable]
35    public IVRPEncoding Individual { get; protected set; }
36
37    [Storable]
38    public int City { get; protected set; }
39
40    [Storable]
41    public int Tour { get; protected set; }
42
43    public PotvinPDRearrangeMove()
44      : base() {
45      City = -1;
46      Tour = -1;
47
48      Individual = null;
49    }
50
51    public PotvinPDRearrangeMove(int city, int tour, PotvinEncoding individual) {
52      City = city;
53      Tour = tour;
54
55      this.Individual = individual.Clone() as PotvinEncoding;
56    }
57
58    public override IDeepCloneable Clone(Cloner cloner) {
59      return new PotvinPDRearrangeMove(this, cloner);
60    }
61
62    protected PotvinPDRearrangeMove(PotvinPDRearrangeMove original, Cloner cloner)
63      : base(original, cloner) {
64      this.City = original.City;
65      this.Tour = original.Tour;
66
67      this.Individual = cloner.Clone(Individual) as PotvinEncoding;
68    }
69
70    [StorableConstructor]
71    protected PotvinPDRearrangeMove(bool deserializing) : base(deserializing) { }
72
73    #region IVRPMove Members
74
75    [ThreadStatic]
76    private static PotvinPDRearrangeMoveEvaluator moveEvaluator;
77    public VRPMoveEvaluator GetMoveEvaluator() {
78      if (moveEvaluator == null)
79        moveEvaluator = new PotvinPDRearrangeMoveEvaluator();
80
81      return moveEvaluator;
82    }
83
84    [ThreadStatic]
85    private static PotvinPDRearrangeMoveMaker moveMaker;
86    public VRPMoveMaker GetMoveMaker() {
87      if (moveMaker == null)
88        moveMaker = new PotvinPDRearrangeMoveMaker();
89
90      return moveMaker;
91    }
92
93    [ThreadStatic]
94    private static PotvinPDRearrangeMoveTabuMaker tabuMaker;
95    public ITabuMaker GetTabuMaker() {
96      if (tabuMaker == null)
97        tabuMaker = new PotvinPDRearrangeMoveTabuMaker();
98
99      return tabuMaker;
100    }
101
102    [ThreadStatic]
103    private static PotvinPDRearrangeTabuCriterion tabuChecker;
104    public ITabuChecker GetTabuChecker() {
105      if (tabuChecker == null) {
106        tabuChecker = new PotvinPDRearrangeTabuCriterion();
107        tabuChecker.UseAspirationCriterion.Value = false;
108      }
109
110      return tabuChecker;
111    }
112
113    [ThreadStatic]
114    private static PotvinPDRearrangeTabuCriterion softTabuChecker;
115    public ITabuChecker GetSoftTabuChecker() {
116      if (softTabuChecker == null) {
117        softTabuChecker = new PotvinPDRearrangeTabuCriterion();
118        softTabuChecker.UseAspirationCriterion.Value = true;
119      }
120
121      return softTabuChecker;
122    }
123
124    #endregion
125  }
126}
Note: See TracBrowser for help on using the repository browser.