u-schedule
Scheduling framework in Rust
Overview
u-schedule provides domain models, constraints, validation, dispatching rules, and a greedy scheduler for scheduling problems. It builds on u-metaheur for metaheuristic algorithms and u-numflow for mathematical primitives.
Modules
| Module | Description |
|---|---|
models |
Domain types: Task, Activity, Resource, Schedule, Assignment, Calendar, Constraint, TransitionMatrix |
validation |
Input integrity checks: duplicate IDs, DAG cycle detection, resource reference validation |
dispatching |
Priority dispatching rules and rule engine |
scheduler |
Greedy scheduler and KPI evaluation |
ga |
GA-based scheduling with OSV/MAV dual-vector encoding |
cp |
CP-based scheduling formulation |
Dispatching Rules
| Rule | Description |
|---|---|
| SPT | Shortest Processing Time |
| LPT | Longest Processing Time |
| EDD | Earliest Due Date |
| FIFO | First In First Out |
| SLACK | Minimum Slack Time |
| CR | Critical Ratio |
| ATC | Apparent Tardiness Cost |
| WSPT | Weighted Shortest Processing Time |
| MWKR | Most Work Remaining |
| LWKR | Least Work Remaining |
| MOPNR | Most Operations Remaining |
| PRIORITY | Job Priority |
| RANDOM | Random Selection |
GA Encoding
The GA module uses dual-vector encoding for job-shop scheduling:
- OSV (Operation Sequence Vector) — Permutation encoding that determines operation processing order
- MAV (Machine Assignment Vector) — Integer vector that assigns each operation to a specific machine (for flexible job shops)
Quick Start
[]
= { = "https://github.com/iyulab/u-schedule" }
use ;
use validate_input;
use ;
// Define tasks with activities
let task = new
.with_activity; // 30 seconds
let resource = new;
// Validate input
let errors = validate_input;
assert!;
Build & Test
Academic References
- Pinedo (2016), Scheduling: Theory, Algorithms, and Systems
- Brucker (2007), Scheduling Algorithms
- Blazewicz et al. (2019), Handbook on Scheduling
- Haupt (1989), A Survey of Priority Rule-Based Scheduling
Dependencies
- u-metaheur — Metaheuristic algorithms (GA, SA, ALNS, CP)
- u-numflow — Mathematical primitives (statistics, RNG)
serde1.0 — Serializationrand0.9 — Random number generation
License
MIT License — see LICENSE.
WebAssembly / npm
Available as an npm package via wasm-pack.
Quick Start
import init from '@iyulab/u-schedule';
await ;
const result = ;
Functions
run_schedule(input) -> ScheduleOutput
Priority dispatching on a flat job list (single or parallel machines). Supports 12 rules: SPT, LPT, EDD, FCFS, CR, WSPT, MST, S/RO, ATC, LWKR, MWKR, PRIORITY.
Input:
Output:
Times are in seconds. machine_utilization is present only when num_machines > 1.
solve_jobshop(input) -> JobShopOutput
GA-based job-shop scheduling with multi-machine routing and precedence constraints.
Input:
Output:
Crossover types: "POX" | "LOX" | "JOX". Mutation types: "Swap" | "Insert" | "Invert".
GA config constraints:
| Parameter | Constraint | Default |
|---|---|---|
population_size |
>= 2 | 100 |
max_generations |
>= 1 | 200 |
mutation_rate |
0.0 -- 1.0 | 0.1 |
tardiness_weight |
0.0 -- 1.0 | 0.5 |
seed |
optional u64 | random |
Error handling: Invalid parameters return a JS error string (not a thrown exception). Check the return value:
try catch
Related
- u-numflow — Mathematical primitives
- u-metaheur — Metaheuristic optimization (GA, SA, ALNS, CP)
- u-geometry — Computational geometry
- u-nesting — 2D/3D nesting and bin packing