Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Operators/Moves/Rearrange/PotvinPDRearrangeMove.cs @ 8670

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

Added first version of the dynamic vehicle routing addon (#1955)

File size: 3.9 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;
31using System;
32using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
33
34namespace HeuristicLab.PDPSimulation.Operators {
35  [Item("DynPotvinPDRearrangeMove", "Item that describes a rearrange move on a PDP representation.")]
36  [StorableClass]
37  public class DynPotvinPDRearrangeMove: Item, IVRPMove {
38    [Storable]
39    public IVRPEncoding Individual { get; protected set; }
40   
41    [Storable]
42    public int City { get; protected set; }
43
44    [Storable]
45    public int Tour { get; protected set; }
46   
47    public DynPotvinPDRearrangeMove(): base() {
48      City = -1;
49      Tour = -1;
50
51      Individual = null;
52    }
53
54    public DynPotvinPDRearrangeMove(int city, int tour, PotvinEncoding individual) {
55      City = city;
56      Tour = tour;
57
58      this.Individual = individual.Clone() as PotvinEncoding;
59    }
60
61    public override IDeepCloneable Clone(Cloner cloner) {
62      return new DynPotvinPDRearrangeMove(this, cloner);
63    }
64
65    protected DynPotvinPDRearrangeMove(DynPotvinPDRearrangeMove original, Cloner cloner)
66      : base(original, cloner) {
67      this.City = original.City;
68      this.Tour = original.Tour;
69
70      this.Individual = cloner.Clone(Individual) as PotvinEncoding;
71    }
72
73    #region IVRPMove Members
74
75    [ThreadStatic]
76    private static DynPotvinPDRearrangeMoveEvaluator moveEvaluator;
77    public VRPMoveEvaluator GetMoveEvaluator() {
78      if(moveEvaluator == null)
79        moveEvaluator = new DynPotvinPDRearrangeMoveEvaluator();
80
81      return moveEvaluator;
82    }
83
84    [ThreadStatic]
85    private static DynPotvinPDRearrangeMoveMaker moveMaker;
86    public VRPMoveMaker GetMoveMaker() {
87      if (moveMaker == null)
88        moveMaker = new DynPotvinPDRearrangeMoveMaker();
89
90      return moveMaker;
91    }
92
93    [ThreadStatic]
94    private static DynPotvinPDRearrangeMoveTabuMaker tabuMaker;
95    public ITabuMaker GetTabuMaker() {
96      if (tabuMaker == null)
97        tabuMaker = new DynPotvinPDRearrangeMoveTabuMaker();
98
99      return tabuMaker;
100    }
101
102    [ThreadStatic]
103    private static DynPotvinPDRearrangeTabuCriterion tabuChecker;
104    public ITabuChecker GetTabuChecker() {
105      if (tabuChecker == null) {
106        tabuChecker = new DynPotvinPDRearrangeTabuCriterion();
107        tabuChecker.UseAspirationCriterion.Value = false;
108      }
109
110      return tabuChecker;
111    }
112
113    [ThreadStatic]
114    private static DynPotvinPDRearrangeTabuCriterion softTabuChecker;
115    public ITabuChecker GetSoftTabuChecker() {
116      if (softTabuChecker == null) {
117        softTabuChecker = new DynPotvinPDRearrangeTabuCriterion();
118        softTabuChecker.UseAspirationCriterion.Value = true;
119      }
120
121      return softTabuChecker;
122    }
123
124    #endregion
125  }
126}
Note: See TracBrowser for help on using the repository browser.