pgRouting  2.2
pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.
 All Classes Functions Variables Pages
pdp.hpp
1 /*PGR-GNU*****************************************************************
2 
3 Copyright (c) 2014 Manikata Kondeti
4 mani.iiit123@gmail.com
5 
6 ------
7 
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 
22 ********************************************************************PGR-GNU*/
23 
24 #pragma once
25 
26 #include <math.h>
27 #include <vector>
28 
29 // Exclusive for c++ inclusion
30 
31 typedef struct {
32  int64_t id;
33  double x;
34  double y;
35  double demand;
36  double Etime;
37  double Ltime;
38  double Stime;
39  int64_t Pindex;
40  int64_t Dindex;
41 } Depot;
42 
43 
44 typedef struct {
45  int64_t Pid;
46  double Ddist;
47  int64_t Did;
48 } Pickup;
49 
50 typedef std::vector< Customer > Customers;
51 typedef std::vector< Pickup > Pickups;
52 
53 
54 // It is used to save some variables and helps if we need to revisit
55 // previous state.
56 
57 typedef struct {
58  int64_t twv;
59  int64_t cv;
60  int64_t dis;
61  std::vector< int64_t > path;
62 } State;
63 
64 template <class T1, class T2>
65 double
66 CalculateDistance(const T1 &from, const T2 &to) {
67  return sqrt((from.x - to.x) * (from.x - to.x)
68  + (from.y - to.y) * (from.y - to.y));
69 }
Definition: pdp.hpp:44
Definition: pdp.hpp:57
Definition: pdp.hpp:31