Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ParallelEngine/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveMaker.cs @ 5177

Last change on this file since 5177 was 5177, checked in by swagner, 14 years ago

Removed property ExecutionContext in Operator (#1333)

File size: 4.5 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.Common;
23using HeuristicLab.Core;
24using HeuristicLab.Data;
25using HeuristicLab.Parameters;
26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
27
28namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
29  [Item("AlbaTranslocationMoveMaker", "An operator which makes translocation moves for the Alba representation.")]
30  [StorableClass]
31  public abstract class AlbaMoveMaker : AlbaMoveOperator {
32    public ILookupParameter<DoubleValue> MoveVehcilesUtilizedParameter {
33      get { return (ILookupParameter<DoubleValue>)Parameters["MoveVehiclesUtilized"]; }
34    }
35    public ILookupParameter<DoubleValue> MoveTravelTimeParameter {
36      get { return (ILookupParameter<DoubleValue>)Parameters["MoveTravelTime"]; }
37    }
38    public ILookupParameter<DoubleValue> MoveDistanceParameter {
39      get { return (ILookupParameter<DoubleValue>)Parameters["MoveDistance"]; }
40    }
41    public ILookupParameter<DoubleValue> MoveOverloadParameter {
42      get { return (ILookupParameter<DoubleValue>)Parameters["MoveOverload"]; }
43    }
44    public ILookupParameter<DoubleValue> MoveTardinessParameter {
45      get { return (ILookupParameter<DoubleValue>)Parameters["MoveTardiness"]; }
46    }
47
48    public ILookupParameter<DoubleValue> VehcilesUtilizedParameter {
49      get { return (ILookupParameter<DoubleValue>)Parameters["VehiclesUtilized"]; }
50    }
51    public ILookupParameter<DoubleValue> TravelTimeParameter {
52      get { return (ILookupParameter<DoubleValue>)Parameters["TravelTime"]; }
53    }
54    public ILookupParameter<DoubleValue> DistanceParameter {
55      get { return (ILookupParameter<DoubleValue>)Parameters["Distance"]; }
56    }
57    public ILookupParameter<DoubleValue> OverloadParameter {
58      get { return (ILookupParameter<DoubleValue>)Parameters["Overload"]; }
59    }
60    public ILookupParameter<DoubleValue> TardinessParameter {
61      get { return (ILookupParameter<DoubleValue>)Parameters["Tardiness"]; }
62    }
63
64    [StorableConstructor]
65    protected AlbaMoveMaker(bool deserializing) : base(deserializing) { }
66    protected AlbaMoveMaker(AlbaMoveMaker original, Cloner cloner) : base(original, cloner) { }
67    public AlbaMoveMaker()
68      : base() {
69      Parameters.Add(new LookupParameter<DoubleValue>("MoveVehiclesUtilized", "The number of vehicles utilized."));
70      Parameters.Add(new LookupParameter<DoubleValue>("MoveTravelTime", "The total travel time."));
71      Parameters.Add(new LookupParameter<DoubleValue>("MoveDistance", "The distance."));
72      Parameters.Add(new LookupParameter<DoubleValue>("MoveOverload", "The overload."));
73      Parameters.Add(new LookupParameter<DoubleValue>("MoveTardiness", "The tardiness."));
74
75      Parameters.Add(new LookupParameter<DoubleValue>("VehiclesUtilized", "The number of vehicles utilized."));
76      Parameters.Add(new LookupParameter<DoubleValue>("TravelTime", "The total travel time."));
77      Parameters.Add(new LookupParameter<DoubleValue>("Distance", "The distance."));
78      Parameters.Add(new LookupParameter<DoubleValue>("Overload", "The overload."));
79      Parameters.Add(new LookupParameter<DoubleValue>("Tardiness", "The tardiness."));
80    }
81
82    public override IOperation Apply(IExecutionContext context) {
83      IOperation successor = base.Apply(context);
84
85      VehcilesUtilizedParameter.ActualValue = MoveVehcilesUtilizedParameter.ActualValue;
86      TravelTimeParameter.ActualValue = MoveTravelTimeParameter.ActualValue;
87      DistanceParameter.ActualValue = MoveDistanceParameter.ActualValue;
88      OverloadParameter.ActualValue = MoveOverloadParameter.ActualValue;
89      TardinessParameter.ActualValue = MoveTardinessParameter.ActualValue;
90
91      return successor;
92    }
93  }
94}
Note: See TracBrowser for help on using the repository browser.