Weighted Completion Time with WSPT
WSPT algorithm
For single-machine jobs with objective , the classic dispatching rule is to process jobs in descending order of:
where:
- is job weight (priority),
- is processing time.
When all weights are equal, WSPT reduces to SPT.
API used in tilearn
- Main function:
tilearn.wspt - Supporting helper:
tilearn.factor_data
Input format
Each row follows:
[name, p, r, d, w]
Example:
jobs = [
["J1", 2.0, 0, 8, 4.0],
["J2", 1.0, 0, 5, 1.0],
["J3", 3.0, 0, 6, 6.0],
]
Minimal runnable example
import tilearn as tl
jobs = [
["J1", 2.0, 0, 8, 4.0],
["J2", 1.0, 0, 5, 1.0],
["J3", 3.0, 0, 6, 6.0],
]
ranked = tl.wspt(jobs)
for row in ranked:
print(row)
Output shape:
[name, p, r, d, w, factor]
The appended factor column is w/p, and rows are sorted in descending
factor order.
Practical notes
wsptmutates the input table in-place.- Calling it repeatedly on the same data may append additional factor columns.
- Use a copy when you need to preserve original rows:
safe_jobs = [row[:] for row in jobs]
ranked = tl.wspt(safe_jobs)
Related topics
- Due-date-first strategy: EDD
- Full API details: Sorting module