Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMove.cs @ 7906

Last change on this file since 7906 was 7906, checked in by svonolfe, 12 years ago

Fixed issues that prevented the unit tests to pass (#1177)

File size: 3.8 KB
Line 
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
22using HeuristicLab.Core;
23using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
24using HeuristicLab.Encodings.PermutationEncoding;
25using HeuristicLab.Common;
26using System.Collections.Generic;
27using HeuristicLab.Problems.VehicleRouting.Encodings.General;
28using HeuristicLab.Data;
29using HeuristicLab.Problems.VehicleRouting.Interfaces;
30using HeuristicLab.Optimization;
31
32namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
33  [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.")]
34  [StorableClass]
35  public class AlbaLambdaInterchangeMove: Item, IVRPMove {
36    [Storable]
37    public IVRPEncoding Individual { get; protected set; }
38   
39    [Storable]
40    public int Tour1 { get; protected set; }
41
42    [Storable]
43    public int Position1 { get; protected set; }
44
45    [Storable]
46    public int Length1 { get; protected set; }
47
48    [Storable]
49    public int Tour2 { get; protected set; }
50
51    [Storable]
52    public int Position2 { get; protected set; }
53
54    [Storable]
55    public int Length2 { get; protected set; }
56   
57    public AlbaLambdaInterchangeMove(): base() {
58      Tour1 = -1;
59      Position1 = -1;
60      Length1 = -1;
61
62      Tour2 = -1;
63      Position2 = -1;
64      Length2 = -1;
65
66      Individual = null;
67    }
68
69    public AlbaLambdaInterchangeMove(int tour1, int position1, int length1,
70      int tour2, int position2, int length2, AlbaEncoding permutation) {
71        Tour1 = tour1;
72        Position1 = position1;
73        Length1 = length1;
74
75        Tour2 = tour2;
76        Position2 = position2;
77        Length2 = length2;
78
79        this.Individual = permutation.Clone() as AlbaEncoding;
80    }
81
82    [StorableConstructor]
83    protected AlbaLambdaInterchangeMove(bool deserializing) : base(deserializing) { }
84
85    public override IDeepCloneable Clone(Cloner cloner) {
86      return new AlbaLambdaInterchangeMove(this, cloner);
87    }
88
89    protected AlbaLambdaInterchangeMove(AlbaLambdaInterchangeMove original, Cloner cloner)
90      : base(original, cloner) {
91      this.Tour1 = original.Tour1;
92      this.Position1 = original.Position1;
93      this.Length1 = original.Length1;
94
95      this.Tour2 = original.Tour2;
96      this.Position2 = original.Position2;
97      this.Length2 = original.Length2;
98
99      this.Individual = cloner.Clone(Individual) as AlbaEncoding;
100    }
101
102    #region IVRPMove Members
103
104    public VRPMoveEvaluator GetMoveEvaluator() {
105      return new AlbaLambdaInterchangeMoveEvaluator();
106    }
107
108    public VRPMoveMaker GetMoveMaker() {
109      return new AlbaLambdaInterchangeMoveMaker();
110    }
111
112    public ITabuMaker GetTabuMaker() {
113      return null;
114    }
115
116    public ITabuChecker GetTabuChecker() {
117      return null;
118    }
119
120    public ITabuChecker GetSoftTabuChecker() {
121      return null;
122    }
123
124    #endregion
125  }
126}
Note: See TracBrowser for help on using the repository browser.