Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/CustomerRelocation/PotvinCustomerRelocationMove.cs @ 9503

Last change on this file since 9503 was 9456, checked in by swagner, 12 years ago

Updated copyright year and added some missing license headers (#1889)

File size: 3.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 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.Common;
23using HeuristicLab.Core;
24using HeuristicLab.Optimization;
25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
26using HeuristicLab.Problems.VehicleRouting.Encodings.General;
27using HeuristicLab.Problems.VehicleRouting.Interfaces;
28
29namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
30  [Item("PotvinCustomerRelocationMove", "Item that describes a relocation move on a VRP representation.")]
31  [StorableClass]
32  public class PotvinCustomerRelocationMove : Item, IVRPMove {
33    [Storable]
34    public IVRPEncoding Individual { get; protected set; }
35
36    [Storable]
37    public int City { get; protected set; }
38
39    [Storable]
40    public int OldTour { get; protected set; }
41
42    [Storable]
43    public int Tour { get; protected set; }
44
45    public PotvinCustomerRelocationMove()
46      : base() {
47      City = -1;
48      Tour = -1;
49
50      Individual = null;
51    }
52
53    public PotvinCustomerRelocationMove(int city, int oldTour, int tour, PotvinEncoding individual) {
54      City = city;
55      OldTour = oldTour;
56      Tour = tour;
57
58      this.Individual = individual.Clone() as PotvinEncoding;
59    }
60
61    public override IDeepCloneable Clone(Cloner cloner) {
62      return new PotvinCustomerRelocationMove(this, cloner);
63    }
64
65    protected PotvinCustomerRelocationMove(PotvinCustomerRelocationMove original, Cloner cloner)
66      : base(original, cloner) {
67      this.City = original.City;
68      this.OldTour = original.OldTour;
69      this.Tour = original.Tour;
70
71      this.Individual = cloner.Clone(Individual) as PotvinEncoding;
72    }
73
74    [StorableConstructor]
75    protected PotvinCustomerRelocationMove(bool deserializing) : base(deserializing) { }
76
77    #region IVRPMove Members
78
79    public VRPMoveEvaluator GetMoveEvaluator() {
80      return new PotvinCustomerRelocationMoveEvaluator();
81    }
82
83    public VRPMoveMaker GetMoveMaker() {
84      return new PotvinCustomerRelocationMoveMaker();
85    }
86
87    public ITabuMaker GetTabuMaker() {
88      return new PotvinCustomerRelocationMoveTabuMaker();
89    }
90
91    public ITabuChecker GetTabuChecker() {
92      return new PotvinCustomerRelocationMoveTabuCriterion();
93    }
94
95    public ITabuChecker GetSoftTabuChecker() {
96      PotvinCustomerRelocationMoveTabuCriterion tabuChecker = new PotvinCustomerRelocationMoveTabuCriterion();
97      tabuChecker.UseAspirationCriterion.Value = true;
98
99      return tabuChecker;
100    }
101
102    #endregion
103  }
104}
Note: See TracBrowser for help on using the repository browser.