vrpRouting  0.3
vrp_vroom_problem.hpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: vrp_vroom_problem.hpp
3 
4 Copyright (c) 2021 pgRouting developers
6 
7 Function's developer:
8 Copyright (c) 2021 Ashish Kumar
10 ------
11 
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16 
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21 
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 
26  ********************************************************************PGR-GNU*/
27 
28 #ifndef INCLUDE_CPP_COMMON_VRP_VROOM_PROBLEM_HPP_
29 #define INCLUDE_CPP_COMMON_VRP_VROOM_PROBLEM_HPP_
30 #pragma once
31 
32 #include <map>
33 #include <string>
34 #include <unordered_set>
35 #include <utility>
36 #include <vector>
37 
38 #include "c_types/matrix_cell_t.h"
41 #include "c_types/vroom/vroom_rt.h"
45 #include "cpp_common/base_matrix.h"
48 #include "structures/vroom/input/input.h"
49 #include "structures/vroom/job.h"
50 #include "structures/vroom/vehicle.h"
51 
52 namespace vrprouting {
53 
55  public:
56  std::vector<vroom::Job> jobs() const { return m_jobs; }
57  std::vector<std::pair<vroom::Job, vroom::Job>> shipments() const { return m_shipments; }
58  std::vector<vroom::Vehicle> vehicles() const { return m_vehicles; }
60 
64 
72  vroom::TimeWindow
73  get_vroom_time_window(const Vroom_time_window_t &time_window) const {
74  return
75  vroom::TimeWindow(time_window.tw_open,
76  time_window.tw_close);
77  }
78 
79  vroom::TimeWindow
80  get_vroom_time_window(Duration tw_open, Duration tw_close) const {
81  return vroom::TimeWindow(tw_open, tw_close);
82  }
83 
84  std::vector<vroom::TimeWindow>
86  const std::vector<Vroom_time_window_t> &time_windows) const {
87  std::vector < vroom::TimeWindow > tws;
88  for (auto time_window : time_windows) {
89  tws.push_back(get_vroom_time_window(time_window));
90  }
91  if (tws.size()) {
92  return tws;
93  } else {
94  return std::vector<vroom::TimeWindow>(1, vroom::TimeWindow());
95  }
96  }
98 
99 
103 
112  get_vroom_amounts(const std::vector <Amount> &amounts) const {
113  vroom::Amount amt;
114  if (amounts.size()) {
115  for (auto amount : amounts) {
116  amt.push_back(amount);
117  }
118  } else {
119  const unsigned int amount_size =
120  m_vehicles.size() ? static_cast<unsigned int>(m_vehicles[0].capacity.size()) : 0;
121  // Default to zero amount with provided size.
122  amt = vroom::Amount(amount_size);
123  for (size_t i = 0; i < amounts.size(); i++) {
124  amt[i] = amounts[i];
125  }
126  }
127  return amt;
128  }
129 
131  get_vroom_amounts(const Amount *amounts, size_t count) const {
132  return get_vroom_amounts(std::vector <Amount>(amounts, amounts + count));
133  }
135 
136 
140 
149  vroom::Skills
150  get_vroom_skills(const Skill *skills, size_t count) const {
151  return std::unordered_set <Skill>(skills, skills + count);
152  }
154 
155 
159 
168  vroom::Job
170  const std::vector<Vroom_time_window_t> &job_tws) const {
171  vroom::Amount delivery =
173  vroom::Amount pickup =
175  vroom::Skills skills =
177  std::vector<vroom::TimeWindow> time_windows =
178  get_vroom_time_windows(job_tws);
179  vroom::Index location_id =
180  static_cast<vroom::Index>(m_matrix.get_index(job.location_id));
181  return vroom::Job(job.id, location_id, job.setup, job.service, delivery, pickup,
182  skills, job.priority, time_windows, job.data);
183  }
184 
185  void problem_add_job(const Vroom_job_t &job,
186  const std::vector<Vroom_time_window_t> &job_tws) {
187  m_jobs.push_back(get_vroom_job(job, job_tws));
188  }
189 
190  void add_jobs(const std::vector<Vroom_job_t> &jobs,
191  const std::vector<Vroom_time_window_t> &jobs_tws) {
192  std::map<Idx, std::vector<Vroom_time_window_t>> job_tws_map;
193  for (auto job_tw : jobs_tws) {
194  Idx id = job_tw.id;
195  if (job_tws_map.find(id) == job_tws_map.end()) {
196  job_tws_map[id] = std::vector<Vroom_time_window_t>();
197  }
198  job_tws_map[id].push_back(job_tw);
199  }
200  for (auto job : jobs) {
201  problem_add_job(job, job_tws_map[job.id]);
202  }
203  }
204 
205  void add_jobs(const Vroom_job_t *jobs, size_t count,
206  const Vroom_time_window_t *jobs_tws, size_t total_jobs_tws) {
207  add_jobs(
208  std::vector<Vroom_job_t>(jobs, jobs + count),
209  std::vector<Vroom_time_window_t>(jobs_tws, jobs_tws + total_jobs_tws));
210  }
212 
213 
217 
227  std::pair<vroom::Job, vroom::Job> get_vroom_shipment(
228  const Vroom_shipment_t &shipment,
229  const std::vector<Vroom_time_window_t> &pickup_tws,
230  const std::vector<Vroom_time_window_t> &delivery_tws) const {
231  vroom::Amount amount =
232  get_vroom_amounts(shipment.amount, shipment.amount_size);
233  vroom::Skills skills =
234  get_vroom_skills(shipment.skills, shipment.skills_size);
235  std::vector<vroom::TimeWindow> p_time_windows =
236  get_vroom_time_windows(pickup_tws);
237  std::vector<vroom::TimeWindow> d_time_windows =
238  get_vroom_time_windows(delivery_tws);
239  vroom::Index p_location_id = static_cast<vroom::Index>(
240  m_matrix.get_index(shipment.p_location_id));
241  vroom::Index d_location_id = static_cast<vroom::Index>(
242  m_matrix.get_index(shipment.d_location_id));
243  vroom::Job pickup = vroom::Job(
244  shipment.id, vroom::JOB_TYPE::PICKUP, p_location_id,
245  shipment.p_setup, shipment.p_service, amount,
246  skills, shipment.priority, p_time_windows, shipment.p_data);
247  vroom::Job delivery = vroom::Job(
248  shipment.id, vroom::JOB_TYPE::DELIVERY, d_location_id,
249  shipment.d_setup, shipment.d_service, amount,
250  skills, shipment.priority, d_time_windows, shipment.d_data);
251  return std::make_pair(pickup, delivery);
252  }
253 
255  const Vroom_shipment_t &shipment,
256  const std::vector<Vroom_time_window_t> &pickup_tws,
257  const std::vector<Vroom_time_window_t> &delivery_tws) {
258  m_shipments.push_back(
259  get_vroom_shipment(shipment, pickup_tws, delivery_tws));
260  }
261 
262  void add_shipments(const std::vector <Vroom_shipment_t> &shipments,
263  const std::vector <Vroom_time_window_t> &shipments_tws) {
264  std::map<Idx, std::vector<Vroom_time_window_t>> pickup_tws_map;
265  std::map<Idx, std::vector<Vroom_time_window_t>> delivery_tws_map;
266  for (auto shipment_tw : shipments_tws) {
267  Idx id = shipment_tw.id;
268  if (shipment_tw.kind == 'p') {
269  if (pickup_tws_map.find(id) == pickup_tws_map.end()) {
270  pickup_tws_map[id] = std::vector<Vroom_time_window_t>();
271  }
272  pickup_tws_map[id].push_back(shipment_tw);
273  } else if (shipment_tw.kind == 'd') {
274  if (delivery_tws_map.find(id) == delivery_tws_map.end()) {
275  delivery_tws_map[id] = std::vector<Vroom_time_window_t>();
276  }
277  delivery_tws_map[id].push_back(shipment_tw);
278  }
279  }
280  for (auto shipment : shipments) {
281  problem_add_shipment(shipment, pickup_tws_map[shipment.id],
282  delivery_tws_map[shipment.id]);
283  }
284  }
285 
286  void add_shipments(const Vroom_shipment_t *shipments, size_t count,
287  const Vroom_time_window_t *shipment_tws, size_t total_shipment_tws) {
289  std::vector<Vroom_shipment_t>(shipments, shipments + count),
290  std::vector<Vroom_time_window_t>(shipment_tws, shipment_tws + total_shipment_tws));
291  }
293 
294 
298 
306  vroom::Break
308  const Vroom_break_t &v_break,
309  const std::vector<Vroom_time_window_t> &break_tws) const {
310  std::vector <vroom::TimeWindow> tws = get_vroom_time_windows(break_tws);
311  return vroom::Break(v_break.id, tws, v_break.service, v_break.data);
312  }
313 
314  std::vector < vroom::Break >
316  const std::vector <Vroom_break_t> &breaks,
317  const std::vector <Vroom_time_window_t> &breaks_tws) const {
318  std::map<Idx, std::vector<Vroom_time_window_t>> breaks_tws_map;
319  for (auto break_tw : breaks_tws) {
320  Idx id = break_tw.id;
321  if (breaks_tws_map.find(id) == breaks_tws_map.end()) {
322  breaks_tws_map[id] = std::vector<Vroom_time_window_t>();
323  }
324  breaks_tws_map[id].push_back(break_tw);
325  }
326  std::vector < vroom::Break > v_breaks;
327  for (auto v_break : breaks) {
328  v_breaks.push_back(get_vroom_break(v_break, breaks_tws_map[v_break.id]));
329  }
330  return v_breaks;
331  }
333 
334 
338 
347  vroom::Vehicle get_vroom_vehicle(
348  const Vroom_vehicle_t &vehicle,
349  const std::vector<Vroom_break_t> &breaks,
350  const std::vector<Vroom_time_window_t> &breaks_tws) const {
351  vroom::Amount capacity =
352  get_vroom_amounts(vehicle.capacity, vehicle.capacity_size);
353  vroom::Skills skills =
354  get_vroom_skills(vehicle.skills, vehicle.skills_size);
355  vroom::TimeWindow time_window =
357  vehicle.tw_close);
358  std::vector<vroom::Break> v_breaks = get_vroom_breaks(breaks, breaks_tws);
359 
360  std::optional<vroom::Location> start_id;
361  std::optional<vroom::Location> end_id;
362  // Set the value of start or end index only if they are present
363  if (vehicle.start_id != -1) {
364  start_id = static_cast<vroom::Index>(m_matrix.get_index(vehicle.start_id));
365  }
366  if (vehicle.end_id != -1) {
367  end_id = static_cast<vroom::Index>(m_matrix.get_index(vehicle.end_id));
368  }
369  return vroom::Vehicle(vehicle.id, start_id, end_id,
370  vroom::DEFAULT_PROFILE, capacity, skills, time_window,
371  v_breaks, vehicle.data, vehicle.speed_factor,
372  static_cast<size_t>(vehicle.max_tasks));
373  }
374 
376  const Vroom_vehicle_t &vehicle,
377  const std::vector<Vroom_break_t> &breaks,
378  const std::vector<Vroom_time_window_t> &breaks_tws) {
379  m_vehicles.push_back(get_vroom_vehicle(vehicle, breaks, breaks_tws));
380  }
381 
382  void add_vehicles(const std::vector<Vroom_vehicle_t> &vehicles,
383  const std::vector<Vroom_break_t> &breaks,
384  const std::vector<Vroom_time_window_t> &breaks_tws) {
385  std::map<Idx, std::vector<Vroom_time_window_t>> breaks_tws_map;
386  for (auto break_tw : breaks_tws) {
387  Idx id = break_tw.id;
388  if (breaks_tws_map.find(id) == breaks_tws_map.end()) {
389  breaks_tws_map[id] = std::vector<Vroom_time_window_t>();
390  }
391  breaks_tws_map[id].push_back(break_tw);
392  }
393 
394  std::map<Idx, std::vector<Vroom_break_t>> v_breaks_map;
395  for (auto v_break : breaks) {
396  Idx v_id = v_break.vehicle_id;
397  if (v_breaks_map.find(v_id) == v_breaks_map.end()) {
398  v_breaks_map[v_id] = std::vector<Vroom_break_t>();
399  }
400  v_breaks_map[v_id].push_back(v_break);
401  }
402 
403  for (auto vehicle : vehicles) {
404  std::vector<Vroom_break_t> v_breaks = v_breaks_map[vehicle.id];
405  std::vector<Vroom_time_window_t> v_breaks_tws;
406  for (auto v_break : v_breaks) {
407  std::vector<Vroom_time_window_t> tws = breaks_tws_map[v_break.id];
408  v_breaks_tws.insert(v_breaks_tws.end(), tws.begin(), tws.end());
409  }
410  problem_add_vehicle(vehicle, v_breaks, v_breaks_tws);
411  }
412  }
413 
414  void add_vehicles(const Vroom_vehicle_t *vehicles, size_t count,
415  const Vroom_break_t *breaks, size_t total_breaks,
416  const Vroom_time_window_t *breaks_tws, size_t total_breaks_tws) {
417  add_vehicles(std::vector<Vroom_vehicle_t>(vehicles, vehicles + count),
418  std::vector<Vroom_break_t>(breaks, breaks + total_breaks),
419  std::vector<Vroom_time_window_t>(breaks_tws, breaks_tws + total_breaks_tws));
420  }
422 
423 
425  m_matrix = matrix;
426  }
427 
428  void get_amount(vroom::Amount vroom_amount, Amount **amount) {
429  size_t amount_size = vroom_amount.size();
430  for (size_t i = 0; i < amount_size; i++) {
431  *((*amount) + i) = vroom_amount[i];
432  }
433  }
434 
435  StepType get_job_step_type(vroom::JOB_TYPE vroom_job_type) {
436  StepType step_type;
437  switch (vroom_job_type) {
438  case vroom::JOB_TYPE::SINGLE:
439  step_type = 2;
440  break;
441  case vroom::JOB_TYPE::PICKUP:
442  step_type = 3;
443  break;
444  case vroom::JOB_TYPE::DELIVERY:
445  step_type = 4;
446  break;
447  }
448  return step_type;
449  }
450 
451  StepType get_step_type(vroom::Step step) {
452  StepType step_type = 0;
453  switch (step.step_type) {
454  case vroom::STEP_TYPE::START:
455  step_type = 1;
456  break;
457  case vroom::STEP_TYPE::END:
458  step_type = 6;
459  break;
460  case vroom::STEP_TYPE::BREAK:
461  step_type = 5;
462  break;
463  case vroom::STEP_TYPE::JOB:
464  step_type = get_job_step_type(step.job_type);
465  break;
466  }
467  return step_type;
468  }
469 
470  std::vector < Vroom_rt > get_results(vroom::Solution solution) {
471  std::vector < Vroom_rt > results;
472  std::vector<vroom::Route> routes = solution.routes;
473  Idx vehicle_seq = 1;
474  char *empty_desc = strdup("{}");
475  for (auto route : routes) {
476  Idx step_seq = 1;
477  Duration prev_duration = 0;
478  char *vehicle_data = strdup(route.description.c_str());
479  for (auto step : route.steps) {
480  Idx task_id = step.id;
481  MatrixIndex location_id = m_matrix.get_original_id(step.location.index());
482  char *task_data = strdup(step.description.c_str());
483  StepType step_type = get_step_type(step);
484  if (step_type == 1 || step_type == 6) {
485  task_id = static_cast<Idx>(-1);
486  task_data = empty_desc;
487  }
488 
489  size_t load_size = step.load.size();
490  Amount *load = reinterpret_cast<Amount*>(malloc(load_size * sizeof(Amount)));
491  get_amount(step.load, &load);
492 
493  Duration travel_time = step.duration - prev_duration;
494  prev_duration = step.duration;
495  Duration departure = step.arrival + step.setup + step.service + step.waiting_time;
496  results.push_back({
497  vehicle_seq, // vehicles_seq
498  route.vehicle, // vehicles_id
499  vehicle_data, // vehicle_data
500  step_seq, // step_seq
501  step_type, // step_type
502  task_id, // task_id
503  location_id, // location_id
504  task_data, // task_data
505  step.arrival, // arrival
506  travel_time, // travel_time
507  step.setup, // setup_time
508  step.service, // service_time
509  step.waiting_time, // waiting_time
510  departure, // departure
511  load, // load
512  load_size // load size
513  });
514  step_seq++;
515  }
516  // The summary of this route
517  Idx task_id = 0;
518  results.push_back({
519  vehicle_seq, // vehicles_seq
520  route.vehicle, // vehicles_id
521  vehicle_data, // vehicle_data
522  0, // step_seq = 0 for route summary
523  0, // step_type = 0 for route summary
524  task_id, // task_id = 0 for route summary
525  0, // location_id = 0 for route summary
526  empty_desc, // task_data
527  0, // No arrival time
528  route.duration, // Total travel time
529  route.setup, // Total setup time
530  route.service, // Total service time
531  route.waiting_time, // Total waiting time
532  0, // No departure time
533  {}, // load
534  0 // load size
535  });
536  vehicle_seq++;
537  }
538 
539  std::vector<vroom::Job> unassigned = solution.unassigned;
540  Idx step_seq = 1;
541  for (auto job : unassigned) {
542  StepType job_step = get_job_step_type(job.type);
543  Idx vehicle_id = static_cast<Idx>(-1);
544  Idx job_id = job.id;
545  MatrixIndex location_id = m_matrix.get_original_id(job.location.index());
546  char *task_data = strdup(job.description.c_str());
547  results.push_back({
548  vehicle_seq, // vehicles_seq
549  vehicle_id, // vehicles_id = -1 for unassigned jobs
550  empty_desc, // vehicle_data
551  step_seq, // step_seq
552  job_step, // step_type
553  job_id, // task_id
554  location_id, // location_id
555  task_data, // task_data
556  0, // No arrival time
557  0, // No travel_time
558  0, // No setup_time
559  0, // No service_time
560  0, // No waiting_time
561  0, // No departure time
562  {}, // load
563  0 // load size
564  });
565  step_seq++;
566  }
567 
568  // The summary of the entire problem
569  vroom::Summary summary = solution.summary;
570  Idx vehicle_id = 0;
571  Idx job_id = 0;
572  results.push_back({
573  0, // vehicles_seq = 0 for problem summary
574  vehicle_id, // vehicles_id = 0 for problem summary
575  empty_desc, // vehicle_data
576  0, // step_seq = 0 for problem summary
577  0, // step_type = 0 for problem summary
578  job_id, // task_id = 0 for problem summary
579  0, // location_id = 0 for problem summary
580  empty_desc, // task_data
581  0, // No arrival time
582  summary.duration, // Total travel time
583  summary.setup, // Total setup time
584  summary.service, // Total service time
585  summary.waiting_time, // Total waiting time
586  0, // No departure time
587  {}, // load
588  0 // load size
589  });
590  return results;
591  }
592 
593  std::vector<Vroom_rt> solve(int32_t exploration_level, int32_t timeout,
594  int32_t loading_time) {
595  std::vector <Vroom_rt> results;
596 
597  /* abort in case an interruption occurs (e.g. the query is being cancelled) */
599  try {
600  const unsigned int amount_size =
601  m_vehicles.size()
602  ? static_cast<unsigned int>(m_vehicles[0].capacity.size())
603  : 0;
604  vroom::Input problem_instance(amount_size);
605 
606  for (const auto &vehicle : m_vehicles) {
607  problem_instance.add_vehicle(vehicle);
608  }
609  for (const auto &job : m_jobs) {
610  problem_instance.add_job(job);
611  }
612  for (const auto &shipment : m_shipments) {
613  problem_instance.add_shipment(shipment.first, shipment.second);
614  }
615  vroom::Matrix<vroom::Duration> duration_matrix = m_matrix.get_vroom_duration_matrix();
616  vroom::Matrix<vroom::Cost> cost_matrix = m_matrix.get_vroom_cost_matrix();
617  problem_instance.set_durations_matrix(vroom::DEFAULT_PROFILE, std::move(duration_matrix));
618  problem_instance.set_costs_matrix(vroom::DEFAULT_PROFILE, std::move(cost_matrix));
619 
620  unsigned threads = 4;
621  if (timeout < 0) {
622  auto solution = problem_instance.solve(
623  static_cast<unsigned>(exploration_level), threads);
624  results = get_results(solution);
625  } else {
626  int timeout_ms = (loading_time <= timeout * 1000) ? (timeout * 1000 - loading_time) : 0;
627  auto solution = problem_instance.solve(
628  static_cast<unsigned>(exploration_level), threads, timeout_ms);
629  results = get_results(solution);
630  }
631  } catch (const vroom::Exception &ex) {
632  throw;
633  } catch (const std::exception &ex) {
634  throw;
635  } catch (...) {
636  throw;
637  }
638  return results;
639  }
640 
641  private:
642  std::vector<vroom::Job> m_jobs;
643  std::vector<std::pair<vroom::Job, vroom::Job>> m_shipments;
644  std::vector<vroom::Vehicle> m_vehicles;
646 };
647 
648 } // namespace vrprouting
649 
650 #endif // INCLUDE_CPP_COMMON_VRP_VROOM_PROBLEM_HPP_
interruption.h
vrprouting::base::Base_Matrix::get_original_id
Id get_original_id(Idx) const
original id -> idx
Definition: base_matrix.cpp:202
vrprouting::Vrp_vroom_problem::m_matrix
vrprouting::base::Base_Matrix m_matrix
Definition: vrp_vroom_problem.hpp:645
vrprouting::Vrp_vroom_problem::m_vehicles
std::vector< vroom::Vehicle > m_vehicles
Definition: vrp_vroom_problem.hpp:644
Vroom_shipment_t::priority
Priority priority
Number of skills.
Definition: vroom_shipment_t.h:75
Vroom_shipment_t::p_service
Duration p_service
Pickup setup time.
Definition: vroom_shipment_t.h:62
vrprouting::Vrp_vroom_problem::get_results
std::vector< Vroom_rt > get_results(vroom::Solution solution)
Definition: vrp_vroom_problem.hpp:470
Vroom_vehicle_t::end_id
MatrixIndex end_id
Start location index in matrix.
Definition: vroom_vehicle_t.h:57
Vroom_job_t::pickup_size
size_t pickup_size
Quantities for pickup.
Definition: vroom_job_t.h:65
Vroom_shipment_t::d_setup
Duration d_setup
Delivery location index in matrix.
Definition: vroom_shipment_t.h:66
vrprouting::Vrp_vroom_problem::matrix
vrprouting::base::Base_Matrix matrix() const
Definition: vrp_vroom_problem.hpp:59
Vroom_shipment_t::amount_size
size_t amount_size
Quantities for shipment.
Definition: vroom_shipment_t.h:70
Vroom_vehicle_t::tw_open
Duration tw_open
Number of vehicle's skills.
Definition: vroom_vehicle_t.h:65
vrprouting::base::Base_Matrix::get_index
Idx get_index(Id) const
original id -> idx
Definition: base_matrix.cpp:161
vrprouting::Vrp_vroom_problem::add_vehicles
void add_vehicles(const std::vector< Vroom_vehicle_t > &vehicles, const std::vector< Vroom_break_t > &breaks, const std::vector< Vroom_time_window_t > &breaks_tws)
Definition: vrp_vroom_problem.hpp:382
vrprouting::Vrp_vroom_problem::get_vroom_skills
vroom::Skills get_vroom_skills(const Skill *skills, size_t count) const
Gets the vroom skills.
Definition: vrp_vroom_problem.hpp:150
vrprouting::Vrp_vroom_problem::get_vroom_amounts
vroom::Amount get_vroom_amounts(const Amount *amounts, size_t count) const
Definition: vrp_vroom_problem.hpp:131
pgr_messages.h
vrprouting::Vrp_vroom_problem::vehicles
std::vector< vroom::Vehicle > vehicles() const
Definition: vrp_vroom_problem.hpp:58
vrprouting::Vrp_vroom_problem::get_vroom_break
vroom::Break get_vroom_break(const Vroom_break_t &v_break, const std::vector< Vroom_time_window_t > &break_tws) const
Gets the vehicle breaks from C-style breaks struct.
Definition: vrp_vroom_problem.hpp:307
vrprouting::Vrp_vroom_problem
Definition: vrp_vroom_problem.hpp:54
vroom_vehicle_t.h
vrprouting::Vrp_vroom_problem::get_vroom_shipment
std::pair< vroom::Job, vroom::Job > get_vroom_shipment(const Vroom_shipment_t &shipment, const std::vector< Vroom_time_window_t > &pickup_tws, const std::vector< Vroom_time_window_t > &delivery_tws) const
Gets the vroom shipments.
Definition: vrp_vroom_problem.hpp:227
vrprouting::Vrp_vroom_problem::get_vroom_time_window
vroom::TimeWindow get_vroom_time_window(const Vroom_time_window_t &time_window) const
Gets the vroom time window from the C-style struct.
Definition: vrp_vroom_problem.hpp:73
vrprouting::Vrp_vroom_problem::problem_add_vehicle
void problem_add_vehicle(const Vroom_vehicle_t &vehicle, const std::vector< Vroom_break_t > &breaks, const std::vector< Vroom_time_window_t > &breaks_tws)
Definition: vrp_vroom_problem.hpp:375
Vroom_break_t::id
Idx id
Definition: vroom_break_t.h:47
Vroom_job_t::delivery
Amount * delivery
Job service duration.
Definition: vroom_job_t.h:61
vrprouting::base::Base_Matrix::get_vroom_duration_matrix
vroom::Matrix< vroom::Duration > get_vroom_duration_matrix() const
Get VROOM duration matrix from vrprouting Base Matrix.
Definition: base_matrix.cpp:404
Vroom_vehicle_t::capacity_size
size_t capacity_size
Vehicle's capacity array.
Definition: vroom_vehicle_t.h:60
Vroom_time_window_t
Time window's attributes.
Definition: vroom_time_window_t.h:46
Skill
uint32_t Skill
Definition: typedefs.h:85
Vroom_vehicle_t::speed_factor
double speed_factor
Time window end time.
Definition: vroom_vehicle_t.h:68
Vroom_job_t::priority
Priority priority
Number of mandatory skills.
Definition: vroom_job_t.h:70
vrprouting::Vrp_vroom_problem::add_shipments
void add_shipments(const Vroom_shipment_t *shipments, size_t count, const Vroom_time_window_t *shipment_tws, size_t total_shipment_tws)
Definition: vrp_vroom_problem.hpp:286
Vroom_vehicle_t::skills
Skill * skills
Vehicle's capacity array size.
Definition: vroom_vehicle_t.h:62
Vroom_shipment_t::d_data
char * d_data
Metadata information of pickup shipment.
Definition: vroom_shipment_t.h:78
vrprouting::Vrp_vroom_problem::get_vroom_time_windows
std::vector< vroom::TimeWindow > get_vroom_time_windows(const std::vector< Vroom_time_window_t > &time_windows) const
Definition: vrp_vroom_problem.hpp:85
Vroom_shipment_t::p_location_id
MatrixIndex p_location_id
Shipment identifier.
Definition: vroom_shipment_t.h:60
vrprouting::Vrp_vroom_problem::add_matrix
void add_matrix(vrprouting::base::Base_Matrix matrix)
Definition: vrp_vroom_problem.hpp:424
vrprouting::Vrp_vroom_problem::jobs
std::vector< vroom::Job > jobs() const
Definition: vrp_vroom_problem.hpp:56
vrprouting::Vrp_vroom_problem::add_jobs
void add_jobs(const std::vector< Vroom_job_t > &jobs, const std::vector< Vroom_time_window_t > &jobs_tws)
Definition: vrp_vroom_problem.hpp:190
Vroom_break_t::service
Duration service
Identifier of vehicle.
Definition: vroom_break_t.h:49
vroom_break_t.h
Vroom_shipment_t::skills
Skill * skills
Number of quantities.
Definition: vroom_shipment_t.h:72
Vroom_vehicle_t::max_tasks
int32_t max_tasks
Vehicle travel time multiplier.
Definition: vroom_vehicle_t.h:70
Vroom_shipment_t
Vehicles's attributes.
Definition: vroom_shipment_t.h:56
vroom_job_t.h
vrprouting::Vrp_vroom_problem::get_vroom_amounts
vroom::Amount get_vroom_amounts(const std::vector< Amount > &amounts) const
Gets the vroom amounts from C-style array.
Definition: vrp_vroom_problem.hpp:112
Vroom_break_t::data
char * data
Duration of break.
Definition: vroom_break_t.h:50
vrprouting::Vrp_vroom_problem::get_vroom_job
vroom::Job get_vroom_job(const Vroom_job_t &job, const std::vector< Vroom_time_window_t > &job_tws) const
Gets the vroom jobs.
Definition: vrp_vroom_problem.hpp:169
Vroom_shipment_t::d_service
Duration d_service
Delivery setup time.
Definition: vroom_shipment_t.h:67
Vroom_job_t::service
Duration service
Job setup duration.
Definition: vroom_job_t.h:59
vroom_rt.h
Vroom_shipment_t::p_setup
Duration p_setup
Pickup location index in matrix.
Definition: vroom_shipment_t.h:61
Vroom_job_t::skills
Skill * skills
Number of pickup quantities.
Definition: vroom_job_t.h:67
Vroom_job_t::location_id
MatrixIndex location_id
The job's identifier.
Definition: vroom_job_t.h:56
vrprouting::Vrp_vroom_problem::get_vroom_breaks
std::vector< vroom::Break > get_vroom_breaks(const std::vector< Vroom_break_t > &breaks, const std::vector< Vroom_time_window_t > &breaks_tws) const
Definition: vrp_vroom_problem.hpp:315
Vroom_time_window_t::tw_close
Duration tw_close
Definition: vroom_time_window_t.h:50
Vroom_break_t
Vehicle's break attributes.
Definition: vroom_break_t.h:46
Vroom_job_t::pickup
Amount * pickup
Number of delivery quantities.
Definition: vroom_job_t.h:64
vrprouting::Vrp_vroom_problem::get_vroom_vehicle
vroom::Vehicle get_vroom_vehicle(const Vroom_vehicle_t &vehicle, const std::vector< Vroom_break_t > &breaks, const std::vector< Vroom_time_window_t > &breaks_tws) const
Gets the vroom vehicles.
Definition: vrp_vroom_problem.hpp:347
Vroom_shipment_t::p_data
char * p_data
Priority level of shipment.
Definition: vroom_shipment_t.h:77
Vroom_job_t::setup
Duration setup
Location index of job in matrix.
Definition: vroom_job_t.h:58
Vroom_job_t
Job's attributes.
Definition: vroom_job_t.h:54
vrprouting::Vrp_vroom_problem::solve
std::vector< Vroom_rt > solve(int32_t exploration_level, int32_t timeout, int32_t loading_time)
Definition: vrp_vroom_problem.hpp:593
Vroom_time_window_t::tw_open
Duration tw_open
Definition: vroom_time_window_t.h:49
Amount
int64_t Amount
Definition: typedefs.h:74
Vroom_job_t::data
char * data
Priority level of job.
Definition: vroom_job_t.h:72
vrprouting::Vrp_vroom_problem::add_vehicles
void add_vehicles(const Vroom_vehicle_t *vehicles, size_t count, const Vroom_break_t *breaks, size_t total_breaks, const Vroom_time_window_t *breaks_tws, size_t total_breaks_tws)
Definition: vrp_vroom_problem.hpp:414
Idx
uint64_t Idx
Definition: typedefs.h:79
vroom_time_window_t.h
vrprouting::Vrp_vroom_problem::get_amount
void get_amount(vroom::Amount vroom_amount, Amount **amount)
Definition: vrp_vroom_problem.hpp:428
vrprouting::Vrp_vroom_problem::problem_add_job
void problem_add_job(const Vroom_job_t &job, const std::vector< Vroom_time_window_t > &job_tws)
Definition: vrp_vroom_problem.hpp:185
vrprouting::Vrp_vroom_problem::add_shipments
void add_shipments(const std::vector< Vroom_shipment_t > &shipments, const std::vector< Vroom_time_window_t > &shipments_tws)
Definition: vrp_vroom_problem.hpp:262
MatrixIndex
int64_t MatrixIndex
Definition: typedefs.h:80
Vroom_shipment_t::amount
Amount * amount
Delivery service time.
Definition: vroom_shipment_t.h:69
CHECK_FOR_INTERRUPTS
#define CHECK_FOR_INTERRUPTS()
Definition: interruption.h:79
vrprouting::Vrp_vroom_problem::add_jobs
void add_jobs(const Vroom_job_t *jobs, size_t count, const Vroom_time_window_t *jobs_tws, size_t total_jobs_tws)
Definition: vrp_vroom_problem.hpp:205
Duration
uint32_t Duration
Definition: typedefs.h:81
Vroom_vehicle_t::data
char * data
Max number of tasks in a route for the vehicle.
Definition: vroom_vehicle_t.h:72
Vroom_shipment_t::skills_size
size_t skills_size
Mandatory skills.
Definition: vroom_shipment_t.h:73
Vroom_vehicle_t::id
Idx id
Definition: vroom_vehicle_t.h:55
vrprouting::Pgr_messages
Messages Handling.
Definition: pgr_messages.h:52
vrprouting::Vrp_vroom_problem::get_step_type
StepType get_step_type(vroom::Step step)
Definition: vrp_vroom_problem.hpp:451
Vroom_shipment_t::d_location_id
MatrixIndex d_location_id
Pickup service time.
Definition: vroom_shipment_t.h:65
vrprouting::Vrp_vroom_problem::shipments
std::vector< std::pair< vroom::Job, vroom::Job > > shipments() const
Definition: vrp_vroom_problem.hpp:57
Vroom_vehicle_t::tw_close
Duration tw_close
Time window start time.
Definition: vroom_vehicle_t.h:66
Vroom_vehicle_t::skills_size
size_t skills_size
Vehicle's skills.
Definition: vroom_vehicle_t.h:63
vrprouting::base::Base_Matrix
N x N matrix.
Definition: base_matrix.h:61
vrprouting::Vrp_vroom_problem::get_vroom_time_window
vroom::TimeWindow get_vroom_time_window(Duration tw_open, Duration tw_close) const
Definition: vrp_vroom_problem.hpp:80
vrprouting::Vrp_vroom_problem::m_shipments
std::vector< std::pair< vroom::Job, vroom::Job > > m_shipments
Definition: vrp_vroom_problem.hpp:643
Vroom_vehicle_t
Vehicles's attributes.
Definition: vroom_vehicle_t.h:54
Vroom_shipment_t::id
Idx id
Definition: vroom_shipment_t.h:57
Vroom_vehicle_t::start_id
MatrixIndex start_id
The vehicle's identifier.
Definition: vroom_vehicle_t.h:56
base_matrix.h
Vroom_vehicle_t::capacity
Amount * capacity
End location index in matrix.
Definition: vroom_vehicle_t.h:59
vrprouting::Vrp_vroom_problem::get_job_step_type
StepType get_job_step_type(vroom::JOB_TYPE vroom_job_type)
Definition: vrp_vroom_problem.hpp:435
Vroom_job_t::delivery_size
size_t delivery_size
Quantities for delivery.
Definition: vroom_job_t.h:62
vrprouting::Vrp_vroom_problem::problem_add_shipment
void problem_add_shipment(const Vroom_shipment_t &shipment, const std::vector< Vroom_time_window_t > &pickup_tws, const std::vector< Vroom_time_window_t > &delivery_tws)
Definition: vrp_vroom_problem.hpp:254
vrprouting::base::Base_Matrix::get_vroom_cost_matrix
vroom::Matrix< vroom::Cost > get_vroom_cost_matrix() const
Get VROOM cost matrix from vrprouting Base Matrix.
Definition: base_matrix.cpp:421
StepType
int32_t StepType
Definition: typedefs.h:86
vroom_shipment_t.h
Vroom_job_t::skills_size
size_t skills_size
Mandatory skills.
Definition: vroom_job_t.h:68
matrix_cell_t.h
Vroom_job_t::id
Idx id
Definition: vroom_job_t.h:55
vrprouting::Vrp_vroom_problem::m_jobs
std::vector< vroom::Job > m_jobs
Definition: vrp_vroom_problem.hpp:642
vrprouting
Definition: base_matrix.cpp:46