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 |
|
---|
31 | namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
|
---|
32 | [Item("AlbaLambdaInterchangeMove", "Item that describes a lambda move on a VRP representation. It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")]
|
---|
33 | [StorableClass]
|
---|
34 | public class PotvinCustomerRelocationMove: Item, IVRPMove {
|
---|
35 | [Storable]
|
---|
36 | public IVRPEncoding Individual { get; protected set; }
|
---|
37 |
|
---|
38 | [Storable]
|
---|
39 | public int City { get; protected set; }
|
---|
40 |
|
---|
41 | [Storable]
|
---|
42 | public int OldTour { get; protected set; }
|
---|
43 |
|
---|
44 | [Storable]
|
---|
45 | public int Tour { get; protected set; }
|
---|
46 |
|
---|
47 | public PotvinCustomerRelocationMove(): base() {
|
---|
48 | City = -1;
|
---|
49 | Tour = -1;
|
---|
50 |
|
---|
51 | Individual = null;
|
---|
52 | }
|
---|
53 |
|
---|
54 | public PotvinCustomerRelocationMove(int city, int oldTour, int tour, PotvinEncoding individual) {
|
---|
55 | City = city;
|
---|
56 | OldTour = oldTour;
|
---|
57 | Tour = tour;
|
---|
58 |
|
---|
59 | this.Individual = individual.Clone() as PotvinEncoding;
|
---|
60 | }
|
---|
61 |
|
---|
62 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
63 | return new PotvinCustomerRelocationMove(this, cloner);
|
---|
64 | }
|
---|
65 |
|
---|
66 | protected PotvinCustomerRelocationMove(PotvinCustomerRelocationMove original, Cloner cloner)
|
---|
67 | : base(original, cloner) {
|
---|
68 | this.City = original.City;
|
---|
69 | this.OldTour = original.OldTour;
|
---|
70 | this.Tour = original.Tour;
|
---|
71 |
|
---|
72 | this.Individual = cloner.Clone(Individual) as PotvinEncoding;
|
---|
73 | }
|
---|
74 |
|
---|
75 | #region IVRPMove Members
|
---|
76 |
|
---|
77 | public VRPMoveEvaluator GetMoveEvaluator() {
|
---|
78 | return new PotvinCustomerRelocationMoveEvaluator();
|
---|
79 | }
|
---|
80 |
|
---|
81 | public VRPMoveMaker GetMoveMaker() {
|
---|
82 | return new PotvinCustomerRelocationMoveMaker();
|
---|
83 | }
|
---|
84 |
|
---|
85 | #endregion
|
---|
86 | }
|
---|
87 | }
|
---|