Time Windows
In this guide, we will introduce the concept of Time Windows
which provides more control on how tasks are assigned and completed.
While requesting a task, we can configure the pick-up or/and drop-off time. During dispatch optimization, the time windows will be treated as constraints that will never be violated. Time Windows are highly configurable and we can set both the earliest and latest time to pick up/drop off a resource. We can also schedule tasks using time windows.
Pick-up time window: While creating a task using the
CreateTask
endpoint of theTask API
, set theearliestTime
or/andlatestTime
ofrequiredPickupTimeWindow
field.Drop-off time window: Set the
earliestTime
or/andlatestTime
ofrequiredDropoffTimeWindow
field while creating a task to define when the drop off should happen.
Example
A passenger's meeting is ending at 11 am and has to attend another meeting at 11:30 am.
- Define the earliest pick up time as 11:00 am.
- Define the latest drop off time as 11:30 am.
A vehicle that can complete this task under the defined constraints will be assigned to it. Such a task will not be pooled with another task if it leads to the drop off time being after the drop-off time window.
curl --request POST https://api.rideos.ai/dispatch-tasks/v3/CreateTask \
--header "Content-Type: application/json" \
--header "X-Api-Key: $RIDEOS_API_KEY" \
--data '{"taskId":"task-1","fleetId":"fleet-test","taskDefinition":{"pickupDropoffTask":{"uniqueResourcePickup":{"pickupLocation":{"position":{"latitude":37.794682,"longitude":-122.41148}},"uniqueResource":{"requiredCapacities":[{"capacityType":"seats","value":2}],"metadata":{"data":{"rider-name":"Rider test 1","rider-phone":"123-4567","rider-url":"web.com"}}}},"dropoff":{"position":{"latitude":37.802372,"longitude":-122.418729}}},"dispatchParameters":{"requiredPickupTimeWindow":{"earliestTime":"2020-08-10T11:00:00Z"},"requiredDropoffTimeWindow":{"latestTime":"2020-08-10T11:30:00Z"}},"requestorId":"rider-1"}}'