58 (errcode(ERRCODE_INTERNAL_ERROR),
59 errmsg(
"Illegal value in parameter: factor"),
60 errhint(
"Value found: %f <= 0", factor)));
62 (*result_tuples) = NULL;
67 elog(ERROR,
"Illegal value in parameter: max_cycles");
69 (*result_tuples) = NULL;
73 if (initial_solution_id < 0 || initial_solution_id > 7) {
74 elog(ERROR,
"Illegal value in parameter: initial");
76 (*result_tuples) = NULL;
84 size_t total_pd_orders = 0;
86 &pd_orders_arr, &total_pd_orders);
90 size_t total_vehicles = 0;
92 &vehicles_arr, &total_vehicles);
93 PGR_DBG(
"total vehicles %ld", total_vehicles);
97 for (
size_t i = 0; i < total_pd_orders; i++) {
98 PGR_DBG(
"%ld %f pick %f %f %ld - "
99 "%f %f %f deliver %f %f %ld - %f %f %f ",
101 pd_orders_arr[i].demand,
103 pd_orders_arr[i].pick_x,
104 pd_orders_arr[i].pick_y,
105 pd_orders_arr[i].pick_node_id,
107 pd_orders_arr[i].pick_open_t,
108 pd_orders_arr[i].pick_close_t,
109 pd_orders_arr[i].pick_service_t,
111 pd_orders_arr[i].deliver_x,
112 pd_orders_arr[i].deliver_y,
113 pd_orders_arr[i].deliver_node_id,
115 pd_orders_arr[i].deliver_open_t,
116 pd_orders_arr[i].deliver_close_t,
117 pd_orders_arr[i].deliver_service_t);
120 for (
size_t i = 0; i < total_vehicles; i++) {
121 PGR_DBG(
"%ld %f %f / %ld %f %f %f %f %f / %ld %f %f %f %f %f / %ld ",
123 vehicles_arr[i].capacity,
124 vehicles_arr[i].speed,
126 vehicles_arr[i].start_node_id,
127 vehicles_arr[i].start_x,
128 vehicles_arr[i].start_y,
129 vehicles_arr[i].start_open_t,
130 vehicles_arr[i].start_close_t,
131 vehicles_arr[i].start_service_t,
133 vehicles_arr[i].end_node_id,
134 vehicles_arr[i].end_x,
135 vehicles_arr[i].end_y,
136 vehicles_arr[i].end_open_t,
137 vehicles_arr[i].end_close_t,
138 vehicles_arr[i].end_service_t,
140 vehicles_arr[i].cant_v);
145 size_t total_cells = 0;
149 if (total_pd_orders == 0 || total_vehicles == 0 || total_cells == 0) {
151 (*result_tuples) = NULL;
155 PGR_DBG(
"Total %ld orders in query:", total_pd_orders);
156 PGR_DBG(
"Total %ld vehicles in query:", total_vehicles);
157 PGR_DBG(
"Total %ld matrix cells in query:", total_cells);
160 PGR_DBG(
"Starting processing");
161 clock_t start_t = clock();
162 char *log_msg = NULL;
163 char *notice_msg = NULL;
164 char *err_msg = NULL;
167 pd_orders_arr, total_pd_orders,
168 vehicles_arr, total_vehicles,
169 matrix_cells_arr, total_cells,
182 time_msg(
"pgr_pickDeliver", start_t, clock());
184 if (err_msg && (*result_tuples)) {
185 pfree(*result_tuples);
187 (*result_tuples) = NULL;
195 if (log_msg) pfree(log_msg);
196 if (notice_msg) pfree(notice_msg);
197 if (err_msg) pfree(err_msg);
198 if (pd_orders_arr) pfree(pd_orders_arr);
199 if (vehicles_arr) pfree(vehicles_arr);
200 if (matrix_cells_arr) pfree(matrix_cells_arr);