49 for (
const auto &e :
m_used) {
63 std::vector<Vehicle_pickDeliver>
66 std::vector<Vehicle_pickDeliver> trucks;
67 for (
auto v_idx :
m_used) {
68 if (!at(v_idx).is_phony()) {
69 trucks.push_back(at(v_idx));
79 std::vector<Vehicle_pickDeliver>
83 std::vector<Vehicle_pickDeliver> trucks;
88 if (!at(v_idx).is_phony()) {
89 trucks.push_back(at(v_idx));
111 for (
auto &v : *
this) {
124 if (this->size() > 1)
m_unused -= idx;
147 for (
auto truck : *
this) {
148 if (!truck.is_ok()) {
149 m_msg.
error <<
"Illegal values found on vehicle";
150 m_msg.
log <<
"On vehicle " << truck.id()
151 <<
" a condition is not met, verify that:\n"
152 <<
"- start_open <= start_close\n"
153 <<
"- end_open <= end_close\n"
154 <<
"- capacity > 0\n";
158 if (!(truck.start_site().is_start()
159 && truck.end_site().is_end())) {
160 pgassertwm(
false,
"should never pass through here");
161 m_msg.
error <<
"Illegal values found on vehicle";
164 if (!truck.is_feasible()) {
180 for (
const auto &truck : *
this) {
181 if (!order.
is_valid(truck.speed()))
continue;
182 if (truck.is_order_feasible(order)) {
198 const std::vector<Short_vehicle>& new_stops,
200 std::vector<Vehicle_node>& p_nodes,
210 m_msg.
error <<
"Illegal values found on vehicle";
212 <<
" a condition is not met:\n"
214 <<
"- start_open <= start_close: "
216 <<
"- end_open <= end_close: "
218 <<
"- capacity > 0" << vehicle.
capacity <<
"\n";
234 p_nodes.push_back(starting_site);
235 p_nodes.push_back(ending_site);
237 auto v_id = vehicle.
id;
238 auto vehicle_new_stops_ptr = std::find_if(new_stops.begin(), new_stops.end(), [v_id]
240 bool replace_stops = vehicle_new_stops_ptr != new_stops.end();
255 vehicle.
cant_v == 1? vehicle_new_stops_ptr->stops : std::vector<int64_t>(),
270 std::vector<int64_t>(),
302 for (
auto &v : *
this) {
306 v.set_initial_solution(orders, assigned, unassigned, execution_date, optimize);
317 for (
const auto &o : orders) {
321 for (
auto & m_vehicle : *
this) {
325 if (m_vehicle.end_site().closes() < o.pickup().opens())
continue;
330 if (o.delivery().closes() < m_vehicle.start_site().opens())
continue;
332 if (m_vehicle.is_order_feasible(o)) {
333 m_msg.
log <<
"Order " << o.id() <<
"is feasible on Vehicle " << m_vehicle.id() <<
"\n";
334 auto test_truck = m_vehicle;
335 test_truck.push_back(o);
341 m_vehicle.feasible_orders() += o.idx();
348 if (at(this->size() - 1).is_order_feasible(o)) {
349 at(this->size() - 1).feasible_orders() += o.idx();
365 Vehicle_t *vehicles,
size_t size_vehicles,
366 const std::vector<Short_vehicle>& new_stops,
368 std::vector<Vehicle_node>& p_nodes,
373 std::sort(vehicles, vehicles + size_vehicles,
376 if (lhs.end_close_t == rhs.end_close_t) {
377 return lhs.id < rhs.id;
379 return lhs.end_close_t < rhs.end_close_t;
389 for (
size_t i = 0; i < size_vehicles; ++i) {
390 add_vehicle(vehicles[i], new_stops, p_orders, p_nodes, node_id);
401 (std::numeric_limits<PAmount>::max)(),
410 vehicles[0].start_node_id,
412 (std::numeric_limits<TTimestamp>::max)(),
420 vehicles[0].end_node_id,
422 (std::numeric_limits<TTimestamp>::max)(),
431 add_vehicle(phony_v, new_stops, p_orders, p_nodes, node_id);
436 pgassert(m_unused.size() == size());