Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Parsers/DynPDPParser.cs @ 10194

Last change on this file since 10194 was 8839, checked in by svonolfe, 12 years ago

Adapted the parser to read the distance matrix (#1955)

File size: 2.8 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 System;
23using System.Collections.Generic;
24using System.IO;
25using System.Text.RegularExpressions;
26
27namespace HeuristicLab.PDPSimulation {
28  abstract class DynPDPParser {
29    public struct Vehicle {
30      public double xCoord;
31      public double yCoord;
32      public double capacity;
33      public double readyTime;
34      public double dueTime;
35    }
36
37    public struct Order {
38      public double revealedTime;
39      public double pickupXCoord;
40      public double pickupYCoord;
41      public double deliveryXCoord;
42      public double deliveryYCoord;
43      public double demand;
44      public double pickupServiceTime;
45      public double pickupReadyTime;
46      public double pickupDueTime;
47      public double deliveryServiceTime;
48      public double deliveryReadyTime;
49      public double deliveryDueTime;
50    }
51
52    public struct DistanceMatrixInformation {
53      public bool useDistanceMatrix;
54      public int[,] coordinates;
55      public double[,] matrix;
56    }
57
58    protected string file;
59    protected string problemName;
60    protected List<Vehicle> vehicles;
61    protected List<Order> orders;
62    protected DistanceMatrixInformation distanceMatrix;
63
64    public string ProblemName {
65      get {
66        return new string(problemName.ToCharArray());
67      }
68    }
69
70    public Vehicle[] Vehicles {
71      get {
72        return vehicles.ToArray();
73      }
74    }
75
76    public Order[] Orders {
77      get {
78        return orders.ToArray();
79      }
80    }
81
82    public DistanceMatrixInformation DistanceMatrix {
83      get {
84        return distanceMatrix;
85      }
86    }
87
88    public DynPDPParser(string file) {
89      this.file = file;
90      vehicles = new List<Vehicle>();
91      orders = new List<Order>();
92      distanceMatrix = new DistanceMatrixInformation();
93      distanceMatrix.useDistanceMatrix = false;
94      distanceMatrix.coordinates = null;
95      distanceMatrix.matrix = null;
96    }
97
98    public abstract void Parse();
99  }
100}
Note: See TracBrowser for help on using the repository browser.