![]() |
vrpRouting
0.3
|
#include "fleet.h"
Public Member Functions | |
Fleet ()=delete | |
creating a fleet without information is not allowed More... | |
Fleet (const Fleet &fleet)=default | |
Copy constructor. More... | |
Fleet (Vehicle_t *vehicles, size_t size_vehicles, const Orders &p_orders, std::vector< Vehicle_node > &p_nodes, size_t &node_id) | |
Create a fleet based on the Vehicles of the problem. More... | |
Fleet (Vehicle_t *vehicles, size_t size_vehicles, const std::vector< Short_vehicle > &new_stops, const Orders &p_orders, std::vector< Vehicle_node > &p_nodes, size_t &node_id) | |
Create a fleet based on the Vehicles of the problem. More... | |
void | clean () |
removes from fleet all invalid vehicles More... | |
Identifiers< size_t > | feasible_orders () const |
Vehicle_pickDeliver | get_phony () const |
Get a vehicle from the user's defined vehicles. More... | |
Vehicle_pickDeliver | get_truck () |
Finds an unused vehicle. More... | |
Vehicle_pickDeliver | get_truck (size_t order_idx) |
Finds an unused vehicle where the order can fit. More... | |
std::vector< Vehicle_pickDeliver > | get_unused_trucks () |
Get all the unused vehicles. More... | |
std::vector< Vehicle_pickDeliver > | get_used_trucks () |
Get all the used vehicles. More... | |
bool | is_fleet_ok () const |
bool | is_order_ok (const Order &order) const |
Given an order, Cycle trhugh all the trucks to verify if the order can be served by at least one truck. More... | |
Pgr_messages & | msg () |
void | set_compatibles (const Orders &orders) |
sets the compatability of orders on the fleet More... | |
void | set_initial_solution (const Orders &, Identifiers< size_t > &, Identifiers< size_t > &, TTimestamp, bool) |
set the vehicle's user's initial solution More... | |
Protected Member Functions | |
void | add_vehicle (const Vehicle_t &, const std::vector< Short_vehicle > &, const Orders &, std::vector< Vehicle_node > &p_nodes, size_t &node_id) |
add a new vehicle to the fleet More... | |
void | build_fleet (Vehicle_t *, size_t, const std::vector< Short_vehicle > &, const Orders &, std::vector< Vehicle_node > &p_nodes, size_t &node_id) |
build the fleet More... | |
void | invariant () const |
Protected Attributes | |
T | elements |
STL member. More... | |
Identifiers< size_t > | m_invalid |
set of invalid vehicles More... | |
Pgr_messages | m_msg |
size_t | m_size |
Identifiers< size_t > | m_unused |
set of unused vehicles More... | |
Identifiers< size_t > | m_used |
set of used vehicles More... | |
Friends | |
std::ostream & | operator<< (std::ostream &log, const Fleet &f) |
|
inline |
Create a fleet based on the Vehicles of the problem.
Definition at line 61 of file fleet.h.
References build_fleet().
|
inline |
Create a fleet based on the Vehicles of the problem.
Definition at line 70 of file fleet.h.
References build_fleet().
|
delete |
creating a fleet without information is not allowed
|
default |
Copy constructor.
|
protected |
add a new vehicle to the fleet
[in] | vehicle | |
[in] | p_orders | |
[in,out] | p_nodes | |
[in,out] | node_id |
skip illegal values on vehicles information
Set the starting site and ending site
Add the starting site and ending site to the problem's nodes
Add the vehicle
Definition at line 196 of file fleet.cpp.
References Vehicle_t::cant_v, Vehicle_t::capacity, Vehicle_t::end_close_t, Vehicle_t::end_open_t, vrprouting::Pgr_messages::error, vrprouting::Pgr_messages::get_error(), Vehicle_t::id, vrprouting::problem::Tw_node::is_end(), vrprouting::problem::kEnd, vrprouting::problem::kStart, vrprouting::Pgr_messages::log, m_msg, msg(), pgassert, Vehicle_t::speed, Vehicle_t::start_close_t, Vehicle_t::start_open_t, Vehicle_t::stops, and Vehicle_t::stops_size.
|
protected |
build the fleet
builds a fleet from a vector of Vehicle_t
[in] | vehicles | the list of vehicles |
[in] | size_vehicles | size of vehicles |
[in] | p_orders | |
[in,out] | p_nodes | |
[in,out] | node_id |
Sort vehicles: ASC start_open_t, end_close_t, id
Add the vehicles
creating a phony vehicle with max capacity and max window with the start & end points of the first vehicle given
Definition at line 364 of file fleet.cpp.
References Vehicle_t::start_open_t.
Referenced by Fleet().
void vrprouting::problem::Fleet::clean | ( | ) |
removes from fleet all invalid vehicles
Remove the vehicles that have problems with the time windows.
Definition at line 107 of file fleet.cpp.
References invariant(), m_invalid, m_unused, m_used, pgassert, and Identifiers< T >::size().
Referenced by vrprouting::problem::PickDeliver::PickDeliver().
Identifiers< size_t > vrprouting::problem::Fleet::feasible_orders | ( | ) | const |
Definition at line 97 of file fleet.cpp.
References vrprouting::problem::Vehicle_pickDeliver::feasible_orders(), and invariant().
Referenced by get_truck(), and vrprouting::initialsol::tabu::Initial_solution::Initial_solution().
|
inline |
Get a vehicle from the user's defined vehicles.
Definition at line 91 of file fleet.h.
Referenced by vrprouting::initialsol::tabu::Initial_solution::process_unassigned().
Vehicle_pickDeliver vrprouting::problem::Fleet::get_truck | ( | ) |
Finds an unused vehicle.
Definition at line 121 of file fleet.cpp.
References Identifiers< T >::front(), m_unused, and m_used.
Referenced by vrprouting::initialsol::simple::Initial_solution::do_while_foo(), and vrprouting::initialsol::simple::Initial_solution::one_truck_all_orders().
Vehicle_pickDeliver vrprouting::problem::Fleet::get_truck | ( | size_t | order_idx | ) |
Finds an unused vehicle where the order can fit.
Definition at line 132 of file fleet.cpp.
References Identifiers< T >::back(), feasible_orders(), m_unused, m_used, and Identifiers< T >::size().
std::vector< Vehicle_pickDeliver > vrprouting::problem::Fleet::get_unused_trucks | ( | ) |
Get all the unused vehicles.
Definition at line 80 of file fleet.cpp.
References ENTERING, vrprouting::Pgr_messages::get_log(), invariant(), vrprouting::Pgr_messages::log, m_msg, m_unused, and pgassertwm.
Referenced by vrprouting::initialsol::tabu::Initial_solution::Initial_solution().
std::vector< Vehicle_pickDeliver > vrprouting::problem::Fleet::get_used_trucks | ( | ) |
Get all the used vehicles.
Definition at line 64 of file fleet.cpp.
References invariant(), and m_used.
Referenced by vrprouting::initialsol::tabu::Initial_solution::process_given_solution_from_user().
|
protected |
Definition at line 43 of file fleet.cpp.
References vrprouting::Pgr_messages::get_log(), vrprouting::Pgr_messages::log, m_invalid, m_msg, m_size, m_unused, m_used, and pgassertwm.
Referenced by clean(), feasible_orders(), get_unused_trucks(), and get_used_trucks().
bool vrprouting::problem::Fleet::is_fleet_ok | ( | ) | const |
Definition at line 144 of file fleet.cpp.
References ENTERING, vrprouting::Pgr_messages::error, EXITING, vrprouting::Pgr_messages::get_error(), vrprouting::Pgr_messages::log, m_msg, and pgassertwm.
bool vrprouting::problem::Fleet::is_order_ok | ( | const Order & | order | ) | const |
Given an order, Cycle trhugh all the trucks to verify if the order can be served by at least one truck.
Definition at line 179 of file fleet.cpp.
References vrprouting::problem::Order::is_valid().
|
inline |
void vrprouting::problem::Fleet::set_compatibles | ( | const Orders & | orders | ) |
sets the compatability of orders on the fleet
[in] | orders | set of orders to work with |
Cycle the orders
Cycle the vehicles
Set compatibility on the phony vehicle
Definition at line 313 of file fleet.cpp.
References vrprouting::Pgr_messages::log, and m_msg.
Referenced by vrprouting::problem::PickDeliver::PickDeliver().
void vrprouting::problem::Fleet::set_initial_solution | ( | const Orders & | orders, |
Identifiers< size_t > & | assigned, | ||
Identifiers< size_t > & | unassigned, | ||
TTimestamp | execution_date, | ||
bool | optimize | ||
) |
set the vehicle's user's initial solution
[in] | orders | The problem orders |
[in,out] | assigned | The currently assigned orders |
[in,out] | unassigned | The currently unassigned orders |
[in] | execution_date | date reference to mark unmovable orders |
[in] | optimize | c$Flag to prepare for optimization |
Definition at line 296 of file fleet.cpp.
Referenced by vrprouting::initialsol::tabu::Initial_solution::process_given_solution_from_user().
|
friend |
|
inherited |
STL member.
|
protected |
set of invalid vehicles
Definition at line 150 of file fleet.h.
Referenced by clean(), and invariant().
|
mutableprotected |
Definition at line 152 of file fleet.h.
Referenced by add_vehicle(), get_unused_trucks(), invariant(), is_fleet_ok(), msg(), and set_compatibles().
|
protected |
Definition at line 155 of file fleet.h.
Referenced by invariant().
|
protected |
set of unused vehicles
Definition at line 147 of file fleet.h.
Referenced by clean(), get_truck(), get_unused_trucks(), and invariant().
|
protected |
set of used vehicles
Definition at line 144 of file fleet.h.
Referenced by clean(), get_truck(), get_used_trucks(), and invariant().