vrpRouting  0.3
vrprouting::initialsol::simple::Initial_solution Class Reference

#include "simple.h"

Inheritance diagram for vrprouting::initialsol::simple::Initial_solution:
Collaboration diagram for vrprouting::initialsol::simple::Initial_solution:

Public Member Functions

 Initial_solution ()=delete
 
 Initial_solution (Initials_code, problem::PickDeliver *)
 
std::tuple< int, int, size_t, TInterval, TInterval, TIntervalcost () 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...
 
TInterval duration () const
 Total duration of the solution. More...
 
const std::deque< Vehicle_pickDeliver > & fleet () const
 Get the current fleet solution. More...
 
std::vector< Solution_rtget_postgres_result () const
 get solution like postgres needs it More...
 
std::vector< Short_vehicleget_stops () const
 get solution like postgres needs it More...
 
void invariant () const
 
bool is_feasible () const
 is the solution feasible? More...
 
Pgr_messagesmsg ()
 
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...
 

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 Member Functions

void do_while_feasible (problem::Vehicle_pickDeliver &truck, Initials_code kind, Identifiers< size_t > &unassigned, Identifiers< size_t > &assigned)
 
void do_while_foo (int kind)
 
void one_truck_all_orders ()
 

Private Attributes

Identifiers< size_t > all_orders
 
Identifiers< size_t > assigned
 
Identifiers< size_t > unassigned
 

Detailed Description

Definition at line 45 of file initialsol/simple.h.

Constructor & Destructor Documentation

◆ Initial_solution() [1/2]

vrprouting::initialsol::simple::Initial_solution::Initial_solution ( )
delete

◆ Initial_solution() [2/2]

vrprouting::initialsol::simple::Initial_solution::Initial_solution ( Initials_code  kind,
problem::PickDeliver problem_ptr 
)

Definition at line 46 of file initialsol/simple.cpp.

48  :
49  problem::Solution(problem_ptr),
50  all_orders(m_orders.size()),
51  unassigned(m_orders.size()),
52  assigned() {
53  invariant();
54  pgassert(kind >= 0 && kind <= OneDepot);
55 
56  switch (kind) {
57  case OneTruck:
59  break;
60  case OnePerTruck:
61  case FrontTruck:
62  case BackTruck:
63  case BestInsert:
64  case BestBack:
65  case BestFront:
66  case OneDepot:
67  do_while_foo(kind);
68  break;
69  default: pgassert(false);
70  }
71 
72  invariant();
73 }

References vrprouting::initialsol::simple::BackTruck, vrprouting::initialsol::simple::BestBack, vrprouting::initialsol::simple::BestFront, vrprouting::initialsol::simple::BestInsert, do_while_foo(), vrprouting::initialsol::simple::FrontTruck, invariant(), one_truck_all_orders(), vrprouting::initialsol::simple::OneDepot, vrprouting::initialsol::simple::OnePerTruck, vrprouting::initialsol::simple::OneTruck, and pgassert.

Member Function Documentation

◆ cost()

std::tuple< int, int, size_t, TInterval, TInterval, TInterval > Solution::cost ( ) const
inherited

Get all statistics in one cycle.

Returns
totals of
idx variable
0 twv
1 cv
2 fleet size
3 waiting time
4 duration
5 travel time
std::get<idx>

Definition at line 218 of file solution.cpp.

218  {
219  TInterval total_duration(0);
220  TInterval total_wait_time(0);
221  TInterval total_tt(0);
222  int total_twv(0);
223  int total_cv(0);
224  /*
225  * Cycle the fleet
226  */
227  for (const auto& v : m_fleet) {
228  total_duration += v.duration();
229  total_wait_time += v.total_wait_time();
230  total_twv += v.twvTot();
231  total_cv += v.cvTot();
232  total_tt += v.total_travel_time();
233  }
234  /*
235  * build the tuple
236  */
237  return std::make_tuple(
238  total_twv, total_cv, m_fleet.size(),
239  total_wait_time, total_duration,
240  total_tt);
241 }

References vrprouting::problem::Solution::m_fleet.

