Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 8228 was 7259, checked in by swagner, 13 years ago

Updated year of copyrights to 2012 (#1716)

File size: 4.1 KB
RevLine 
[4204]1#region License Information
2/* HeuristicLab
[7259]3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[4204]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
[4722]22using HeuristicLab.Common;
[4204]23using HeuristicLab.Core;
[4722]24using HeuristicLab.Data;
[4204]25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
[4205]26using HeuristicLab.Problems.VehicleRouting.Encodings.General;
[4204]27
28namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
[4346]29  [Item("InversionMove", "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.")]
[4204]30  [StorableClass]
[4722]31  public class AlbaLambdaInterchangeMove : Item, IVRPMove {
[4204]32    [Storable]
[4287]33    public IVRPEncoding Individual { get; protected set; }
[4722]34
[4287]35    [Storable]
[4204]36    public int Tour1 { get; protected set; }
37
38    [Storable]
39    public int Position1 { get; protected set; }
40
41    [Storable]
42    public int Length1 { get; protected set; }
43
44    [Storable]
45    public int Tour2 { get; protected set; }
46
47    [Storable]
48    public int Position2 { get; protected set; }
49
50    [Storable]
51    public int Length2 { get; protected set; }
[4722]52
53    [StorableConstructor]
54    protected AlbaLambdaInterchangeMove(bool deserializing) : base(deserializing) { }
55    protected AlbaLambdaInterchangeMove(AlbaLambdaInterchangeMove original, Cloner cloner)
56      : base(original, cloner) {
57      Tour1 = original.Tour1;
58      Position1 = original.Position1;
59      Length1 = original.Length1;
60
61      Tour2 = original.Tour2;
62      Position2 = original.Position2;
63      Length2 = original.Length2;
64
65      Individual = cloner.Clone(original.Individual);
66    }
67    public override IDeepCloneable Clone(Cloner cloner) {
68      return new AlbaLambdaInterchangeMove(this, cloner);
69    }
70
71    public AlbaLambdaInterchangeMove()
72      : base() {
[4204]73      Tour1 = -1;
74      Position1 = -1;
75      Length1 = -1;
76
77      Tour2 = -1;
78      Position2 = -1;
79      Length2 = -1;
[4287]80
81      Individual = null;
[4204]82    }
83
[4722]84    public AlbaLambdaInterchangeMove(int tour1, int position1, int length1,
[4287]85      int tour2, int position2, int length2, AlbaEncoding permutation) {
[4722]86      Tour1 = tour1;
87      Position1 = position1;
88      Length1 = length1;
[4204]89
[4722]90      Tour2 = tour2;
91      Position2 = position2;
92      Length2 = length2;
[4287]93
[4722]94      this.Individual = permutation.Clone() as AlbaEncoding;
[4204]95    }
96
[4205]97    #region IVRPMove Members
98
99    public TourEvaluation GetMoveQuality(
[4287]100      IntValue vehicles,
[4722]101      DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray,
[4205]102      DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates,
103      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor,
104      DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
105      ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) {
[4722]106      return AlbaLambdaInterchangeMoveEvaluator.GetMoveQuality(Individual as AlbaEncoding, this, vehicles,
107        dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity,
108        coordinates, fleetUsageFactor, timeFactor, distanceFactor,
109        overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix);
[4205]110    }
111
[4288]112    public IVRPEncoding MakeMove() {
[4346]113      AlbaLambdaInterchangeMoveMaker.Apply(Individual as AlbaEncoding, this);
[4287]114
115      return Individual;
[4205]116    }
117
118    #endregion
[4204]119  }
120}
Note: See TracBrowser for help on using the repository browser.