Free cookie consent management tool by TermsFeed Policy Generator

source: branches/1955_DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/DomainModel/Vehicle.cs @ 16099

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

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

File size: 4.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2011 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 System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Text;
26using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
27using HeuristicLab.Common;
28
29namespace HeuristicLab.PDPSimulation.DomainModel {
30  public enum VehicleState { Parked, Waiting, InvalidAction, Moving, Servicing }
31
32  [StorableClass]
33  public class Vehicle: BaseObject {
34    //State
35    [Storable]
36    public VehicleState VehicleState { get; set; }
37    [Storable]
38    public List<Guid> PickedUpOrders { get; set; }
39    [Storable]
40    public double PositionX { get; set; }
41    [Storable]
42    public double PositionY { get; set; }
43    [Storable]
44    public double Overload { get; set; }
45    [Storable]
46    public double Distance { get; set; }
47    [Storable]
48    public double Capacity { get; set; }
49    [Storable]
50    public double ReadyTime { get; set; }
51    [Storable]
52    public int InvalidActions { get; set; }
53    [Storable]
54    public double Tardiness { get; set; }
55    [Storable]
56    public double TargetPositionX { get; set; }
57    [Storable]
58    public double TargetPositionY { get; set; }
59    [Storable]
60    public Guid CurrentOrder { get; set; }
61    [Storable]
62    public VehicleAction CurrentAction { get; set; }
63    [Storable]
64    public int Availibility { get; set; }
65   
66    [StorableClass]
67    public class MoveInformation {
68      [Storable]
69      public int Segment { get; set; }
70
71      [Storable]
72      public int Source { get; set; }
73
74      [Storable]
75      public int Dest { get; set; }
76
77      public object Path { get; set; }
78    }
79   
80    [Storable]
81    public MoveInformation MoveInfo { get; set; }
82   
83    //Data
84    [Storable]
85    public string Name { get; set; }
86    [Storable]
87    public double TotalCapacity { get; set; }
88    [Storable]
89    public double DepotX { get; set; }
90    [Storable]
91    public double DepotY { get; set; }
92    [Storable]
93    public double DueTime { get; set; }
94
95    public Vehicle()
96      : base() {
97        PickedUpOrders = new List<Guid>();
98        MoveInfo = new MoveInformation();
99    }
100    [StorableConstructor]
101    private Vehicle(bool deserializing) : base(deserializing) {
102    }
103    private Vehicle(Vehicle original, Cloner cloner)
104      : base(original, cloner) {
105        VehicleState = original.VehicleState;
106        PickedUpOrders = new List<Guid>(original.PickedUpOrders);
107        PositionX = original.PositionX;
108        PositionY = original.PositionY;
109        Overload = original.Overload;
110        Distance = original.Distance;
111        DepotX = original.DepotX;
112        DepotY = original.DepotY;
113        Capacity = original.Capacity;
114        ReadyTime = original.ReadyTime;
115        DueTime = original.DueTime;
116        InvalidActions = original.InvalidActions;
117        Tardiness = original.Tardiness;
118        TargetPositionX = original.TargetPositionX;
119        TargetPositionY = original.TargetPositionY;
120        CurrentOrder = original.CurrentOrder;
121        CurrentAction = original.CurrentAction;
122        TotalCapacity = original.TotalCapacity;
123        MoveInfo = new MoveInformation();
124        MoveInfo.Source = original.MoveInfo.Source;
125        MoveInfo.Dest = original.MoveInfo.Dest;
126        MoveInfo.Segment = original.MoveInfo.Segment;
127        Availibility = original.Availibility;
128        Name = original.Name;
129    }
130    public override IDeepCloneable Clone(Cloner cloner) {
131      return new Vehicle(this, cloner);
132    }
133  }
134}
Note: See TracBrowser for help on using the repository browser.