Referenced by vrprouting::problem::Solution::cost_str(), and vrprouting::problem::Solution::operator<().

◆ cost_str()

std::string Solution::cost_str ( ) const
inherited
Returns
The costs in one string

Definition at line 246 of file solution.cpp.

246  {
247  /*
248  * get the cost
249  */
250  auto s_cost(cost());
251  std::ostringstream log;
252 
253  /*
254  * Build the string
255  */
256  log << std::fixed << std::setprecision(4)
257  << "twv=" << std::get<0>(s_cost)
258  << " cv=" << std::get<1>(s_cost)
259  << " wait=" << std::get<3>(s_cost)
260  << " duration=" << std::get<4>(s_cost)
261  << " tt=" << std::get<5>(s_cost);
262 
263  return log.str();
264 }

References vrprouting::problem::Solution::cost().

Referenced by vrprouting::problem::Solution::tau().

◆ cvTot()

int Solution::cvTot ( ) const
inherited

Total number of capacity constraint violations of the solution.

Returns
Total number of capacity violations The total capacity violations of the solution is the sum of the capacity violations of all vehicles

Definition at line 196 of file solution.cpp.

196  {
197  return std::accumulate(begin(m_fleet), end(m_fleet), 0,
198  [](int i, const Vehicle_pickDeliver& v) {return v.cvTot() + i;});
199 }

References vrprouting::problem::Vehicle::cvTot(), and vrprouting::problem::Solution::m_fleet.

Referenced by vrprouting::problem::Solution::get_postgres_result().

◆ do_while_feasible()

void vrprouting::initialsol::simple::Initial_solution::do_while_feasible ( problem::Vehicle_pickDeliver truck,
Initials_code  kind,
Identifiers< size_t > &  unassigned,
Identifiers< size_t > &  assigned 
)
private

Definition at line 120 of file initialsol/simple.cpp.

124  {
126  auto current_feasible = vehicle.feasible_orders() * unassigned;
127 
128  while (!current_feasible.empty()) {
129  auto order = m_orders[current_feasible.front()];
130 
131  switch (kind) {
132  case OnePerTruck:
133  vehicle.push_back(order);
135  assigned += order.idx();
136  unassigned -= order.idx();
137  invariant();
138  return;
139  break;
140  case FrontTruck:
141  vehicle.push_front(order);
142  break;
143  case BackTruck:
144  vehicle.push_back(order);
145  break;
146  case BestInsert:
147  vehicle.hillClimb(order);
148  break;
149  case BestBack:
150  order = m_orders[m_orders.find_best_J(current_feasible)];
151  vehicle.hillClimb(order);
152  break;
153  case BestFront:
154  order = m_orders[m_orders.find_best_I(current_feasible)];
155  vehicle.hillClimb(order);
156  break;
157  case OneDepot:
158  vehicle.semiLIFO(order);
159  break;
160  default: pgassert(false);
161  }
162 
163  if (vehicle.orders_size() == 1 && !is_feasible()) {
164  pgassert(false);
165  }
166 
167  if (!is_feasible()) {
168  vehicle.erase(order);
169  } else if (vehicle.has_order(order)) {
170  assigned += order.idx();
171  unassigned -= order.idx();
172  if (kind == BestBack) {
173  current_feasible = m_orders[order.idx()].subsetJ(
174  current_feasible);
175  }
176  if (kind == BestFront) {
177  current_feasible = m_orders[order.idx()].subsetI(
178  current_feasible);
179  }
180  }
181 
182  current_feasible -= order.idx();
183  invariant();
184  }
185 
187  invariant();
188 }

