Free cookie consent management tool by TermsFeed Policy Generator

source: branches/GP-MoveOperators/HeuristicLab.Problems.VehicleRouting/3.3/VRPOperator.cs @ 9844

Last change on this file since 9844 was 7259, checked in by swagner, 13 years ago

Updated year of copyrights to 2012 (#1716)

File size: 4.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 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.Parameters;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28using HeuristicLab.Problems.VehicleRouting.Encodings;
29
30namespace HeuristicLab.Problems.VehicleRouting {
31  [Item("VRPOperator", "A VRP operator.")]
32  [StorableClass]
33  public abstract class VRPOperator : SingleSuccessorOperator, IVRPOperator {
34    public int Cities {
35      get { return CoordinatesParameter.ActualValue.Rows - 1; }
36    }
37    public ILookupParameter<DoubleMatrix> CoordinatesParameter {
38      get {
39        if (Parameters.ContainsKey("Coordinates"))
40          return (ILookupParameter<DoubleMatrix>)Parameters["Coordinates"];
41        else
42          return null;
43      }
44    }
45    public ILookupParameter<DoubleMatrix> DistanceMatrixParameter {
46      get {
47        if (Parameters.ContainsKey("DistanceMatrix"))
48          return (ILookupParameter<DoubleMatrix>)Parameters["DistanceMatrix"];
49        else
50          return null;
51      }
52    }
53    public ILookupParameter<BoolValue> UseDistanceMatrixParameter {
54      get {
55        if (Parameters.ContainsKey("UseDistanceMatrix"))
56          return (ILookupParameter<BoolValue>)Parameters["UseDistanceMatrix"];
57        else
58          return null;
59      }
60    }
61    public ILookupParameter<IntValue> VehiclesParameter {
62      get {
63        if (Parameters.ContainsKey("Vehicles"))
64          return (ILookupParameter<IntValue>)Parameters["Vehicles"];
65        else
66          return null;
67      }
68    }
69    public ILookupParameter<DoubleValue> CapacityParameter {
70      get {
71        if (Parameters.ContainsKey("Capacity"))
72          return (ILookupParameter<DoubleValue>)Parameters["Capacity"];
73        else
74          return null;
75      }
76    }
77    public ILookupParameter<DoubleArray> DemandParameter {
78      get {
79        if (Parameters.ContainsKey("Demand"))
80          return (ILookupParameter<DoubleArray>)Parameters["Demand"];
81        else
82          return null;
83      }
84    }
85    public ILookupParameter<DoubleArray> ReadyTimeParameter {
86      get {
87        if (Parameters.ContainsKey("ReadyTime"))
88          return (ILookupParameter<DoubleArray>)Parameters["ReadyTime"];
89        else
90          return null;
91      }
92    }
93    public ILookupParameter<DoubleArray> DueTimeParameter {
94      get {
95        if (Parameters.ContainsKey("DueTime"))
96          return (ILookupParameter<DoubleArray>)Parameters["DueTime"];
97        else
98          return null;
99      }
100    }
101    public ILookupParameter<DoubleArray> ServiceTimeParameter {
102      get {
103        if (Parameters.ContainsKey("ServiceTime"))
104          return (ILookupParameter<DoubleArray>)Parameters["ServiceTime"];
105        else
106          return null;
107      }
108    }
109
110    [StorableConstructor]
111    protected VRPOperator(bool deserializing) : base(deserializing) { }
112    protected VRPOperator(VRPOperator original, Cloner cloner) : base(original, cloner) { }
113    public VRPOperator()
114      : base() {
115      Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The coordinates of the cities."));
116      Parameters.Add(new LookupParameter<DoubleMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
117      Parameters.Add(new LookupParameter<BoolValue>("UseDistanceMatrix", "True if a distance matrix should be calculated and used for evaluation, otherwise false."));
118      Parameters.Add(new LookupParameter<IntValue>("Vehicles", "The number of vehicles."));
119      Parameters.Add(new LookupParameter<DoubleValue>("Capacity", "The capacity of each vehicle."));
120      Parameters.Add(new LookupParameter<DoubleArray>("Demand", "The demand of each customer."));
121      Parameters.Add(new LookupParameter<DoubleArray>("ReadyTime", "The ready time of each customer."));
122      Parameters.Add(new LookupParameter<DoubleArray>("DueTime", "The due time of each customer."));
123      Parameters.Add(new LookupParameter<DoubleArray>("ServiceTime", "The service time of each customer."));
124    }
125  }
126}
Note: See TracBrowser for help on using the repository browser.