1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2014 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 |
|
---|
22 | using HeuristicLab.Common;
|
---|
23 | using HeuristicLab.Core;
|
---|
24 | using HeuristicLab.Data;
|
---|
25 | using HeuristicLab.Operators;
|
---|
26 | using HeuristicLab.Optimization;
|
---|
27 | using HeuristicLab.Parameters;
|
---|
28 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
29 |
|
---|
30 | namespace HeuristicLab.Problems.Orienteering {
|
---|
31 | [Item("OrienteeringShakingOperator", @"The used neighborhood operator is based on a two point exchange move. A move in
|
---|
32 | the k-th neighborhood consists of removing k consecutive vertices from the tour, starting
|
---|
33 | at a randomly selected position. Afterwards, a sorted list of all vertices not yet included
|
---|
34 | in the current tour is built. The vertices are sorted in descending order with respect to the
|
---|
35 | objective value increase using the current weights. Out of the first three entries with the
|
---|
36 | highest ranking in this list, one randomly selected vertex is reinserted into the current tour
|
---|
37 | at the same position as the removed vertices. This way, l new vertices are inserted into the
|
---|
38 | tour. The largest neighborhood is a complete exchange of all vertices on the tour.
|
---|
39 | The shaking procedure does not guarantee that the new tour does not exceed the cost
|
---|
40 | limit Tmax. Therefore, in a repair step, a sorted list of all vertices in the tour is created. The
|
---|
41 | vertices are sorted in descending order with respect to costs saved when removing the vertex
|
---|
42 | from the tour. Vertices are removed as long as the cost limit is violated.
|
---|
43 | (Schilde et. al. 2009)")]
|
---|
44 | [StorableClass]
|
---|
45 | public class OrienteeringShakingOperator : SingleSuccessorOperator, IMultiNeighborhoodShakingOperator {
|
---|
46 |
|
---|
47 | public IValueLookupParameter<IntValue> CurrentNeighborhoodIndexParameter {
|
---|
48 | get { return (IValueLookupParameter<IntValue>)Parameters["CurrentNeighborhoodIndex"]; }
|
---|
49 | }
|
---|
50 |
|
---|
51 | public ILookupParameter<IntValue> NeighborhoodCountParameter {
|
---|
52 | get { return (ILookupParameter<IntValue>)Parameters["NeighborhoodCount"]; }
|
---|
53 | }
|
---|
54 |
|
---|
55 | [StorableConstructor]
|
---|
56 | private OrienteeringShakingOperator(bool deserializing) : base(deserializing) { }
|
---|
57 | private OrienteeringShakingOperator(OrienteeringShakingOperator original, Cloner cloner)
|
---|
58 | : base(original, cloner) {
|
---|
59 | //RegisterEventHandlers();
|
---|
60 | }
|
---|
61 | public OrienteeringShakingOperator()
|
---|
62 | : base() {
|
---|
63 | Parameters.Add(new ValueLookupParameter<IntValue>("CurrentNeighborhoodIndex", "The index of the operator that should be applied (k)."));
|
---|
64 | Parameters.Add(new LookupParameter<IntValue>("NeighborhoodCount", "The number of operators that are available."));
|
---|
65 |
|
---|
66 | //RegisterEventHandlers();
|
---|
67 | }
|
---|
68 |
|
---|
69 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
70 | return new OrienteeringShakingOperator(this, cloner);
|
---|
71 | }
|
---|
72 |
|
---|
73 | [StorableHook(HookType.AfterDeserialization)]
|
---|
74 | private void AfterDeserialization() {
|
---|
75 | //RegisterEventHandlers();
|
---|
76 | }
|
---|
77 |
|
---|
78 | public override IOperation Apply() {
|
---|
79 | // TODO
|
---|
80 |
|
---|
81 | return base.Apply();
|
---|
82 | }
|
---|
83 | }
|
---|
84 | } |
---|