References assigned, vrprouting::initialsol::simple::BackTruck, vrprouting::initialsol::simple::BestBack, vrprouting::initialsol::simple::BestFront, vrprouting::initialsol::simple::BestInsert, vrprouting::problem::Vehicle_pickDeliver::erase(), vrprouting::problem::Vehicle_pickDeliver::feasible_orders(), vrprouting::problem::Orders::find_best_I(), vrprouting::problem::Orders::find_best_J(), vrprouting::initialsol::simple::FrontTruck, vrprouting::problem::Vehicle_pickDeliver::has_order(), vrprouting::problem::Vehicle_pickDeliver::hillClimb(), invariant(), vrprouting::problem::Solution::is_feasible(), vrprouting::problem::Solution::m_orders, vrprouting::initialsol::simple::OneDepot, vrprouting::initialsol::simple::OnePerTruck, vrprouting::problem::Vehicle_pickDeliver::orders_size(), pgassert, vrprouting::problem::Vehicle_pickDeliver::push_back(), vrprouting::problem::Vehicle_pickDeliver::push_front(), vrprouting::problem::Vehicle_pickDeliver::semiLIFO(), and unassigned.

Referenced by do_while_foo().

◆ do_while_foo()

void vrprouting::initialsol::simple::Initial_solution::do_while_foo ( int  kind)
private

Definition at line 76 of file initialsol/simple.cpp.

76  {
77  invariant();
78  pgassert(kind > 0 && kind <= OneDepot);
79 
80  Identifiers<size_t> notused;
81 
82  while (!unassigned.empty()) {
83  auto current = unassigned.size();
84  auto truck = vehicles().get_truck(unassigned.front());
85  /*
86  * kind 1 to 7 work with the same code structure
87  */
89  pgassertwm(current > unassigned.size(), msg().get_log().c_str());
90 
91  m_fleet.push_back(truck);
92  invariant();
93  }
94 
95  pgassertwm(true, msg().get_log().c_str());
97  invariant();
98 }

References assigned, do_while_feasible(), Identifiers< T >::empty(), Identifiers< T >::front(), vrprouting::problem::Fleet::get_truck(), invariant(), vrprouting::problem::Solution::is_feasible(), vrprouting::problem::Solution::m_fleet, vrprouting::problem::Solution::msg(), vrprouting::initialsol::simple::OneDepot, pgassert, pgassertwm, Identifiers< T >::size(), unassigned, and vrprouting::problem::Solution::vehicles().

Referenced by Initial_solution().

◆ duration()

TInterval Solution::duration ( ) const
inherited

Total duration of the solution.

Returns
the solution's duration

The solution duration is the sum of the durations of all vehicles

Definition at line 140 of file solution.cpp.

140  {
141  return std::accumulate(begin(m_fleet), end(m_fleet), static_cast<TInterval>(0),
142  [](TInterval i, const Vehicle_pickDeliver& v) {return v.duration() + i;});
143 }

References vrprouting::problem::Vehicle::duration(), and vrprouting::problem::Solution::m_fleet.

Referenced by vrprouting::problem::Solution::get_postgres_result(), vrprouting::optimizers::simple::Optimize::save_if_best(), and vrprouting::optimizers::simple::Optimize::swap_worse().

◆ fleet()

const std::deque<Vehicle_pickDeliver>& vrprouting::problem::Solution::fleet ( ) const
inlineinherited

Get the current fleet solution.

Definition at line 107 of file solution.h.

107 {return m_fleet;}

References vrprouting::problem::Solution::m_fleet.

Referenced by vrprouting::optimizers::tabu::Optimize::intensify(), and vrprouting::optimizers::tabu::Optimize::Optimize().

◆ get_postgres_result()

std::vector< Solution_rt > Solution::get_postgres_result ( ) const
inherited

get solution like postgres needs it

Returns
container for postgres

Definition at line 61 of file solution.cpp.

