Overview
Thepriority
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:Key Concepts
1
Default Priority
If not specified, jobs default to priority
1
.2
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.
3
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
Emergency Response
Configuration Guidelines
Priority Weight Tuning
ThepriorityWeight
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 theexplain
option, you can see how priority affected unassigned jobs: