![]() |
vrpRouting
0.3
|
N x N matrix. More...
#include "base_matrix.h"
Public Member Functions | |
Base_Matrix ()=default | |
Constructs an emtpy matrix. More... | |
Base_Matrix (const std::map< std::pair< Coordinate, Coordinate >, Id > &, Multiplier) | |
Base_Matrix (Matrix_cell_t *, size_t, const Identifiers< Id > &, Multiplier) | |
Constructs a matrix for only specific identifiers. More... | |
Base_Matrix (Vroom_matrix_t *, size_t, const Identifiers< Id > &, double) | |
Constructor for VROOM matrix input. More... | |
TInterval | at (Idx i, Idx j) const |
Idx | get_index (Id) const |
original id -> idx More... | |
Id | get_original_id (Idx) const |
original id -> idx More... | |
bool | has_id (Id) const |
has identifier More... | |
Private Member Functions | |
void | set_ids (const std::vector< Matrix_cell_t > &) |
Traverses the matrix information to set the ids of the nodes. More... | |
Private Attributes | |
std::vector< std::vector< TravelCost > > | m_cost_matrix |
the cost matrix for vroom More... | |
std::vector< Id > | m_ids |
DATA. More... | |
std::vector< std::vector< TInterval > > | m_time_matrix |
the actual time matrix More... | |
Friends | |
std::ostream & | operator<< (std::ostream &log, const Base_Matrix &matrix) |
print matrix (row per cell) More... | |
N x N matrix.
Definition at line 61 of file base_matrix.h.
|
default |
Constructs an emtpy matrix.
vrprouting::base::Base_Matrix::Base_Matrix | ( | Matrix_cell_t * | data_costs, |
size_t | size_matrix, | ||
const Identifiers< Id > & | node_ids, | ||
Multiplier | multiplier | ||
) |
Constructs a matrix for only specific identifiers.
[in] | data_costs | The set of costs |
[in] | size_matrix | The size of the set of costs |
[in] | node_ids | The selected node identifiers to be added |
[in] | multiplier | All times are multiplied by this value |
Definition at line 235 of file base_matrix.cpp.
References Identifiers< T >::begin(), Identifiers< T >::end(), get_index(), has_id(), m_ids, and m_time_matrix.
vrprouting::base::Base_Matrix::Base_Matrix | ( | Vroom_matrix_t * | matrix_rows, |
size_t | total_matrix_rows, | ||
const Identifiers< Id > & | location_ids, | ||
double | scaling_factor | ||
) |
Constructor for VROOM matrix input.
[in] | data_costs | The set of costs |
[in] | size_matrix | The size of the set of costs |
[in] | location_ids | The location identifiers |
Definition at line 305 of file base_matrix.cpp.
References Identifiers< T >::begin(), Identifiers< T >::end(), get_index(), has_id(), m_cost_matrix, m_ids, and m_time_matrix.
|
explicit |
Definition at line 372 of file base_matrix.cpp.
References vrprouting::base::detail::get_distance(), get_index(), m_ids, and m_time_matrix.
Definition at line 97 of file base_matrix.h.
References m_time_matrix.
Referenced by vrprouting::problem::Matrix::travel_time().
|
inline |
size_t vrprouting::base::Base_Matrix::fix_triangle_inequality | ( | size_t | depth = 0 | ) |
Fix Triangle Inequality Theorem.
The sum of the lengths of any two sides of a triangle is greater than the length of the third side. NOTE: can also be equal for streets costs[i][k] != inf costs[i][k] <= costs[i][j] + costs[j][k]
Definition at line 508 of file base_matrix.cpp.
References m_time_matrix.
Referenced by do_compatibleVehicles(), do_optimize(), and do_pickDeliver().
original id -> idx
Given an original node identifier returns the internal index.
[in] | id |
Definition at line 161 of file base_matrix.cpp.
References m_ids, pgassert, and pgassertwm.
Referenced by Base_Matrix(), vrprouting::Vrp_vroom_problem::get_vroom_job(), vrprouting::Vrp_vroom_problem::get_vroom_shipment(), vrprouting::Vrp_vroom_problem::get_vroom_vehicle(), and vrprouting::problem::Matrix::travel_time().
original id -> idx
Given the internal index, returns the original node identifier.
[in] | id |
Definition at line 202 of file base_matrix.cpp.
References m_ids, pgassert, and pgassertwm.
Referenced by vrprouting::Vrp_vroom_problem::get_results().
vroom::Matrix< vroom::Cost > vrprouting::base::Base_Matrix::get_vroom_cost_matrix | ( | ) | const |
Get VROOM cost matrix from vrprouting Base Matrix.
Definition at line 421 of file base_matrix.cpp.
References m_cost_matrix, and m_ids.
Referenced by vrprouting::Vrp_vroom_problem::solve().
vroom::Matrix< vroom::Duration > vrprouting::base::Base_Matrix::get_vroom_duration_matrix | ( | ) | const |
Get VROOM duration matrix from vrprouting Base Matrix.
Definition at line 404 of file base_matrix.cpp.
References m_ids, and m_time_matrix.
Referenced by vrprouting::Vrp_vroom_problem::solve().
bool vrprouting::base::Base_Matrix::has_id | ( | Id | id | ) | const |
has identifier
[in] | id | original identifier |
Definition at line 126 of file base_matrix.cpp.
References m_ids.
Referenced by Base_Matrix(), and vrprouting::problem::Matrix::travel_time().
bool vrprouting::base::Base_Matrix::has_no_infinity | ( | ) | const |
does the matrix values not given by the user?
Definition at line 459 of file base_matrix.cpp.
References m_time_matrix.
Referenced by do_compatibleVehicles(), do_optimize(), do_pgr_pickDeliver(), do_pickDeliver(), and do_vrp_vroom().
bool vrprouting::base::Base_Matrix::is_symmetric | ( | ) | const |
is the matrix symetric?
Definition at line 524 of file base_matrix.cpp.
References m_time_matrix, and pgassertwm.
bool vrprouting::base::Base_Matrix::obeys_triangle_inequality | ( | ) | const |
does the matrix obeys the triangle inequality?
Triangle Inequality Theorem.
The sum of the lengths of any two sides of a triangle is greater than the length of the third side. NOTE: can also be equal for streets m_time_matrix[i][k] != inf m_time_matrix[i][k] <= m_time_matrix[i][j] + m_time_matrix[j][k]
Definition at line 487 of file base_matrix.cpp.
References m_time_matrix.
Referenced by do_compatibleVehicles(), do_optimize(), and do_pickDeliver().
|
private |
Traverses the matrix information to set the ids of the nodes.
Traverses the matrix information to get the ids of the nodes.
[in] | data | Base_Matrix information |
Definition at line 85 of file base_matrix.cpp.
References Identifiers< T >::begin(), Identifiers< T >::end(), m_ids, and pgassert.
|
inline |
|idx|
Definition at line 90 of file base_matrix.h.
References m_ids.
Referenced by do_vrp_vroom().
|
friend |
print matrix (row per cell)
[in,out] | log | stream variable where to print |
[in] | matrix | The matrix |
Definition at line 567 of file base_matrix.cpp.
|
private |
the cost matrix for vroom
m_cost_matrix[i][j] i and j are index from the ids
Definition at line 132 of file base_matrix.h.
Referenced by Base_Matrix(), and get_vroom_cost_matrix().
|
private |
DATA.
ordered list of user identifiers
Definition at line 120 of file base_matrix.h.
Referenced by Base_Matrix(), empty(), get_index(), get_original_id(), get_vroom_cost_matrix(), get_vroom_duration_matrix(), has_id(), vrprouting::base::operator<<(), set_ids(), and size().
|
private |
the actual time matrix
m_time_matrix[i][j] i and j are index from the ids
Definition at line 126 of file base_matrix.h.
Referenced by at(), Base_Matrix(), fix_triangle_inequality(), get_vroom_duration_matrix(), has_no_infinity(), is_symmetric(), obeys_triangle_inequality(), and vrprouting::base::operator<<().