violation
A violation indicates that a user-provided constraint was not met. A violation can occur on a route_response or a stop_response object.
Name | Type | Description |
---|---|---|
data | violation_data | Additional data relating to the violation. |
type | violation_type | The violation type. |
violation_type
A string representing the type of violation.
stop_response Violations
These violations occur when there is an issue with a stop_response object. These violations typically occur when a job's constraint is violated.
violation_type | Description |
---|---|
job_missed_time_window |
Occurs when a job's arrival time is outside its time_window. See Routing with Time Windows. |
job_missed_date_window |
Occurs when a job is routed on a day that does not fall within the date range specified by its date, allowed_variance_before, and allowed_variance_after. See Routing with Dates. |
job_delivered_on_disallowed_day |
Occurs when a job is routed on a day that does not match its allowed_days_of_week or allowed_dates. See Routing with Dates. |
missing_route_attributes |
Occurs when a job is assigned to a route that is missing an attribute specified in required_route_attributes. See Routing with Attributes. |
disallowed_route_attributes |
Occurs when a job is assigned to a route that has an attribute that violates its disallowed_route_attributes. See Routing with Attributes. |
missing_driver_attributes |
Occurs when a job is assigned to a driver who is missing an attribute specified in required_driver_attributes. See Routing with Attributes. |
disallowed_driver_attributes |
Occurs when a job is assigned to a driver who has an attribute that violates its disallowed_driver_attributes. See Routing with Attributes. |
driver_not_in_zone |
Occurs when a job is assigned to a driver who is not assigned to the zone in which the job is geographically located. |
job_not_in_zone |
Occurs when a job which is not located within any zone is assigned to a driver. |
missing_vehicle_attributes |
Occurs when a job is assigned to a vehicle that is missing an attribute specified in required_vehicle_attributes. See Routing with Attributes. |
stop_delivered_already |
Occurs when a job is delivered twice. |
missing_depot_pre_job_attributes |
Occurs when a job is assigned to a route that is missing a depot that has an attribute specified in required_pre_job_depot_attributes. See Routing with Attributes. |
missing_depot_post_job_attributes |
Occurs when a job is assigned to a route that is missing a depot that has an attribute specified in required_post_job_depot_attributes. See Routing with Attributes. |
route_response Violations
These violations occur when there is an issue with a route_response object. These violation typically occur when a route's constraint is violated.
violation_type | Description |
---|---|
route_over_max_working_time |
Occurs when a route's working_time is either longer than its max_working_time, or ends after its end_time. See Routing with Shifts. |
route_over_max_driving_time |
Occurs when a route's driving_time is longer than its max_driving_time. See Routing with Shifts. |
route_over_load_capacity |
Occurs when a route's load_capacity constraint is exceeded. See Routing with Capacities. |
route_over_max_jobs |
Occurs when a route's max_jobs_on_route constraint is exceeded. See Routing with Capacities. |
multiday_route_over_max_days |
Occurs when a driver's max_multiday_days constraint is exceeded. See Routing with Multi-day Routes. |
route_has_no_vehicle |
Occurs when a route has not been assigned a vehicle. Cannot occur if no vehicles have been supplied with the request. |
driver_not_using_preferred_vehicle |
Occurs when a route has not been assigned its driver's preferred vehicle. Cannot occur if no vehicles have been supplied with the request, or if the route does not have a driver. |
vehicle_depot_different_to_route_start_location |
Occurs when the start location of a route differs from the location specified for the route's vehicle. |
vehicle_depot_different_to_route_end_location |
Occurs when the end location of a route differs from the location specified for the route's vehicle. |
violation_data
The violation_data
type is a plain JSON object. Its fields vary between violation types, and its values are objects with the following format:
Name | Type | Description |
---|---|---|
numeric_data | float | Numeric data relating to the violation, if applicable. |
string_array_data | string[] | An array of string data relating to the violation, if applicable. |
string_data | string | String data relating to the violation, if applicable. |
time_data | timespan | Time data relating to the violation, if applicable. |
These objects usually have only one of the above fields defined at a time.
Example
{
"routes": [
{
"id": "route0",
"cost": 16.02,
"internal_cost": 124.26,
"distance_meters": 38810.0,
"working_time": "01:04:04",
"driving_time": "00:54:04",
"violations" [
{
"type": "route_over_max_working_time",
"data": {
"time_over_max_hours": {
"time_data": "00:04:04"
}
}
}
]
"stops": [
{
"location": "39.718005,-104.969531",
"type": "depot",
"arrival_datetime": "2016-01-18T09:00:00",
"time_on_site": "00:00:00",
"distance_to_meters": 0.0,
"time_to": "00:00:00"
},
{
"type": "job",
"id": "job1",
"arrival_datetime": "2016-01-18T09:26:58",
"time_on_site": "00:10:00",
"distance_to_meters": 19440.0,
"time_to": "00:26:58"
"violations" [
{
"type": "job_missed_time_window",
"data": {
"time_late": {
"time_data": "00:06:58"
}
}
},
{ "type": "job_delivered_on_disallowed_day" }
]
},
{
"location": "39.718005,-104.969531",
"type": "depot",
"arrival_datetime": "2016-01-18T10:04:04",
"time_on_site": "00:00:00",
"distance_to_meters": 19370.0,
"time_to": "00:27:06"
}
]
}
]
}
See Also
- The route_response.violations field.
- The stop_response.violations field.