Free cookie consent management tool by TermsFeed Policy Generator

source: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/LambdaInterchangeMove.cs @ 4218

Last change on this file since 4218 was 4206, checked in by svonolfe, 14 years ago

Updated naming and description of the VRP operators (#1039)

File size: 3.6 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;
29
30namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
31  [Item("InversionMove", "Item that describes a lambda move on a VRP representation.")]
32  [StorableClass]
33  public class LambdaInterchangeMove: Item, IVRPMove {
34    [Storable]
35    public int Tour1 { get; protected set; }
36
37    [Storable]
38    public int Position1 { get; protected set; }
39
40    [Storable]
41    public int Length1 { get; protected set; }
42
43    [Storable]
44    public int Tour2 { get; protected set; }
45
46    [Storable]
47    public int Position2 { get; protected set; }
48
49    [Storable]
50    public int Length2 { get; protected set; }
51   
52    public LambdaInterchangeMove(): base() {
53      Tour1 = -1;
54      Position1 = -1;
55      Length1 = -1;
56
57      Tour2 = -1;
58      Position2 = -1;
59      Length2 = -1;
60    }
61
62    public LambdaInterchangeMove(int tour1, int position1, int length1,
63      int tour2, int position2, int length2) {
64        Tour1 = tour1;
65        Position1 = position1;
66        Length1 = length1;
67
68        Tour2 = tour2;
69        Position2 = position2;
70        Length2 = length2;
71    }
72
73    public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {
74      LambdaInterchangeMove clone = new LambdaInterchangeMove();
75
76      clone.Tour1 = Tour1;
77      clone.Position1 = Position1;
78      clone.Length1 = Length1;
79
80      clone.Tour2 = Tour2;
81      clone.Position2 = Position2;
82      clone.Length2 = Length2;
83
84      cloner.RegisterClonedObject(this, clone);
85      return clone;
86    }
87
88    #region IVRPMove Members
89
90    public TourEvaluation GetMoveQuality(
91      IVRPEncoding individual,
92      DoubleArray dueTimeArray, DoubleArray serviceTimeArray, DoubleArray readyTimeArray,
93      DoubleArray demandArray, DoubleValue capacity, DoubleMatrix coordinates,
94      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor,
95      DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
96      ILookupParameter<DoubleMatrix> distanceMatrix, Data.BoolValue useDistanceMatrix) {
97        return LambdaInterchangeMoveEvaluator.GetMoveQuality(individual as AlbaEncoding, this,
98          dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity,
99          coordinates, fleetUsageFactor, timeFactor, distanceFactor,
100          overloadPenalty, tardinessPenalty, distanceMatrix, useDistanceMatrix);
101    }
102
103    public void MakeMove(IRandom random, IVRPEncoding individual) {
104      LambdaInterchangeMoveMaker.Apply(individual as AlbaEncoding, this);
105    }
106
107    #endregion
108  }
109}
Note: See TracBrowser for help on using the repository browser.