PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
testit.cpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 Copyright (c) 2015 pgRouting developers
4 Mail: project@pgrouting.org
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 #include <stdio.h>
24 #include <vector>
25 
26 #include "GraphDefinition.h"
27 #include "utils.h"
28 
29 #include "issue191-bad-m1.h"
30 //#include "issue191-bad.h"
31 //#include "issue191-good.h"
32 
33 int main(void) {
35  int path_count;
36  char *err_msg;
37 
38  std::vector<PDVI> ruleTable;
39  ruleTable.clear();
40 
41  GraphDefinition gdef;
42  int res = gdef.my_dijkstra(edges, NEDGE, 2963487, 0.5, 3345813, 0.5, &path, &path_count, &err_msg, ruleTable);
43 
44  if (res < 0) {
45  printf("error: res: %d\n", res);
46  printf("%s\n", err_msg);
47  return 1;
48  }
49 
50  printf("Path count: %d\n", path_count);
51 
52  float8 tcost = 0.0;
53  for (int i=0; i<path_count; i++) {
54  printf("%4d: %7d, %7d, %.4f\n", i+1, path[i].vertex_id, path[i].edge_id, path[i].cost);
55  tcost += path[i].cost;
56  }
57  printf("\nTotal cost = %.4f\n", tcost);
58 
59  return 0;
60 }
int path_count
Definition: BDATester.cpp:51
int my_dijkstra(long start_vertex, long end_vertex, unsigned int edge_count, char **err_msg)
double float8
Definition: postgres.h:23
#define NEDGE
edge_astar_t * edges
Definition: BDATester.cpp:46
path_element_t * path
Definition: BDATester.cpp:49
int main(void)
Definition: testit.cpp:33
char * err_msg
Definition: BDATester.cpp:50
double cost
Definition: pgr_types.h:90