54 size_t total_customers,
57 size_t total_vehicles,
61 int initial_solution_id,
69 std::ostringstream log;
70 std::ostringstream notice;
71 std::ostringstream err;
73 std::ostringstream tmp_log;
74 *return_tuples = NULL;
80 std::vector<PickDeliveryOrders_t> orders(
81 customers_arr, customers_arr + total_customers);
82 std::vector<Vehicle_t> vehicles(
83 vehicles_arr, vehicles_arr + total_vehicles);
85 log <<
"Initialize problem\n";
94 if (!err.str().empty()) {
99 *log_msg =
pgr_msg(log.str().c_str());
100 *err_msg =
pgr_msg(err.str().c_str());
104 log <<
"Finish Reading data\n";
112 log <<
"Caught unknown exception!";
117 log <<
"Finish solve\n";
121 log <<
"solution size: " << solution.size() <<
"\n";
124 if (!solution.empty()) {
125 (*return_tuples) =
pgr_alloc(solution.size(), (*return_tuples));
127 for (
const auto &row : solution) {
128 (*return_tuples)[seq] = row;
132 (*return_count) = solution.size();
137 *log_msg = log.str().empty()?
140 *notice_msg = notice.str().empty()?
144 if (*return_tuples) free(*return_tuples);
146 err << except.
what();
147 *err_msg =
pgr_msg(err.str().c_str());
148 *log_msg =
pgr_msg(log.str().c_str());
149 }
catch (std::exception& except) {
150 if (*return_tuples) free(*return_tuples);
152 err << except.what();
153 *err_msg =
pgr_msg(err.str().c_str());
154 *log_msg =
pgr_msg(log.str().c_str());
156 if (*return_tuples) free(*return_tuples);
158 err <<
"Caught unknown exception!";
159 *err_msg =
pgr_msg(err.str().c_str());
160 *log_msg =
pgr_msg(log.str().c_str());
Extends std::exception and is the exception that we throw if an assert fails.
std::string get_log() const
get_log
std::string get_error() const
get_error
#define pgassert(expr)
Uses the standard assert syntax.
char * pgr_msg(const std::string &msg)
T * pgr_alloc(std::size_t size, T *ptr)
allocates memory
virtual const char * what() const
void do_pgr_pickDeliverEuclidean(PickDeliveryOrders_t *customers_arr, size_t total_customers, Vehicle_t *vehicles_arr, size_t total_vehicles, double factor, int max_cycles, int initial_solution_id, General_vehicle_orders_t **return_tuples, size_t *return_count, char **log_msg, char **notice_msg, char **err_msg)
std::vector< General_vehicle_orders_t > get_postgres_result() const