![]() |
vrpRouting
0.3
|
#include "simple.h"
Public Member Functions | |
Optimize (const problem::Solution &solution, size_t times, const Initials_code &) | |
std::tuple< int, int, size_t, TInterval, TInterval, TInterval > | cost () const |
Get all statistics in one cycle. More... | |
std::string | cost_str () const |
int | cvTot () const |
Total number of capacity constraint violations of the solution. More... | |
void | decrease_truck () |
TInterval | duration () const |
Total duration of the solution. More... | |
const std::deque< Vehicle_pickDeliver > & | fleet () const |
Get the current fleet solution. More... | |
Initials_code | get_kind () const |
std::vector< Solution_rt > | get_postgres_result () const |
get solution like postgres needs it More... | |
std::vector< Short_vehicle > | get_stops () const |
get solution like postgres needs it More... | |
void | inter_swap (size_t times) |
bool | is_feasible () const |
is the solution feasible? More... | |
void | move_duration_based () |
void | move_wait_time_based () |
Pgr_messages & | msg () |
double | objective () const |
Get the value of the objective function. More... | |
bool | operator< (const Solution &) const |
const Orders & | orders () const |
std::string | tau (const std::string &title="Tau") const |
writing the solution in compact form into a string More... | |
TInterval | total_service_time () const |
Total service time of the solution. More... | |
TInterval | total_travel_time () const |
Total travel time of the solution. More... | |
int | twvTot () const |
Total number of time windows constraint violations of the solution. More... | |
Fleet & | vehicles () |
TInterval | wait_time () const |
Total waiting time of the solution. More... | |
Public Attributes | |
Solution | best_solution |
Protected Attributes | |
std::deque< Vehicle_pickDeliver > | m_fleet |
The current solution. More... | |
Pgr_messages | m_msg |
Orders | m_orders |
the problem info More... | |
Fleet | m_trucks |
Private Types | |
using | Initials_code = initialsol::simple::Initials_code |
Private Member Functions | |
bool | decrease_truck (size_t) |
void | delete_empty_truck () |
bool | inter_swap () |
bool | move_order (problem::Order order, problem::Vehicle_pickDeliver &from_truck, problem::Vehicle_pickDeliver &to_truck) |
moves an order to an non empty vehicle More... | |
bool | move_reduce_cost (problem::Vehicle_pickDeliver &from, problem::Vehicle_pickDeliver &to) |
void | save_if_best () |
void | sort_by_duration () |
void | sort_by_id () |
void | sort_by_size () |
void | sort_for_move () |
bool | swap_order () |
bool | swap_order (problem::Order from_order, problem::Vehicle_pickDeliver &from_truck, problem::Order to_order, problem::Vehicle_pickDeliver &to_truck) |
bool | swap_worse (problem::Vehicle_pickDeliver &from, problem::Vehicle_pickDeliver &to) |
Private Attributes | |
Initials_code | m_kind |
Definition at line 40 of file optimizers/simple.h.
|
private |
Definition at line 41 of file optimizers/simple.h.
vrprouting::optimizers::simple::Optimize::Optimize | ( | const problem::Solution & | solution, |
size_t | times, | ||
const Initials_code & | p_kind | ||
) |
Definition at line 42 of file optimizers/simple.cpp.
References best_solution, inter_swap(), vrprouting::Pgr_messages::log, vrprouting::problem::Solution::m_fleet, vrprouting::problem::Solution::msg(), sort_by_size(), and vrprouting::problem::Solution::tau().
Get all statistics in one cycle.
idx | variable |
---|---|
0 | twv |
1 | cv |
2 | fleet size |
3 | waiting time |
4 | duration |
5 | travel time |
Definition at line 218 of file solution.cpp.
References vrprouting::problem::Solution::m_fleet.
Referenced by vrprouting::problem::Solution::cost_str(), and vrprouting::problem::Solution::operator<().
|
inherited |
Definition at line 246 of file solution.cpp.
References vrprouting::problem::Solution::cost().
Referenced by vrprouting::problem::Solution::tau().
|
inherited |
Total number of capacity constraint violations of the solution.
Definition at line 196 of file solution.cpp.
References vrprouting::problem::Vehicle::cvTot(), and vrprouting::problem::Solution::m_fleet.
Referenced by vrprouting::problem::Solution::get_postgres_result().
void vrprouting::optimizers::simple::Optimize::decrease_truck | ( | ) |
Definition at line 534 of file optimizers/simple.cpp.
References delete_empty_truck(), vrprouting::problem::Solution::m_fleet, and save_if_best().
Referenced by inter_swap().
|
private |
Definition at line 548 of file optimizers/simple.cpp.
References vrprouting::problem::Solution::is_feasible(), vrprouting::problem::Solution::m_fleet, vrprouting::problem::Solution::orders(), and pgassert.
|
private |
Definition at line 363 of file optimizers/simple.cpp.
References vrprouting::problem::Solution::m_fleet, and save_if_best().
Referenced by decrease_truck(), and inter_swap().
|
inherited |
Total duration of the solution.
The solution duration is the sum of the durations of all vehicles
Definition at line 140 of file solution.cpp.
References vrprouting::problem::Vehicle::duration(), and vrprouting::problem::Solution::m_fleet.
Referenced by vrprouting::problem::Solution::get_postgres_result(), save_if_best(), and swap_worse().
|
inlineinherited |
Get the current fleet solution.
Definition at line 107 of file solution.h.
References vrprouting::problem::Solution::m_fleet.
Referenced by vrprouting::optimizers::tabu::Optimize::intensify(), and vrprouting::optimizers::tabu::Optimize::Optimize().
|
inline |
Definition at line 56 of file optimizers/simple.h.
References m_kind.
Referenced by move_order(), move_reduce_cost(), swap_order(), and swap_worse().
|
inherited |
get solution like postgres needs it
Definition at line 61 of file solution.cpp.
References vrprouting::problem::Solution::cvTot(), vrprouting::problem::Solution::duration(), vrprouting::problem::Solution::m_fleet, vrprouting::problem::Solution::total_service_time(), vrprouting::problem::Solution::total_travel_time(), vrprouting::problem::Solution::twvTot(), and vrprouting::problem::Solution::wait_time().
|
inherited |
get solution like postgres needs it
Definition at line 49 of file solution.cpp.
References Short_vehicle::id, and vrprouting::problem::Solution::m_fleet.
|
private |
Definition at line 87 of file optimizers/simple.cpp.
References delete_empty_truck(), vrprouting::Pgr_messages::log, vrprouting::problem::Solution::m_fleet, move_reduce_cost(), vrprouting::problem::Solution::msg(), swap_order(), swap_worse(), and vrprouting::problem::Solution::tau().
Referenced by inter_swap(), and Optimize().
void vrprouting::optimizers::simple::Optimize::inter_swap | ( | size_t | times | ) |
Definition at line 59 of file optimizers/simple.cpp.
References decrease_truck(), inter_swap(), vrprouting::Pgr_messages::log, vrprouting::problem::Solution::m_fleet, vrprouting::problem::Solution::msg(), sort_by_size(), and vrprouting::problem::Solution::tau().
|
inherited |
is the solution feasible?
The solution is feasible when all vehicles are feasible.
Definition at line 129 of file solution.cpp.
References vrprouting::problem::Solution::m_fleet.
Referenced by decrease_truck(), vrprouting::initialsol::simple::Initial_solution::do_while_feasible(), vrprouting::initialsol::simple::Initial_solution::do_while_foo(), vrprouting::initialsol::tabu::Initial_solution::Initial_solution(), vrprouting::initialsol::tabu::Initial_solution::process_given_solution_from_user(), and vrprouting::initialsol::tabu::Initial_solution::process_unassigned().
void vrprouting::optimizers::simple::Optimize::move_duration_based | ( | ) |
|
private |
moves an order to an non empty vehicle
order: order to be moved from_truck: here is the order to truck: truck to put the order
to check if the order was inserted: to_truck.has_order(order)
Definition at line 467 of file optimizers/simple.cpp.
References vrprouting::problem::Vehicle_pickDeliver::empty(), vrprouting::problem::Vehicle_pickDeliver::erase(), get_kind(), vrprouting::problem::Vehicle_pickDeliver::has_order(), vrprouting::problem::Vehicle_pickDeliver::hillClimb(), vrprouting::problem::Vehicle::is_phony(), vrprouting::initialsol::simple::OneDepot, pgassert, and vrprouting::problem::Vehicle_pickDeliver::semiLIFO().
Referenced by swap_worse().
|
private |
Definition at line 385 of file optimizers/simple.cpp.
References best_solution, get_kind(), vrprouting::initialsol::simple::OneDepot, vrprouting::problem::Vehicle_pickDeliver::orders_in_vehicle(), pgassert, and save_if_best().
Referenced by inter_swap().
void vrprouting::optimizers::simple::Optimize::move_wait_time_based | ( | ) |
|
inlineinherited |
Definition at line 119 of file solution.h.
References vrprouting::problem::Solution::m_msg.
Referenced by vrprouting::initialsol::simple::Initial_solution::do_while_foo(), inter_swap(), vrprouting::optimizers::tabu::Optimize::move_2_real(), vrprouting::initialsol::simple::Initial_solution::one_truck_all_orders(), Optimize(), vrprouting::optimizers::tabu::Optimize::Optimize(), vrprouting::initialsol::tabu::Initial_solution::process_unassigned(), save_if_best(), and vrprouting::optimizers::tabu::Optimize::tabu_search().
|
inlineinherited |
Get the value of the objective function.
Definition at line 110 of file solution.h.
References vrprouting::problem::Solution::total_travel_time().
Referenced by vrprouting::optimizers::tabu::Optimize::move_2_real(), vrprouting::optimizers::tabu::Optimize::single_pair_insertion(), vrprouting::optimizers::tabu::Optimize::swap_between_routes(), and vrprouting::optimizers::tabu::Optimize::tabu_search().
|
inherited |
|
inlineinherited |
Definition at line 120 of file solution.h.
References vrprouting::problem::Solution::m_orders.
Referenced by decrease_truck(), vrprouting::optimizers::tabu::Optimize::diversify(), vrprouting::optimizers::tabu::Optimize::move_2_real(), vrprouting::initialsol::tabu::Initial_solution::process_given_solution_from_user(), vrprouting::initialsol::tabu::Initial_solution::process_unassigned(), vrprouting::optimizers::tabu::Optimize::set_tabu_list_length(), vrprouting::optimizers::tabu::Optimize::single_pair_insertion(), and vrprouting::optimizers::tabu::Optimize::swap_between_routes().
|
private |
Definition at line 579 of file optimizers/simple.cpp.
References best_solution, vrprouting::problem::Solution::duration(), vrprouting::Pgr_messages::log, vrprouting::problem::Solution::m_fleet, and vrprouting::problem::Solution::msg().
Referenced by decrease_truck(), delete_empty_truck(), and move_reduce_cost().
|
private |
Definition at line 354 of file optimizers/simple.cpp.
References vrprouting::problem::Solution::m_fleet.
Referenced by sort_by_size().
|
private |
Definition at line 333 of file optimizers/simple.cpp.
References vrprouting::problem::Solution::m_fleet.
|
private |
Definition at line 343 of file optimizers/simple.cpp.
References vrprouting::problem::Solution::m_fleet, and sort_by_duration().
Referenced by inter_swap(), and Optimize().
|
private |
Definition at line 511 of file optimizers/simple.cpp.
References vrprouting::problem::Solution::m_fleet.
|
private |
Referenced by inter_swap().
|
private |
Definition at line 269 of file optimizers/simple.cpp.
References vrprouting::problem::Vehicle_pickDeliver::erase(), get_kind(), vrprouting::problem::Vehicle_pickDeliver::has_order(), vrprouting::problem::Vehicle_pickDeliver::hillClimb(), vrprouting::problem::Vehicle_pickDeliver::is_feasible(), vrprouting::initialsol::simple::OneDepot, pgassert, and vrprouting::problem::Vehicle_pickDeliver::semiLIFO().
|
private |
Definition at line 132 of file optimizers/simple.cpp.
References best_solution, vrprouting::problem::Solution::duration(), get_kind(), vrprouting::problem::Vehicle_pickDeliver::has_order(), move_order(), vrprouting::initialsol::simple::OneDepot, vrprouting::problem::Vehicle_pickDeliver::orders(), vrprouting::problem::Vehicle_pickDeliver::orders_in_vehicle(), and pgassert.
Referenced by inter_swap().
|
inherited |
writing the solution in compact form into a string
[in] | title | Title to Use for the tau |
Definition at line 116 of file solution.cpp.
References vrprouting::problem::Solution::cost_str(), and vrprouting::problem::Solution::m_fleet.
Referenced by inter_swap(), Optimize(), and vrprouting::optimizers::tabu::Optimize::Optimize().
|
inherited |
Total service time of the solution.
The total service time of the solution is the sum of the service times of all vehicles
Definition at line 174 of file solution.cpp.
References vrprouting::problem::Solution::m_fleet, and vrprouting::problem::Vehicle::total_service_time().
Referenced by vrprouting::problem::Solution::get_postgres_result().
|
inherited |
Total travel time of the solution.
The total travel time of the solution is the sum of the travel times of all vehicles
Definition at line 162 of file solution.cpp.
References vrprouting::problem::Solution::m_fleet, and vrprouting::problem::Vehicle::total_travel_time().
Referenced by vrprouting::problem::Solution::get_postgres_result(), and vrprouting::problem::Solution::objective().
|
inherited |
Total number of time windows constraint violations of the solution.
The total time window violations of the solution is the sum of the time window violations of all vehicles
Definition at line 185 of file solution.cpp.
References vrprouting::problem::Solution::m_fleet, and vrprouting::problem::Vehicle::twvTot().
Referenced by vrprouting::problem::Solution::get_postgres_result().
|
inlineinherited |
Definition at line 121 of file solution.h.
References vrprouting::problem::Solution::m_trucks.
Referenced by vrprouting::initialsol::simple::Initial_solution::do_while_foo(), vrprouting::initialsol::tabu::Initial_solution::Initial_solution(), vrprouting::initialsol::simple::Initial_solution::one_truck_all_orders(), vrprouting::initialsol::tabu::Initial_solution::process_given_solution_from_user(), and vrprouting::initialsol::tabu::Initial_solution::process_unassigned().
|
inherited |
Total waiting time of the solution.
The total waiting time of the solution is the sum of the waiting time of all vehicles
Definition at line 151 of file solution.cpp.
References vrprouting::problem::Solution::m_fleet, and vrprouting::problem::Vehicle::total_wait_time().
Referenced by vrprouting::problem::Solution::get_postgres_result().
Solution vrprouting::optimizers::simple::Optimize::best_solution |
Definition at line 54 of file optimizers/simple.h.
Referenced by move_reduce_cost(), Optimize(), save_if_best(), and swap_worse().
|
protectedinherited |
The current solution.
Definition at line 125 of file solution.h.
Referenced by vrprouting::problem::Solution::cost(), vrprouting::problem::Solution::cvTot(), decrease_truck(), delete_empty_truck(), vrprouting::optimizers::tabu::Optimize::diversify(), vrprouting::initialsol::simple::Initial_solution::do_while_foo(), vrprouting::problem::Solution::duration(), vrprouting::problem::Solution::fleet(), vrprouting::problem::Solution::get_postgres_result(), vrprouting::problem::Solution::get_stops(), vrprouting::initialsol::tabu::Initial_solution::Initial_solution(), vrprouting::optimizers::tabu::Optimize::intensify(), inter_swap(), vrprouting::problem::Solution::is_feasible(), vrprouting::optimizers::tabu::Optimize::move_2_real(), vrprouting::initialsol::simple::Initial_solution::one_truck_all_orders(), Optimize(), vrprouting::optimizers::tabu::Optimize::Optimize(), vrprouting::initialsol::tabu::Initial_solution::process_given_solution_from_user(), vrprouting::initialsol::tabu::Initial_solution::process_unassigned(), save_if_best(), vrprouting::optimizers::tabu::Optimize::single_pair_insertion(), sort_by_duration(), sort_by_id(), sort_by_size(), vrprouting::optimizers::tabu::Optimize::sort_by_size(), sort_for_move(), vrprouting::optimizers::tabu::Optimize::swap_between_routes(), vrprouting::optimizers::tabu::Optimize::tabu_search(), vrprouting::problem::Solution::tau(), vrprouting::problem::Solution::total_service_time(), vrprouting::problem::Solution::total_travel_time(), vrprouting::problem::Solution::twvTot(), and vrprouting::problem::Solution::wait_time().
|
private |
Definition at line 83 of file optimizers/simple.h.
Referenced by get_kind().
|
protectedinherited |
Definition at line 130 of file solution.h.
Referenced by vrprouting::problem::Solution::msg().
|
protectedinherited |
the problem info
Definition at line 128 of file solution.h.
Referenced by vrprouting::initialsol::simple::Initial_solution::do_while_feasible(), and vrprouting::problem::Solution::orders().
|
protectedinherited |
Definition at line 129 of file solution.h.
Referenced by vrprouting::problem::Solution::vehicles().