Job Priority
Control job importance to ensure critical tasks are scheduled first
Overview
The priority
field on jobs allows you to influence which jobs are more likely to be included in the final schedule when not all jobs can be served. This is particularly useful in overconstrained scenarios where you have more work than available resources.
Priority affects whether a job gets scheduled, not when it gets scheduled. Use time windows to control scheduling order.
How Priority Works
When the VRP solver evaluates solutions, unassigned jobs generate penalty scores. The penalty for each unserved job is calculated as:
Higher penalties make the solver work harder to include those jobs in the schedule, effectively prioritizing them over jobs with lower penalties.
Key Concepts
Default Priority
If not specified, jobs default to priority 1
.
Priority Multiplication
The priority value is multiplied by the job’s duration, meaning longer high-priority jobs have an even stronger influence on scheduling decisions.
Weight Configuration
The global priorityWeight
parameter in the request weights controls how strongly priority influences the solution.
Basic Example
Complete Job Example
Here’s a complete job example showing all available fields:
The name
field is the only required field for a job. All other fields, including priority
, are optional.
Advanced Usage
Combining with Partial Planning
Priority works seamlessly with partial planning to handle overconstrained problems:
Priority Strategies
Configuration Guidelines
Priority Weight Tuning
The priorityWeight
parameter controls how strongly priority influences the solution:
Low Weight (1-10)
Low Weight (1-10)
Priority has minimal impact. The solver focuses more on efficiency metrics like travel time and workload balance.
Medium Weight (10-100)
Medium Weight (10-100)
Priority significantly influences job selection while still considering other optimization goals.
High Weight (100-1000)
High Weight (100-1000)
Priority becomes dominant. High-priority jobs will almost always be scheduled before lower-priority ones.
Best Practices
Setting all jobs to the same high priority defeats the purpose. Use priority to create meaningful differentiation between job importance levels.
For jobs that must be completed, consider using hard constraints (like time windows) instead of relying solely on priority.
Understanding the Results
When using the explain
option, you can see how priority affected unassigned jobs:
Common Use Cases
1. Service Level Agreements
Ensure SLA-critical jobs are prioritized:
2. Emergency Services
Handle emergency requests alongside scheduled work:
3. Maximize Revenue
Prioritize high-value opportunities: