Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/VehicleAssignment/PotvinVehicleAssignmentMove.cs @ 17698

Last change on this file since 17698 was 17698, checked in by abeham, 4 years ago

#2521: working on VRP (WIP)

File size: 3.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 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 HEAL.Attic;
26using HeuristicLab.Problems.VehicleRouting.Encodings.General;
27using HeuristicLab.Problems.VehicleRouting.Interfaces;
28
29namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
30  [Item("PotvinVehicleAssignmentMove", "Item that describes a relocation move on a VRP representation.")]
31  [StorableType("6807BEDA-4718-4AB8-B615-FD4938196DB4")]
32  public class PotvinVehicleAssignmentMove : Item, IVRPMove {
33    [Storable]
34    public IVRPEncodedSolution Individual { get; protected set; }
35
36    [Storable]
37    public int Tour1 { get; protected set; }
38
39    [Storable]
40    public int Tour2 { get; protected set; }
41
42
43    public PotvinVehicleAssignmentMove()
44      : base() {
45      Tour1 = -1;
46      Tour2 = -1;
47
48      Individual = null;
49    }
50
51    public PotvinVehicleAssignmentMove(int tour1, int tour2, PotvinEncodedSolution individual) {
52      Tour1 = tour1;
53      Tour2 = tour2;
54
55      this.Individual = individual.Clone() as PotvinEncodedSolution;
56    }
57
58    public override IDeepCloneable Clone(Cloner cloner) {
59      return new PotvinVehicleAssignmentMove(this, cloner);
60    }
61
62    protected PotvinVehicleAssignmentMove(PotvinVehicleAssignmentMove original, Cloner cloner)
63      : base(original, cloner) {
64      this.Tour1 = original.Tour1;
65      this.Tour2 = original.Tour2;
66
67      this.Individual = cloner.Clone(Individual) as PotvinEncodedSolution;
68    }
69
70    [StorableConstructor]
71    protected PotvinVehicleAssignmentMove(StorableConstructorFlag _) : base(_) { }
72
73    #region IVRPMove Members
74
75    public VRPMoveEvaluator GetMoveEvaluator() {
76      return new PotvinVehicleAssignmentMoveEvaluator();
77    }
78
79    public VRPMoveMaker GetMoveMaker() {
80      return new PotvinVehicleAssignmentMoveMaker();
81    }
82
83    public ITabuMaker GetTabuMaker() {
84      return new PotvinVehicleAssignmentMoveTabuMaker();
85    }
86
87    public ITabuChecker GetTabuChecker() {
88      return new PotvinVehicleAssignmentMoveTabuCriterion();
89    }
90
91    public ITabuChecker GetSoftTabuChecker() {
92      PotvinVehicleAssignmentMoveTabuCriterion tabuChecker = new PotvinVehicleAssignmentMoveTabuCriterion();
93      tabuChecker.UseAspirationCriterion.Value = true;
94
95      return tabuChecker;
96    }
97
98    #endregion
99  }
100}
Note: See TracBrowser for help on using the repository browser.