Pinned Assignments
Why Does Pinned Assignments Matter?
Rout Optimizers are built to make cost-effective assignments across the fleet. However, sometimes when the business requires specific pairing between a task and a vehicle (eg: a contractual commitment to a client) leaving them to the optimizer's discretion is not acceptable. In such situations, operators rely on fragile workarounds (pre-assigning tasks, narrowing time windows etc) which can silently fail to honor real world constraints.
The Route Optimization API's Pinned Assignment feature provides a direct solution. By defining a relations.type: pinned, you can specify the tasks and the vehicle they must be assigned to. The optimizer then treats this as a non-negotiable assignment criteria: either the pinned tasks are assigned to the designated vehicle, or the entire optimization request fails.
Use Case: Field Service Technician-Task Pairing
A field service company dispatches two technicians from a shared depot in Los Angeles to handle six service jobs across the city. Each job involves an equipment pickup from a customer site. Two of the six jobs - Job 1 and Job 3 - requires a specialist certification that only Technician 2 holds. As a result, the operations team has a contractual obligation to ensure these jobs are handled by Technician 2. If Technician 2 cannot complete them due to any other reason, the operators need to know immediately so they can reschedule, and not discover the problem after the fact from a misleading route plan.
The dispatch team wants the optimizer to:
- Guarantee Job 1 and Job 3 are assigned to Technician 2, without exception.
- Assign the remaining four jobs (2, 4, 5, 6) freely across both technicians based on routing efficiency.
- Fail the entire request immediately if Technician 2 cannot fulfil the pinned jobs.
Pinned Assignments feature delivers all three of these requirements simultaneously.
How Pinned Assignments work?
Pinned Assignments is a hard constraint which is configured by setting relations.type: pinned and specifying a relations.vehicle to complete the pinned relations.steps. It guarantees the assignment of pinned tasks. It is worth highlighting that non-pinned tasks in the same request are still assigned freely by the optimizer. The pinned relation constrains only the designated steps on the designated vehicle and everything else is optimised normally.
Following are some more rules that govern the feature:
- Specifying the vehicle is mandatory: A pinned relation without a vehicle field is invalid and will return an error.
- Steps cannot belong to multiple relations: A step included in a pinned relation cannot also appear in any other
relations.type. - Pinning does not enforce sequence: Pinned steps are guaranteed to be assigned to the designated vehicle, but the optimizer decides the order in which they are served.
- Cost and penalty overrides: The pin takes absolute precedence over all optimisation objectives and the optimizer cannot leave pinned steps unassigned.
There is no partial success for pinned steps If any pinned step cannot be assigned to its designated vehicle, the entire optimization request fails. Hence, verify carefully the designated vehicle's capacity, time window, and physical reach before submitting.
Configuring the Feature: Input Parameters
Pinned Assignment is configured entirely within the top-level relations array of the request. The table below summarises all required fields:
| Parameter | Type / Location | Description |
|---|---|---|
relations[].type | string (relation) | Set to "pinned" to activate the Pinned Assignment type. |
relations[].vehicle | string | integer (relation) | The ID of the vehicle to which the steps must be assigned. Mandatory when type is "pinned". |
relations[].steps | array of objects (relation) | The list of tasks to pin to the specified vehicle. Each step object contains a type ("job", "pickup", "delivery") and the corresponding task ID. |
Pin all related steps in a single relation: If multiple steps must go to the same vehicle, it is recommended to include all of them in a single pinned relation rather than creating separate relations per step.
Example API Request & Response
Example API Request
The request below sets up two technicians, six pickup jobs, and a single pinned relation that locks Job 1 and Job 3 to Technician 2:
Example API Response
The condensed response below shows routes for both technicians. All 6 jobs are assigned (unassigned: 0). Inline comments confirm which steps are pinned and which are freely assigned:
Interpreting the Output
To verify a pinned relation in the response, check the route for the designated vehicle and confirm that all pinned steps appear in its steps array. If the request succeeded, all pinned steps are guaranteed to be on the designated vehicle.
The table below shows the complete assignment across both technicians:
| Vehicle | Stop | Pinned? |
|---|---|---|
| Technician 1 | Job 5 | No |
| Technician 1 | Job 6 | No |
| Technician 1 | Job 2 | No |
| Technician 2 | Job 1 | ✅ Yes |
| Technician 2 | Job 4 | No |
| Technician 2 | Job 3 | ✅ Yes |
Technician 1 Analysis
Route: Depot → Job 5 → Job 6 → Job 2 → End
- All three jobs are freely assigned since there were no pinned constraint for Technician 1.
- Neither Job 1 nor Job 3 appears on Technician 1's route, meaning the optimizer successfully prevents their assignment to the wrong vehicle.
Technician 2 Analysis
Route: Depot → Job 1 → Job 4 → Job 3 → End
- Job 1 (pinned) appears as the first stop as part of guaranteed assignment for Technician 2.
- Job 4 is a freely assigned job that the optimizer interleaved between the two pinned steps. Its placement between Job 1 and Job 3 is purely route-efficiency driven
- Job 3 (pinned) appears as the third stop as part of guaranteed assignment for Technician 2.
What We Learned
This example illustrates several important takeaways about how Pinned Assignments behaves in practice:
- Pinning guarantees assignment: This is the defining characteristic that separates a pinned assignment relation from other relation types. Use it when partial success is operationally unacceptable (contractual obligations, certified technician requirements etc).
- Pinning controls vehicle assignment, not stop sequence: The optimizer remains free to determine when and in what order pinned steps are served on the designated vehicle. Job 4, an unpinned task, was interleaved between Job 1 and Job 3 on Technician 2's route.
- Pinned vehicles can receive freely assigned tasks: Pinning a set of
stepsdoes not lock the vehicle to only those steps. The optimizer can assign non-pinned tasks if it is efficient to do so.
Explore other powerful features that the NextBillion.ai’s Route Optimization API can solve seamlessly.