61  {
62  std::vector<Solution_rt> result;
63 
64  /* postgres numbering starts with 1 */
65  int i(1);
66 
67  for (auto v : m_fleet) {
68  v.evaluate(0);
69  auto data = v.get_postgres_result(i);
70  /*
71  * Results adjusted for the depot and the first stop
72  * So the vehicle waits on the depot not on the first stop
73  */
74  data[1].arrivalTime = data[1].operationTime;
75  data[0].waitDuration = data[1].waitDuration;
76  data[1].waitDuration = 0;
77  data[0].departureTime = data[0].arrivalTime + data[0].waitDuration;
78 
79 
80  result.insert(result.end(), data.begin(), data.end());
81  ++i;
82  }
83 
84  Solution_rt aggregates = {
85  /*
86  * Vehicle id = -2 indicates its an aggregate row
87  *
88  * (twv, cv, fleet, wait, duration)
89  */
90  -2, // summary row on vehicle_number
91  twvTot(), // on vehicle_id
92  cvTot(), // on vehicle_seq
93  -1, // on order_id
94  -1, // on stop_id
95  -2, // on stop_type (gets increased later by one so it gets -1)
96  -1, // not accounting total loads
97  static_cast<int64_t>(total_travel_time()),
98  -1, // not accounting arrival_travel_time
99  static_cast<int64_t>(wait_time()),
100  -1, // not accounting operation time
101  static_cast<int64_t>(total_service_time()),
102  static_cast<int64_t>(duration()),
103  cvTot(),
104  twvTot()
105  };
106  result.push_back(aggregates);
107 
108  return result;
109 }

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().

◆ get_stops()

std::vector< Short_vehicle > Solution::get_stops ( ) const
inherited

get solution like postgres needs it

Returns
container for postgres

Definition at line 49 of file solution.cpp.

49  {
50  std::vector<Short_vehicle> result;
51  for (auto v : m_fleet) {
52  result.push_back(Short_vehicle{v.id(), v.get_stops()});
53  }
54  return result;
55 }

References Short_vehicle::id, and vrprouting::problem::Solution::m_fleet.

◆ invariant()

void vrprouting::initialsol::simple::Initial_solution::invariant ( ) const

Definition at line 40 of file initialsol/simple.cpp.

40  {
41  /* this checks there is no order duplicated */
43  pgassert((assigned * unassigned).empty());
44 }

References all_orders, assigned, pgassert, and unassigned.

Referenced by do_while_feasible(), do_while_foo(), Initial_solution(), and one_truck_all_orders().

◆ is_feasible()

bool Solution::is_feasible ( ) const
inherited

is the solution feasible?

The solution is feasible when all vehicles are feasible.

Returns
true when all vehicles in solution are feasible

Definition at line 129 of file solution.cpp.

129  {
130  return std::find_if(m_fleet.begin(), m_fleet.end(),
131  [] (const Vehicle_pickDeliver& v) -> bool {return !v.is_feasible();}) == m_fleet.end();
132 }

References vrprouting::problem::Solution::m_fleet.

Referenced by vrprouting::optimizers::simple::Optimize::decrease_truck(), do_while_feasible(), 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().

◆ msg()

◆ objective()

double vrprouting::problem::Solution::objective ( ) const
inlineinherited

◆ one_truck_all_orders()

void vrprouting::initialsol::simple::Initial_solution::one_truck_all_orders ( )
private

Definition at line 101 of file initialsol/simple.cpp.

101  {
102  invariant();
103  msg().log << "\nInitial_solution::one_truck_all_orders\n";
104  auto truck = vehicles().get_truck();
105  while (!unassigned.empty()) {
106  auto order(truck.orders().at(*unassigned.begin()));
107 
108  truck.hillClimb(order);
109 
112 
113  invariant();
114  }
115  m_fleet.push_back(truck);
116  invariant();
117 }

References assigned, Identifiers< T >::begin(), Identifiers< T >::empty(), Identifiers< T >::front(), vrprouting::problem::Fleet::get_truck(), invariant(), vrprouting::Pgr_messages::log, vrprouting::problem::Solution::m_fleet, vrprouting::problem::Solution::msg(), Identifiers< T >::pop_front(), unassigned, and vrprouting::problem::Solution::vehicles().

Referenced by Initial_solution().

◆ operator<()

bool Solution::operator< ( const Solution s_rhs) const
inherited

Definition at line 267 of file solution.cpp.

