[13368] | 1 | #region License Information
|
---|
[7689] | 2 | /* HeuristicLab
|
---|
[12012] | 3 | * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[7689] | 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 |
|
---|
[8053] | 22 | using HeuristicLab.Common;
|
---|
[7689] | 23 | using HeuristicLab.Core;
|
---|
[8053] | 24 | using HeuristicLab.Optimization;
|
---|
[7689] | 25 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 26 | using HeuristicLab.Problems.VehicleRouting.Encodings.General;
|
---|
| 27 | using HeuristicLab.Problems.VehicleRouting.Interfaces;
|
---|
| 28 |
|
---|
| 29 | namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
|
---|
[7865] | 30 | [Item("PotvinTwoOptStarMove", "Item that describes a two opt star move on a VRP representation.")]
|
---|
[14711] | 31 | [StorableType("34A7409D-ABED-4BAD-B0A1-7EC392B027D5")]
|
---|
[8053] | 32 | public class PotvinTwoOptStarMove : Item, IVRPMove {
|
---|
[7689] | 33 | [Storable]
|
---|
| 34 | public IVRPEncoding Individual { get; protected set; }
|
---|
[8053] | 35 |
|
---|
[7689] | 36 | [Storable]
|
---|
| 37 | public int Tour1 { get; protected set; }
|
---|
| 38 |
|
---|
| 39 | [Storable]
|
---|
| 40 | public int X1 { get; protected set; }
|
---|
| 41 |
|
---|
| 42 | [Storable]
|
---|
| 43 | public int Tour2 { get; protected set; }
|
---|
| 44 |
|
---|
| 45 | [Storable]
|
---|
| 46 | public int X2 { get; protected set; }
|
---|
[8053] | 47 |
|
---|
| 48 | public PotvinTwoOptStarMove()
|
---|
| 49 | : base() {
|
---|
[7689] | 50 | X1 = -1;
|
---|
| 51 | Tour1 = -1;
|
---|
| 52 | X2 = -1;
|
---|
| 53 | Tour2 = -1;
|
---|
| 54 |
|
---|
| 55 | Individual = null;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
[7865] | 58 | public PotvinTwoOptStarMove(int tour1, int x1, int tour2, int x2, PotvinEncoding individual) {
|
---|
[7689] | 59 | Tour1 = tour1;
|
---|
| 60 | X1 = x1;
|
---|
| 61 | Tour2 = tour2;
|
---|
| 62 | X2 = x2;
|
---|
| 63 |
|
---|
| 64 | this.Individual = individual.Clone() as PotvinEncoding;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
[7865] | 68 | return new PotvinTwoOptStarMove(this, cloner);
|
---|
[7689] | 69 | }
|
---|
| 70 |
|
---|
[7865] | 71 | protected PotvinTwoOptStarMove(PotvinTwoOptStarMove original, Cloner cloner)
|
---|
[7689] | 72 | : base(original, cloner) {
|
---|
| 73 | this.Tour1 = original.Tour1;
|
---|
| 74 | this.X1 = original.X1;
|
---|
| 75 | this.Tour2 = original.Tour2;
|
---|
| 76 | this.X2 = original.X2;
|
---|
| 77 |
|
---|
| 78 | this.Individual = cloner.Clone(Individual) as PotvinEncoding;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
[7906] | 81 | [StorableConstructor]
|
---|
| 82 | protected PotvinTwoOptStarMove(bool deserializing) : base(deserializing) { }
|
---|
| 83 |
|
---|
[7689] | 84 | #region IVRPMove Members
|
---|
| 85 |
|
---|
| 86 | public VRPMoveEvaluator GetMoveEvaluator() {
|
---|
[7865] | 87 | return new PotvinTwoOptStarMoveEvaluator();
|
---|
[7689] | 88 | }
|
---|
| 89 |
|
---|
| 90 | public VRPMoveMaker GetMoveMaker() {
|
---|
[7865] | 91 | return new PotvinTwoOptStarMoveMaker();
|
---|
[7689] | 92 | }
|
---|
| 93 |
|
---|
| 94 | public ITabuMaker GetTabuMaker() {
|
---|
[7865] | 95 | return new PotvinTwoOptStarMoveTabuMaker();
|
---|
[7689] | 96 | }
|
---|
| 97 |
|
---|
| 98 | public ITabuChecker GetTabuChecker() {
|
---|
[7865] | 99 | return new PotvinTwoOptStarMoveTabuCriterion();
|
---|
[7689] | 100 | }
|
---|
| 101 |
|
---|
| 102 | public ITabuChecker GetSoftTabuChecker() {
|
---|
[7865] | 103 | PotvinTwoOptStarMoveTabuCriterion tabuChecker = new PotvinTwoOptStarMoveTabuCriterion();
|
---|
[7689] | 104 | tabuChecker.UseAspirationCriterion.Value = true;
|
---|
| 105 |
|
---|
| 106 | return tabuChecker;
|
---|
| 107 | }
|
---|
| 108 |
|
---|
| 109 | #endregion
|
---|
| 110 | }
|
---|
| 111 | }
|
---|