51 m_trucks(fleet.m_trucks),
53 m_un_used(fleet.m_un_used)
57 const std::vector<Vehicle_t> &vehicles,
double factor) :
71 msg().
log <<
"NOT Available vehicles: " <<
m_used <<
"\n";
72 msg().
log <<
"getting idx" << idx <<
"\n";
85 msg().
log <<
"NOT Available vehicles: " <<
m_used <<
"\n";
90 if (
m_trucks[i].feasable_orders().has(order)) {
92 msg().
log <<
"getting idx" << idx <<
"\n";
106 if (truck.feasable_orders().has(order)) {
132 for (
int i = 0; i < vehicle.
cant_v; ++i) {
142 msg().
log <<
"inserting vehicle: " <<
m_trucks.back().tau() <<
"\n";
161 std::vector<Vehicle_t> vehicles,
172 std::numeric_limits<double>::infinity(),
177 vehicles[0].start_node_id,
184 std::numeric_limits<double>::infinity(),
189 vehicles[0].end_node_id,
194 std::numeric_limits<double>::infinity(),
198 for (
auto vehicle : vehicles) {
199 if (vehicle.cant_v < 0) {
200 throw std::make_pair(std::string(
"Illegal number of vehicles found"), vehicle.cant_v);
203 if (vehicle.capacity < 0) {
204 throw std::make_pair(std::string(
"Illegal value for capacity found"), vehicle.capacity);
209 throw std::make_pair(std::string(
"Unable to find node on matrix"), vehicle.start_node_id);
212 throw std::make_pair(std::string(
"Unable to find node on matrix"), vehicle.end_node_id);
216 if (!(vehicle.start_open_t <= vehicle.start_close_t
217 && vehicle.end_open_t <= vehicle.end_close_t
218 && vehicle.start_open_t <= vehicle.end_close_t)) {
219 msg().
error <<
"Illegal values found on vehicle";
220 msg().
log <<
"On vehicle " << vehicle.id
221 <<
" a condition is not met, verify that:"
222 <<
"\nvehicle.start_open_t <= vehicle.start_close_t\t"
223 << vehicle.start_open_t <<
" <= " << vehicle.start_close_t
224 <<
"\nvehicle.end_open_t <= vehicle.end_close_t\t"
225 << vehicle.end_open_t <<
" <= " << vehicle.end_close_t
226 <<
"\nvehicle.start_open_t <= vehicle.end_close_t\t"
227 << vehicle.start_open_t <<
" <= " << vehicle.end_close_t;
229 throw std::make_pair(
msg().get_error(),
msg().get_log());
240 pgassert(starting_site.opens() <= starting_site.closes());
241 pgassert(ending_site.opens() <= ending_site.closes());
242 pgassert(starting_site.is_start() && ending_site.is_end());
244 add_vehicle(vehicle, factor, starting_site, ending_site);
255 if (!
msg().get_error().empty())
return false;
257 if (!truck.is_ok()) {
258 msg().
error <<
"Illegal values found on vehicle";
259 msg().
log <<
"On vehicle " << truck.id()
260 <<
" a condition is not met, verify that:\n"
261 <<
"- start_open <= start_close\n"
262 <<
"- end_open <= end_close\n"
263 <<
"- capacity > 0\n";
267 if (!(truck.start_site().is_start()
268 && truck.end_site().is_end())) {
269 pgassertwm(
false,
"should never pass through here");
270 msg().
error <<
"Illegal values found on vehicle";
273 if (!truck.is_feasable()) {
274 msg().
error <<
"Truck is not feasible";
289 for (
const auto &truck :
m_trucks) {
290 if (!order.
is_valid(truck.speed()))
continue;
291 if (truck.is_order_feasable(order)) {
315 truck.set_compatibles(orders);
329 log <<
"end fleet\n";