267  {
268  auto lhs(cost());
269  auto rhs(s_rhs.cost());
270 
271  /*
272  * time window violations
273  */
274  if (std::get<0>(lhs) < std::get<0>(rhs))
275  return true;
276  if (std::get<0>(lhs) > std::get<0>(rhs))
277  return false;
278 
279  /*
280  * capacity violations
281  */
282  if (std::get<1>(lhs) < std::get<1>(rhs))
283  return true;
284  if (std::get<1>(lhs) > std::get<1>(rhs))
285  return false;
286 
287  /*
288  * fleet size
289  */
290  if (std::get<2>(lhs) < std::get<2>(rhs))
291  return true;
292  if (std::get<2>(lhs) > std::get<2>(rhs))
293  return false;
294 
295  /*
296  * waiting time
297  */
298  if (std::get<3>(lhs) < std::get<3>(rhs))
299  return true;
300  if (std::get<3>(lhs) > std::get<3>(rhs))
301  return false;
302 
303  /*
304  * duration
305  */
306  if (std::get<4>(lhs) < std::get<4>(rhs))
307  return true;
308  if (std::get<4>(lhs) > std::get<4>(rhs))
309  return false;
310 
311  return false;
312 }

References vrprouting::problem::Solution::cost().

◆ orders()

◆ tau()

std::string Solution::tau ( const std::string &  title = "Tau") const
inherited

writing the solution in compact form into a string

Parameters
[in]titleTitle to Use for the tau
Returns
The solution in one compacted string

Definition at line 116 of file solution.cpp.

116  {
117  std::string str {"\n" + title + ": " + '\n'};
118  for (const auto& v : m_fleet) str += ("\n" + v.tau());
119  str += "\n" + cost_str() + "\n";
120  return str;
121 }

References vrprouting::problem::Solution::cost_str(), and vrprouting::problem::Solution::m_fleet.

Referenced by vrprouting::optimizers::simple::Optimize::inter_swap(), vrprouting::optimizers::simple::Optimize::Optimize(), and vrprouting::optimizers::tabu::Optimize::Optimize().

◆ total_service_time()

TInterval Solution::total_service_time ( ) const
inherited

Total service time of the solution.

Returns
the 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.

174  {
175  return std::accumulate(begin(m_fleet), end(m_fleet), static_cast<TInterval>(0),
176  [](TInterval i, const Vehicle_pickDeliver& v) {return v.total_service_time() + i;});
177 }

References vrprouting::problem::Solution::m_fleet, and vrprouting::problem::Vehicle::total_service_time().

Referenced by vrprouting::problem::Solution::get_postgres_result().

◆ total_travel_time()

TInterval Solution::total_travel_time ( ) const
inherited

Total travel time of the solution.

Returns
the total waiting time

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.

162  {
163  return std::accumulate(begin(m_fleet), end(m_fleet), static_cast<TInterval>(0),
164  [](TInterval i, const Vehicle_pickDeliver& v) {return v.total_travel_time() + i;});
165 }

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().

◆ twvTot()

int Solution::twvTot ( ) const
inherited

Total number of time windows constraint violations of the solution.

Returns
the total number of time window violations

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.

185  {
186  return std::accumulate(begin(m_fleet), end(m_fleet), 0,
187  [](int i, const Vehicle_pickDeliver& v) {return v.twvTot() + i;});
188 }

References vrprouting::problem::Solution::m_fleet, and vrprouting::problem::Vehicle::twvTot().

Referenced by vrprouting::problem::Solution::get_postgres_result().

◆ vehicles()

◆ wait_time()

TInterval Solution::wait_time ( ) const
inherited

Total waiting time of the solution.

Returns
the total waiting time

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.

151  {
152  return std::accumulate(begin(m_fleet), end(m_fleet), static_cast<TInterval>(0),
153  [](TInterval i, const Vehicle_pickDeliver& v) {return v.total_wait_time() + i;});
154 }

References vrprouting::problem::Solution::m_fleet, and vrprouting::problem::Vehicle::total_wait_time().

Referenced by vrprouting::problem::Solution::get_postgres_result().

Member Data Documentation

◆ all_orders

Identifiers<size_t> vrprouting::initialsol::simple::Initial_solution::all_orders
private

Definition at line 66 of file initialsol/simple.h.

Referenced by invariant().

◆ assigned

Identifiers<size_t> vrprouting::initialsol::simple::Initial_solution::assigned
private

