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 |
|
---|
22 | using HeuristicLab.Core;
|
---|
23 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
24 | using HeuristicLab.Encodings.PermutationEncoding;
|
---|
25 | using HeuristicLab.Common;
|
---|
26 | using System.Collections.Generic;
|
---|
27 | using HeuristicLab.Problems.VehicleRouting.Encodings.General;
|
---|
28 | using HeuristicLab.Data;
|
---|
29 | using HeuristicLab.Problems.VehicleRouting.Interfaces;
|
---|
30 | using HeuristicLab.Optimization;
|
---|
31 |
|
---|
32 | namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
|
---|
33 | [Item("PotvinCustomerRelocationMove", "Item that describes a relocation move on a VRP representation.")]
|
---|
34 | [StorableClass]
|
---|
35 | public class PotvinCustomerRelocationMove: 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 PotvinCustomerRelocationMove(): base() {
|
---|
49 | City = -1;
|
---|
50 | Tour = -1;
|
---|
51 |
|
---|
52 | Individual = null;
|
---|
53 | }
|
---|
54 |
|
---|
55 | public PotvinCustomerRelocationMove(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 PotvinCustomerRelocationMove(this, cloner);
|
---|
65 | }
|
---|
66 |
|
---|
67 | protected PotvinCustomerRelocationMove(PotvinCustomerRelocationMove 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 | public VRPMoveEvaluator GetMoveEvaluator() {
|
---|
79 | return new PotvinCustomerRelocationMoveEvaluator();
|
---|
80 | }
|
---|
81 |
|
---|
82 | public VRPMoveMaker GetMoveMaker() {
|
---|
83 | return new PotvinCustomerRelocationMoveMaker();
|
---|
84 | }
|
---|
85 |
|
---|
86 | public ITabuMaker GetTabuMaker() {
|
---|
87 | return new PotvinCustomerRelocationMoveTabuMaker();
|
---|
88 | }
|
---|
89 |
|
---|
90 | public ITabuChecker GetTabuChecker() {
|
---|
91 | return new PotvinCustomerRelocationMoveTabuCriterion();
|
---|
92 | }
|
---|
93 |
|
---|
94 | public ITabuChecker GetSoftTabuChecker() {
|
---|
95 | PotvinCustomerRelocationMoveTabuCriterion tabuChecker = new PotvinCustomerRelocationMoveTabuCriterion();
|
---|
96 | tabuChecker.UseAspirationCriterion.Value = true;
|
---|
97 |
|
---|
98 | return tabuChecker;
|
---|
99 | }
|
---|
100 |
|
---|
101 | #endregion
|
---|
102 | }
|
---|
103 | }
|
---|