Consolidate Jobs By Job Restrictions
POST
https://routecloud.telogis.com/v1/consolidate_by_job_restrictions.- Authentication required.
- Request body: consolidate_request.
- Response body: If
wait=1
specified, returns the task result (see below). Otherwise, returns a task_redirect_response. - Task result: If return_request is
true
, returns a problem. Otherwise, returns a consolidate_response.
The consolidate jobs by job restrictions call combines jobs that can be serviced sequentially on the same road into single pairs of linked jobs - see Routing with Linked Stops. The consolidate request is useful to reduce the number of jobs when working with Dense Routing problems.
Jobs appearing sequentially on a road are eligible to be consolidated if there is no difference in any of their properties that could have an effect on which routes or vehicles could service them. The properties that affect jobs' ability to be consolidated are:
- job.time_window
- job.time_window2
- job.required_driver
- job.forbidden_drivers
- job.required_route_attributes
- job.disallowed_route_attributes
- job.required_driver_attributes
- job.disallowed_driver_attributes
- job.required_vehicle_attributes
- All properties related to allowed dates and days of the week; see Routing with Dates.
This endpoint takes a conservative approach, assuming that any difference in these properties could result in jobs potentially needing to be serviced on different routes, to ensure that in subsequent optimization tasks the jobs are not forced to be serviced together. If the exact routes and vehicles to be used in optimization are known ahead of time, the consolidate_by_route_assignments call can be used to produce a more accurate consolidation.
Query Parameters
wait=1
- Optional. Wait until theconsolidate
completes before returning the result. See Retrieving API Results.
Static Codes
200
- Success.302
- Ifwait=1
was provided and theconsolidate
result is not yet available, a redirect is sent instead of a normal result every 15 seconds to refresh the HTTP timeout. See Retrieving API Results.400
- The input problem is invalid. The response is an error_response.401
- Authentication required.429
- Exceeded usage limits.
consolidate_request
The consolidate_request
type inherits all fields from problem.
Name | Type | Description |
---|---|---|
custom | custom | Inherited. User-supplied custom fields that are returned unmodified in the response. These have no effect on optimization. |
drivers | driver[] | Inherited. If specified, the drivers involved in this problem. |
id | string | Inherited. An identifier for the request. See Request IDs. |
jobs | job[] | Inherited. The jobs to be consolidated. |
markers | marker[] | Inherited. The markers involved in this problem. If defined here, markers can be referenced by id elsewhere; for example, job.location. |
name | string | Inherited. A name for the request. See Request IDs. |
return_request | boolean | Optional. Defines if the original request, with calculated values, is returned as the response. If not, a Consolidate Response is returned. See Full vs Partial Responses. Defaults to false . |
schedules | schedule[] | Inherited. If specified, applies recurring schedule constraints to the jobs. |
settings | settings | Inherited. The settings to apply during the request. May have an effect on which routes a given job can be assigned to. |
{
"id": "request+1234567",
"name": "territory1",
"jobs": [
{ "id": "j0", "time_on_site": "00:10:00", "location": "-43.522104,172.628666" },
{ "id": "j1", "time_on_site": "00:15:00", "location": "-43.521410,172.628275" },
{ "id": "j2", "time_on_site": "00:05:00", "location": "-43.523581,172.629652" },
{ "id": "j3", "time_on_site": "00:10:00", "location": "-43.521539,172.626993" },
{ "id": "j4", "time_on_site": "00:08:00", "location": "-43.522608,172.628360" },
{ "id": "j5", "time_on_site": "00:12:00", "location": "-43.521275,172.628567" },
{ "id": "j6", "time_on_site": "00:04:30", "location": "-43.521629,172.628293" },
{ "id": "j7", "time_on_site": "00:10:00", "location": "-43.522254,172.627531" },
{ "id": "j8", "time_on_site": "00:07:30", "location": "-43.522878,172.629221" },
{ "id": "j9", "time_on_site": "00:02:30", "location": "-43.521803,172.628931" }
]
}
An example consolidate request.
consolidate_response
The consolidate_response
contains a list of consolidated jobs, representing sequences of jobs in the request that can be completed sequentially.
Name | Type | Description |
---|---|---|
consolidated_jobs | job[] | The consolidated jobs. Any jobs that could not be consolidated will be returned unmodified, while consolidated sequences will be reduced to a single job with its location and exit_location set to the locations of the first and last job of the sequence, respectively, as well as a custom field named "inner_jobs" containing a list of ids of the jobs participating in this sequence. |
custom | custom | Inherited. User-supplied custom fields that were sent in the request. |
{
"consolidated_jobs": [
{ "id": "j4", "time_on_site": "00:08:00", "location": "-43.522608,172.628360" },
{
"id": "87b8523b-bb1e-46f1-9ed3-1b36ef9ce882",
"time_on_site": "00:20:00",
"location": "-43.522254,172.627531",
"exit_location": "-43.521539,172.626993",
"custom": {
"inner_jobs": "['j7','j3']"
}
},
{
"id": "e6ef0d13-21e7-428d-9608-faa77d027dd8",
"time_on_site": "00:29:30",
"location": "-43.522104,172.628666",
"exit_location": "-43.521410,172.628275",
"custom": {
"inner_jobs": "['j0','j6','j1']"
}
},
{
"id": "024d31fc-7fae-4098-98ed-44c1296d1b29",
"time_on_site": "00:14:30",
"location": "-43.521275,172.628567",
"exit_location": "-43.521803,172.628931",
"custom": {
"inner_jobs": "['j5','j9']"
}
},
{
"id": "d9ad393a-383f-4a60-b687-492f2370701c",
"time_on_site": "00:12:30",
"location": "-43.523581,172.629652",
"exit_location": "-43.522878,172.629221",
"custom": {
"inner_jobs": "['j2','j8']"
}
}
]
}
An example consolidate response.