◆ m_fleet

std::deque<Vehicle_pickDeliver> vrprouting::problem::Solution::m_fleet
protectedinherited

The current solution.

Definition at line 125 of file solution.h.

Referenced by vrprouting::problem::Solution::cost(), vrprouting::problem::Solution::cvTot(), vrprouting::optimizers::simple::Optimize::decrease_truck(), vrprouting::optimizers::simple::Optimize::delete_empty_truck(), vrprouting::optimizers::tabu::Optimize::diversify(), 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(), vrprouting::optimizers::simple::Optimize::inter_swap(), vrprouting::problem::Solution::is_feasible(), vrprouting::optimizers::tabu::Optimize::move_2_real(), one_truck_all_orders(), vrprouting::optimizers::simple::Optimize::Optimize(), vrprouting::optimizers::tabu::Optimize::Optimize(), vrprouting::initialsol::tabu::Initial_solution::process_given_solution_from_user(), vrprouting::initialsol::tabu::Initial_solution::process_unassigned(), vrprouting::optimizers::simple::Optimize::save_if_best(), vrprouting::optimizers::tabu::Optimize::single_pair_insertion(), vrprouting::optimizers::simple::Optimize::sort_by_duration(), vrprouting::optimizers::simple::Optimize::sort_by_id(), vrprouting::optimizers::simple::Optimize::sort_by_size(), vrprouting::optimizers::tabu::Optimize::sort_by_size(), vrprouting::optimizers::simple::Optimize::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().

◆ m_msg

Pgr_messages vrprouting::problem::Solution::m_msg
protectedinherited

Definition at line 130 of file solution.h.

Referenced by vrprouting::problem::Solution::msg().

◆ m_orders

Orders vrprouting::problem::Solution::m_orders
protectedinherited

the problem info

Definition at line 128 of file solution.h.

Referenced by do_while_feasible(), and vrprouting::problem::Solution::orders().

◆ m_trucks

Fleet vrprouting::problem::Solution::m_trucks
protectedinherited

Definition at line 129 of file solution.h.

Referenced by vrprouting::problem::Solution::vehicles().

◆ unassigned

Identifiers<size_t> vrprouting::initialsol::simple::Initial_solution::unassigned
private

