source: branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Shakers/OrienteeringShakingOperator.cs @ 11195

Last change on this file since 11195 was 11195, checked in by pfleck, 8 years ago

#2208 Added blank OrienteeringShakingOperator.

File size: 3.7 KB
Line 
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
22using HeuristicLab.Common;
23using HeuristicLab.Core;
24using HeuristicLab.Data;
25using HeuristicLab.Operators;
26using HeuristicLab.Optimization;
27using HeuristicLab.Parameters;
28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
29
30namespace HeuristicLab.Problems.Orienteering {
31  [Item("OrienteeringShakingOperator", @"The used neighborhood operator is based on a two point exchange move. A move in
32the k-th neighborhood consists of removing k consecutive vertices from the tour, starting
33at a randomly selected position. Afterwards, a sorted list of all vertices not yet included
34in the current tour is built. The vertices are sorted in descending order with respect to the
35objective value increase using the current weights. Out of the first three entries with the
36highest ranking in this list, one randomly selected vertex is reinserted into the current tour
37at the same position as the removed vertices. This way, l new vertices are inserted into the
38tour. The largest neighborhood is a complete exchange of all vertices on the tour.
39The shaking procedure does not guarantee that the new tour does not exceed the cost
40limit Tmax. Therefore, in a repair step, a sorted list of all vertices in the tour is created. The
41vertices are sorted in descending order with respect to costs saved when removing the vertex
42from 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}
Note: See TracBrowser for help on using the repository browser.