Free cookie consent management tool by TermsFeed Policy Generator

source: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/OnePointCrossover/PotvinOnePointCrossoverMove.cs @ 7689

Last change on this file since 7689 was 7689, checked in by svonolfe, 13 years ago

Added 2Opt* Move (#1177)

File size: 3.4 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.Potvin {
33  [Item("PotvinOnePointCrossoverMove", "Item that describes a relocation move on a VRP representation.")]
34  [StorableClass]
35  public class PotvinOnePointCrossoverMove: 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 X1 { get; protected set; }
44
45    [Storable]
46    public int Tour2 { get; protected set; }
47
48    [Storable]
49    public int X2 { get; protected set; }
50   
51    public PotvinOnePointCrossoverMove(): base() {
52      X1 = -1;
53      Tour1 = -1;
54      X2 = -1;
55      Tour2 = -1;
56
57      Individual = null;
58    }
59
60    public PotvinOnePointCrossoverMove(int tour1, int x1, int tour2, int x2, PotvinEncoding individual) {
61      Tour1 = tour1;
62      X1 = x1;
63      Tour2 = tour2;
64      X2 = x2;
65
66      this.Individual = individual.Clone() as PotvinEncoding;
67    }
68
69    public override IDeepCloneable Clone(Cloner cloner) {
70      return new PotvinOnePointCrossoverMove(this, cloner);
71    }
72
73    protected PotvinOnePointCrossoverMove(PotvinOnePointCrossoverMove original, Cloner cloner)
74      : base(original, cloner) {
75      this.Tour1 = original.Tour1;
76      this.X1 = original.X1;
77      this.Tour2 = original.Tour2;
78      this.X2 = original.X2;
79
80      this.Individual = cloner.Clone(Individual) as PotvinEncoding;
81    }
82
83    #region IVRPMove Members
84
85    public VRPMoveEvaluator GetMoveEvaluator() {
86      return new PotvinOnePointCrossoverMoveEvaluator();
87    }
88
89    public VRPMoveMaker GetMoveMaker() {
90      return new PotvinOnePointCrossoverMoveMaker();
91    }
92
93    public ITabuMaker GetTabuMaker() {
94      return new PotvinOnePointCrossoverMoveTabuMaker();
95    }
96
97    public ITabuChecker GetTabuChecker() {
98      return new PotvinOnePointCrossoverMoveTabuCriterion();
99    }
100
101    public ITabuChecker GetSoftTabuChecker() {
102      PotvinOnePointCrossoverMoveTabuCriterion tabuChecker = new PotvinOnePointCrossoverMoveTabuCriterion();
103      tabuChecker.UseAspirationCriterion.Value = true;
104
105      return tabuChecker;
106    }
107
108    #endregion
109  }
110}
Note: See TracBrowser for help on using the repository browser.