The documentation for this class was generated from the following files:
vrprouting::Pgr_messages::log
std::ostringstream log
Stores the hint information.
Definition: pgr_messages.h:91
vrprouting::problem::Solution::total_service_time
TInterval total_service_time() const
Total service time of the solution.
Definition: solution.cpp:174
vrprouting::problem::Solution::m_fleet
std::deque< Vehicle_pickDeliver > m_fleet
The current solution.
Definition: solution.h:125
Identifiers::pop_front
void pop_front()
Definition: identifiers.hpp:84
vrprouting::initialsol::simple::Initials_code
Initials_code
Different kinds to insert an order into the vehicle.
Definition: initialsol/initials_code.h:37
vrprouting::problem::Solution::cvTot
int cvTot() const
Total number of capacity constraint violations of the solution.
Definition: solution.cpp:196
vrprouting::problem::Solution::total_travel_time
TInterval total_travel_time() const
Total travel time of the solution.
Definition: solution.cpp:162
vrprouting::problem::Fleet::get_truck
Vehicle_pickDeliver get_truck()
Finds an unused vehicle.
Definition: fleet.cpp:121
Short_vehicle::id
Id id
Definition: short_vehicle.h:42
pgassertwm
#define pgassertwm(expr, msg)
Adds a message to the assertion.
Definition: pgr_assert.h:118
vrprouting::initialsol::simple::Initial_solution::unassigned
Identifiers< size_t > unassigned
Definition: initialsol/simple.h:67
vrprouting::initialsol::simple::Initial_solution::invariant
void invariant() const
Definition: initialsol/simple.cpp:40
vrprouting::problem::Solution::vehicles
Fleet & vehicles()
Definition: solution.h:121
vrprouting::initialsol::simple::BackTruck
@ BackTruck
Insetion at the front of the truck.
Definition: initialsol/initials_code.h:41
vrprouting::initialsol::simple::Initial_solution::do_while_foo
void do_while_foo(int kind)
Definition: initialsol/simple.cpp:76
vrprouting::problem::Solution::twvTot
int twvTot() const
Total number of time windows constraint violations of the solution.
Definition: solution.cpp:185
vrprouting::initialsol::simple::OneDepot
@ OneDepot
Push front order that allows more orders to be inserted at the front.
Definition: initialsol/initials_code.h:45
pgassert
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:95
vrprouting::problem::Solution::wait_time
TInterval wait_time() const
Total waiting time of the solution.
Definition: solution.cpp:151
Identifiers::size
size_t size() const
Definition: identifiers.hpp:77
vrprouting::problem::Solution::duration
TInterval duration() const
Total duration of the solution.
Definition: solution.cpp:140
Short_vehicle
short_vehicle
Definition: short_vehicle.h:41
Identifiers::begin
const_iterator begin() const
Definition: identifiers.hpp:81
Identifiers::empty
bool empty() const
Definition: identifiers.hpp:78
Solution_rt
Solution schedule when twv & cw are hard restrictions.
Definition: solution_rt.h:56
vrprouting::problem::Solution::msg
Pgr_messages & msg()
Definition: solution.h:119
vrprouting::initialsol::simple::OnePerTruck
@ OnePerTruck
All orders in one truck.
Definition: initialsol/initials_code.h:39
vrprouting::initialsol::simple::FrontTruck
@ FrontTruck
One Order per truck.
Definition: initialsol/initials_code.h:40
vrprouting::problem::Solution::m_msg
Pgr_messages m_msg
Definition: solution.h:130
vrprouting::initialsol::simple::OneTruck
@ OneTruck
Definition: initialsol/initials_code.h:38
vrprouting::initialsol::simple::Initial_solution::one_truck_all_orders
void one_truck_all_orders()
Definition: initialsol/simple.cpp:101
vrprouting::initialsol::simple::Initial_solution::assigned
Identifiers< size_t > assigned
Definition: initialsol/simple.h:68
Identifiers::front
T front() const
Definition: identifiers.hpp:79
vrprouting::problem::Solution::cost
std::tuple< int, int, size_t, TInterval, TInterval, TInterval > cost() const
Get all statistics in one cycle.
Definition: solution.cpp:218
vrprouting::problem::Solution::is_feasible
bool is_feasible() const
is the solution feasible?
Definition: solution.cpp:129
vrprouting::initialsol::simple::BestBack
@ BestBack
Best place to insert Order.
Definition: initialsol/initials_code.h:43
vrprouting::problem::Orders::find_best_J
size_t find_best_J(const Identifiers< size_t > &within_this_set) const
find the best order -> this -> order
Definition: orders.cpp:46
vrprouting::initialsol::simple::Initial_solution::do_while_feasible
void do_while_feasible(problem::Vehicle_pickDeliver &truck, Initials_code kind, Identifiers< size_t > &unassigned, Identifiers< size_t > &assigned)
Definition: initialsol/simple.cpp:120
TInterval
int64_t TInterval
Definition: typedefs.h:72
vrprouting::initialsol::simple::BestFront
@ BestFront
Push back order that allows more orders to be inserted at the back.
Definition: initialsol/initials_code.h:44
vrprouting::problem::Orders::find_best_I
size_t find_best_I(const Identifiers< size_t > &within_this_set) const
find the best order -> this
Definition: orders.cpp:68
vrprouting::problem::Solution::m_trucks
Fleet m_trucks
Definition: solution.h:129
vrprouting::initialsol::simple::BestInsert
@ BestInsert
Insetion at the back of the truck.
Definition: initialsol/initials_code.h:42
vrprouting::problem::Solution::m_orders
Orders m_orders
the problem info
Definition: solution.h:128
Identifiers< size_t >
vrprouting::initialsol::simple::Initial_solution::all_orders
Identifiers< size_t > all_orders
Definition: initialsol/simple.h:66
vrprouting::problem::Solution::cost_str
std::string cost_str() const
Definition: solution.cpp:246