58 (errcode(ERRCODE_INTERNAL_ERROR),
59 errmsg(
"Illegal value in parameter: factor"),
60 errhint(
"Value found: %f <= 0", factor)));
62 (*result_tuples) = NULL;
68 (errcode(ERRCODE_INTERNAL_ERROR),
69 errmsg(
"Illegal value in parameter: max_cycles"),
70 errhint(
"Negative value found: max_cycles: %d ", max_cycles)));
72 (*result_tuples) = NULL;
76 if (initial_solution_id <= 0 || initial_solution_id > 6) {
77 elog(ERROR,
"Illegal value in parameter: initial_sol");
79 (*result_tuples) = NULL;
87 size_t total_pd_orders = 0;
89 &pd_orders_arr, &total_pd_orders);
93 size_t total_vehicles = 0;
95 &vehicles_arr, &total_vehicles);
96 PGR_DBG(
"total vehicles %ld", total_vehicles);
98 for (
size_t i = 0; i < total_pd_orders; i++) {
99 PGR_DBG(
"%ld %f pick %f %f %ld - "
100 "%f %f %f deliver %f %f %ld - %f %f %f ",
102 pd_orders_arr[i].demand,
104 pd_orders_arr[i].pick_x,
105 pd_orders_arr[i].pick_y,
106 pd_orders_arr[i].pick_node_id,
108 pd_orders_arr[i].pick_open_t,
109 pd_orders_arr[i].pick_close_t,
110 pd_orders_arr[i].pick_service_t,
112 pd_orders_arr[i].deliver_x,
113 pd_orders_arr[i].deliver_y,
114 pd_orders_arr[i].deliver_node_id,
116 pd_orders_arr[i].deliver_open_t,
117 pd_orders_arr[i].deliver_close_t,
118 pd_orders_arr[i].deliver_service_t);
123 for (
size_t i = 0; i < total_vehicles; i++) {
124 PGR_DBG(
"%ld %f %f , start %f %f %f %f %f "
125 "end %f %f %f %f %f number %ld ",
127 vehicles_arr[i].capacity,
128 vehicles_arr[i].speed,
130 vehicles_arr[i].start_x,
131 vehicles_arr[i].start_y,
132 vehicles_arr[i].start_open_t,
133 vehicles_arr[i].start_close_t,
134 vehicles_arr[i].start_service_t,
136 vehicles_arr[i].end_x,
137 vehicles_arr[i].end_y,
138 vehicles_arr[i].end_open_t,
139 vehicles_arr[i].end_close_t,
140 vehicles_arr[i].end_service_t,
142 vehicles_arr[i].cant_v);
145 if (total_pd_orders == 0 || total_vehicles == 0) {
147 (*result_tuples) = NULL;
151 PGR_DBG(
"Total %ld orders in query:", total_pd_orders);
153 PGR_DBG(
"Starting processing");
154 clock_t start_t = clock();
155 char *log_msg = NULL;
156 char *notice_msg = NULL;
157 char *err_msg = NULL;
159 pd_orders_arr, total_pd_orders,
160 vehicles_arr, total_vehicles,
172 time_msg(
"_pgr_pickDeliverEuclidean", start_t, clock());
174 if (err_msg && (*result_tuples)) {
175 pfree(*result_tuples);
177 (*result_tuples) = NULL;
182 if (log_msg) pfree(log_msg);
183 if (notice_msg) pfree(notice_msg);
184 if (err_msg) pfree(err_msg);
185 if (pd_orders_arr) pfree(pd_orders_arr);
186 if (vehicles_arr) pfree(vehicles_arr);