![]() |
vrpRouting
0.3
|
#include "matrix.h"
Public Member Functions | |
Matrix ()=default | |
Matrix (const std::map< std::pair< Coordinate, Coordinate >, Id > &, Multiplier=1.0) | |
brief constructor for euclidean version default multipliers More... | |
Matrix (const std::map< std::pair< Coordinate, Coordinate >, Id > &, Time_multipliers_t *, size_t, Multiplier=1.0) | |
brief constructor for euclidean version with time dependant multipliers More... | |
Matrix (Matrix_cell_t *, size_t, const Identifiers< Id > &, Multiplier=1.0) | |
brief constructor for matrix version default multipliers More... | |
Matrix (Matrix_cell_t *, size_t, Time_multipliers_t *, size_t, const Identifiers< Id > &, Multiplier=1.0) | |
brief constructor for matrix version with time dependant multipliers 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... | |
std::string | multipliers_str () const |
TInterval | travel_time (Id, Id) const |
retrun the travel time times from the matrix More... | |
TInterval | travel_time (Id, Id, TTimestamp) const |
retrun the travel time times when using the time dependant multipliers More... | |
status of the matrix | |
bool | has_no_infinity () const |
does the matrix values not given by the user? More... | |
vroom::Matrix< vroom::Duration > | get_vroom_duration_matrix () const |
Get VROOM duration matrix from vrprouting Base Matrix. More... | |
vroom::Matrix< vroom::Cost > | get_vroom_cost_matrix () const |
Get VROOM cost matrix from vrprouting Base Matrix. More... | |
bool | obeys_triangle_inequality () const |
does the matrix obeys the triangle inequality? More... | |
size_t | fix_triangle_inequality (size_t depth=0) |
Fix Triangle Inequality Theorem. More... | |
bool | empty () const |
is the matrix empty? More... | |
size_t | size () const |
|idx| More... | |
bool | is_symmetric () const |
is the matrix symetric? More... | |
status of the matrix | |
bool | has_no_infinity () const |
does the matrix values not given by the user? More... | |
vroom::Matrix< vroom::Duration > | get_vroom_duration_matrix () const |
Get VROOM duration matrix from vrprouting Base Matrix. More... | |
vroom::Matrix< vroom::Cost > | get_vroom_cost_matrix () const |
Get VROOM cost matrix from vrprouting Base Matrix. More... | |
bool | obeys_triangle_inequality () const |
does the matrix obeys the triangle inequality? More... | |
size_t | fix_triangle_inequality (size_t depth=0) |
Fix Triangle Inequality Theorem. More... | |
bool | empty () const |
is the matrix empty? More... | |
size_t | size () const |
|idx| More... | |
bool | is_symmetric () const |
is the matrix symetric? 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::tuple< TTimestamp, Multiplier > > | m_multipliers |
time dependant multiplier More... | |
std::vector< std::vector< TInterval > > | m_time_matrix |
the actual time matrix More... | |
|
default |
vrprouting::problem::Matrix::Matrix | ( | Matrix_cell_t * | matrix, |
size_t | size_matrix, | ||
Time_multipliers_t * | multipliers, | ||
size_t | size_multipliers, | ||
const Identifiers< Id > & | node_ids, | ||
Multiplier | multiplier = 1.0 |
||
) |
brief constructor for matrix version with time dependant multipliers
Definition at line 167 of file matrix.cpp.
vrprouting::problem::Matrix::Matrix | ( | const std::map< std::pair< Coordinate, Coordinate >, Id > & | euclidean_data, |
Time_multipliers_t * | multipliers, | ||
size_t | size_multipliers, | ||
Multiplier | multiplier = 1.0 |
||
) |
brief constructor for euclidean version with time dependant multipliers
Definition at line 178 of file matrix.cpp.
vrprouting::problem::Matrix::Matrix | ( | Matrix_cell_t * | matrix, |
size_t | size_matrix, | ||
const Identifiers< Id > & | node_ids, | ||
Multiplier | multiplier = 1.0 |
||
) |
brief constructor for matrix version default multipliers
Definition at line 188 of file matrix.cpp.
|
explicit |
brief constructor for euclidean version default multipliers
Definition at line 198 of file matrix.cpp.
Definition at line 97 of file base_matrix.h.
References vrprouting::base::Base_Matrix::m_time_matrix.
Referenced by travel_time().
|
inlineinherited |
is the matrix empty?
Definition at line 84 of file base_matrix.h.
References vrprouting::base::Base_Matrix::m_ids.
|
inherited |
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 vrprouting::base::Base_Matrix::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 vrprouting::base::Base_Matrix::m_ids, pgassert, and pgassertwm.
Referenced by vrprouting::base::Base_Matrix::Base_Matrix(), vrprouting::Vrp_vroom_problem::get_vroom_job(), vrprouting::Vrp_vroom_problem::get_vroom_shipment(), vrprouting::Vrp_vroom_problem::get_vroom_vehicle(), and 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 vrprouting::base::Base_Matrix::m_ids, pgassert, and pgassertwm.
Referenced by vrprouting::Vrp_vroom_problem::get_results().
|
inherited |
Get VROOM cost matrix from vrprouting Base Matrix.
Definition at line 421 of file base_matrix.cpp.
References vrprouting::base::Base_Matrix::m_cost_matrix, and vrprouting::base::Base_Matrix::m_ids.
Referenced by vrprouting::Vrp_vroom_problem::solve().
|
inherited |
Get VROOM duration matrix from vrprouting Base Matrix.
Definition at line 404 of file base_matrix.cpp.
References vrprouting::base::Base_Matrix::m_ids, and vrprouting::base::Base_Matrix::m_time_matrix.
Referenced by vrprouting::Vrp_vroom_problem::solve().
|
inherited |
has identifier
[in] | id | original identifier |
Definition at line 126 of file base_matrix.cpp.
References vrprouting::base::Base_Matrix::m_ids.
Referenced by vrprouting::base::Base_Matrix::Base_Matrix(), and travel_time().
|
inherited |
does the matrix values not given by the user?
Definition at line 459 of file base_matrix.cpp.
References vrprouting::base::Base_Matrix::m_time_matrix.
Referenced by do_compatibleVehicles(), do_optimize(), do_pgr_pickDeliver(), do_pickDeliver(), and do_vrp_vroom().
|
inherited |
is the matrix symetric?
Definition at line 524 of file base_matrix.cpp.
References vrprouting::base::Base_Matrix::m_time_matrix, and pgassertwm.
std::string vrprouting::problem::Matrix::multipliers_str | ( | ) | const |
|
inherited |
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 vrprouting::base::Base_Matrix::m_time_matrix.
Referenced by do_compatibleVehicles(), do_optimize(), and do_pickDeliver().
|
privateinherited |
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(), vrprouting::base::Base_Matrix::m_ids, and pgassert.
|
inlineinherited |
|idx|
Definition at line 90 of file base_matrix.h.
References vrprouting::base::Base_Matrix::m_ids.
Referenced by do_vrp_vroom().
retrun the travel time times from the matrix
TInterval vrprouting::problem::Matrix::travel_time | ( | Id | i, |
Id | j, | ||
TTimestamp | date_time_of_departure_from_i | ||
) | const |
retrun the travel time times when using the time dependant multipliers
[in] | i,j | original identifiers |
[in] | date_time_of_departure_from_i | time of departure from i |
Definition at line 233 of file matrix.cpp.
References vrprouting::base::Base_Matrix::at(), vrprouting::base::Base_Matrix::get_index(), vrprouting::problem::anonymous_namespace{matrix.cpp}::get_tdm(), vrprouting::base::Base_Matrix::has_id(), m_multipliers, vrprouting::problem::anonymous_namespace{matrix.cpp}::next_tdm(), and vrprouting::problem::anonymous_namespace{matrix.cpp}::time_change().
Referenced by vrprouting::problem::Tw_node::travel_time_to().
|
privateinherited |
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 vrprouting::base::Base_Matrix::Base_Matrix(), and vrprouting::base::Base_Matrix::get_vroom_cost_matrix().
|
privateinherited |
DATA.
ordered list of user identifiers
Definition at line 120 of file base_matrix.h.
Referenced by vrprouting::base::Base_Matrix::Base_Matrix(), vrprouting::base::Base_Matrix::empty(), vrprouting::base::Base_Matrix::get_index(), vrprouting::base::Base_Matrix::get_original_id(), vrprouting::base::Base_Matrix::get_vroom_cost_matrix(), vrprouting::base::Base_Matrix::get_vroom_duration_matrix(), vrprouting::base::Base_Matrix::has_id(), vrprouting::base::operator<<(), vrprouting::base::Base_Matrix::set_ids(), and vrprouting::base::Base_Matrix::size().
|
private |
time dependant multiplier
m_multipliers[i] ith time dependant multiplier double = time when the multipliers starts to be valid double = multiplier The multiplier ends its validity at the time of the (i+1)th value
Definition at line 78 of file matrix.h.
Referenced by multipliers_str(), and travel_time().
|
privateinherited |
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 vrprouting::base::Base_Matrix::at(), vrprouting::base::Base_Matrix::Base_Matrix(), vrprouting::base::Base_Matrix::fix_triangle_inequality(), vrprouting::base::Base_Matrix::get_vroom_duration_matrix(), vrprouting::base::Base_Matrix::has_no_infinity(), vrprouting::base::Base_Matrix::is_symmetric(), vrprouting::base::Base_Matrix::obeys_triangle_inequality(), and vrprouting::base::operator<<().