{"id":51953460,"url":"https://github.com/iyulab/u-schedule","last_synced_at":"2026-07-29T08:30:30.513Z","repository":{"id":337351800,"uuid":"1151886865","full_name":"iyulab/u-schedule","owner":"iyulab","description":"Rust scheduling framework combining dispatching rules, genetic algorithms, constraint programming, and greedy solvers for job-shop and resource-constrained scheduling problems.","archived":false,"fork":false,"pushed_at":"2026-07-18T19:49:23.000Z","size":207,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-18T21:27:05.625Z","etag":null,"topics":["constraint-programming","genetic-algorithm","job-shop","operations-research","rust","scheduling"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iyulab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-07T03:13:27.000Z","updated_at":"2026-07-18T19:49:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/iyulab/u-schedule","commit_stats":null,"previous_names":["iyulab/u-schedule"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iyulab/u-schedule","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyulab%2Fu-schedule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyulab%2Fu-schedule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyulab%2Fu-schedule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyulab%2Fu-schedule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iyulab","download_url":"https://codeload.github.com/iyulab/u-schedule/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iyulab%2Fu-schedule/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36025376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-29T02:00:04.910Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["constraint-programming","genetic-algorithm","job-shop","operations-research","rust","scheduling"],"created_at":"2026-07-29T08:30:29.189Z","updated_at":"2026-07-29T08:30:30.506Z","avatar_url":"https://github.com/iyulab.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# u-schedule\n\n**Scheduling framework in Rust**\n\n[![Crates.io](https://img.shields.io/crates/v/u-schedule.svg)](https://crates.io/crates/u-schedule)\n[![docs.rs](https://docs.rs/u-schedule/badge.svg)](https://docs.rs/u-schedule)\n[![CI](https://github.com/iyulab/u-schedule/actions/workflows/ci.yml/badge.svg)](https://github.com/iyulab/u-schedule/actions/workflows/ci.yml)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n## Overview\n\nu-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.\n\n## Modules\n\n| Module | Description |\n|--------|-------------|\n| `models` | Domain types: `Task`, `Activity`, `Resource`, `Schedule`, `Assignment`, `Calendar`, `Constraint`, `TransitionMatrix` |\n| `validation` | Input integrity checks: duplicate IDs, DAG cycle detection, resource reference validation |\n| `dispatching` | Priority dispatching rules and rule engine |\n| `scheduler` | Greedy scheduler and KPI evaluation |\n| `ga` | GA-based scheduling with OSV/MAV dual-vector encoding |\n| `cp` | CP-based scheduling formulation |\n\n## Dispatching Rules\n\n| Rule | Description |\n|------|-------------|\n| SPT | Shortest Processing Time |\n| LPT | Longest Processing Time |\n| EDD | Earliest Due Date |\n| FIFO | First In First Out |\n| SLACK | Minimum Slack Time |\n| CR | Critical Ratio |\n| ATC | Apparent Tardiness Cost |\n| WSPT | Weighted Shortest Processing Time |\n| MWKR | Most Work Remaining |\n| LWKR | Least Work Remaining |\n| MOPNR | Most Operations Remaining |\n| PRIORITY | Job Priority |\n| RANDOM | Random Selection |\n\n## GA Encoding\n\nThe GA module uses dual-vector encoding for job-shop scheduling:\n\n- **OSV (Operation Sequence Vector)** — Permutation encoding that determines operation processing order\n- **MAV (Machine Assignment Vector)** — Integer vector that assigns each operation to a specific machine (for flexible job shops)\n\n## Quick Start\n\n```toml\n[dependencies]\nu-schedule = { git = \"https://github.com/iyulab/u-schedule\" }\n```\n\n```rust\nuse u_schedule::models::{Task, Activity, Resource};\nuse u_schedule::validation::validate_input;\nuse u_schedule::dispatching::{DispatchingEngine, Rule};\n\n// Define tasks with activities\nlet task = Task::new(\"T1\")\n    .with_activity(Activity::new(\"A1\", 30_000)); // 30 seconds\n\nlet resource = Resource::new(\"R1\", \"Machine 1\");\n\n// Validate input\nlet errors = validate_input(\u0026[task], \u0026[resource]);\nassert!(errors.is_empty());\n```\n\n## Build \u0026 Test\n\n```bash\ncargo build\ncargo test\n```\n\n## Academic References\n\n- Pinedo (2016), *Scheduling: Theory, Algorithms, and Systems*\n- Brucker (2007), *Scheduling Algorithms*\n- Blazewicz et al. (2019), *Handbook on Scheduling*\n- Haupt (1989), *A Survey of Priority Rule-Based Scheduling*\n\n## Dependencies\n\n- [u-metaheur](https://github.com/iyulab/u-metaheur) — Metaheuristic algorithms (GA, SA, ALNS, CP)\n- [u-numflow](https://github.com/iyulab/u-numflow) — Mathematical primitives (statistics, RNG)\n- `serde` 1.0 — Serialization\n- `rand` 0.9 — Random number generation\n\n## License\n\nMIT License — see [LICENSE](LICENSE).\n\n## WebAssembly / npm\n\nAvailable as an npm package via [wasm-pack](https://rustwasm.github.io/wasm-pack/).\n\n```bash\nnpm install @iyulab/u-schedule\n```\n\n### Quick Start\n\n```javascript\nimport init, { run_schedule, solve_jobshop } from '@iyulab/u-schedule';\n\nawait init();\nconst result = run_schedule({\n  jobs: [\n    { id: \"A\", processing_time: 5.0, due_date: 10.0 },\n    { id: \"B\", processing_time: 3.0, due_date: 8.0 },\n  ],\n  config: { rule: \"EDD\" }\n});\n```\n\n### Functions\n\n#### `run_schedule(input) -\u003e ScheduleOutput`\n\nPriority 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.\n\n**Input:**\n```json\n{\n  \"jobs\": [\n    { \"id\": \"A\", \"processing_time\": 5.0, \"due_date\": 10.0, \"release_time\": 0.0, \"weight\": 1.0 }\n  ],\n  \"config\": { \"rule\": \"SPT\", \"num_machines\": 1, \"atc_k\": 2.0 }\n}\n```\n\n**Output:**\n```json\n{\n  \"schedule\": [{ \"id\": \"A\", \"start\": 0.0, \"end\": 5.0, \"tardiness\": 0.0, \"machine\": 0 }],\n  \"makespan\": 5.0,\n  \"total_tardiness\": 0.0,\n  \"machine_utilization\": [{ \"machine\": 0, \"busy_time\": 5.0, \"utilization\": 1.0 }]\n}\n```\n\nTimes are in seconds. `machine_utilization` is present only when `num_machines \u003e 1`.\n\n#### `solve_jobshop(input) -\u003e JobShopOutput`\n\nGA-based job-shop scheduling with multi-machine routing and precedence constraints.\n\n**Input:**\n```json\n{\n  \"jobs\": [\n    {\n      \"id\": \"J1\",\n      \"operations\": [\n        { \"machine\": \"M1\", \"processing_time\": 3.0 },\n        { \"machines\": [\"M2\", \"M3\"], \"processing_time\": 2.0 }\n      ],\n      \"due_date\": 15.0\n    }\n  ],\n  \"num_machines\": 3,\n  \"ga_config\": {\n    \"population_size\": 100, \"max_generations\": 200,\n    \"mutation_rate\": 0.1, \"seed\": 42,\n    \"tardiness_weight\": 0.5,\n    \"crossover\": \"POX\", \"mutation\": \"Swap\"\n  }\n}\n```\n\n**Output:**\n```json\n{\n  \"schedule\": [{ \"job_id\": \"J1\", \"operation\": 1, \"machine\": \"M1\", \"start\": 0.0, \"end\": 3.0 }],\n  \"makespan\": 5.0,\n  \"fitness\": 5.0,\n  \"generations\": 200,\n  \"fitness_history\": [10.0, 8.0, 5.0]\n}\n```\n\nCrossover types: `\"POX\"` | `\"LOX\"` | `\"JOX\"`. Mutation types: `\"Swap\"` | `\"Insert\"` | `\"Invert\"`.\n\n**GA config constraints:**\n\n| Parameter | Constraint | Default |\n|-----------|-----------|---------|\n| `population_size` | \u003e= 2 | 100 |\n| `max_generations` | \u003e= 1 | 200 |\n| `mutation_rate` | 0.0 -- 1.0 | 0.1 |\n| `tardiness_weight` | 0.0 -- 1.0 | 0.5 |\n| `seed` | optional u64 | random |\n\n**Error handling:** Invalid parameters return a JS error string (not a thrown exception). Check the return value:\n\n```javascript\ntry {\n  const result = solve_jobshop({ jobs: [...], ga_config: { population_size: 0 } });\n} catch (e) {\n  console.error(\"Scheduling error:\", e); // \"ga_config.population_size must be \u003e= 2, got 0\"\n}\n```\n\n## npm (WebAssembly)\n\n```bash\nnpm install @iyulab/u-schedule\n```\n\nThe package resolves per environment via a conditional `exports` map:\n\n| Environment | Entry |\n|---|---|\n| Bundlers (webpack, Vite, …) | ESM + WebAssembly ESM-integration (`default` condition) |\n| Node.js — `require()`, ESM `import`, CJS TS runners (`tsx`, `ts-node`) | CJS glue loading the wasm from the filesystem (`node` condition) — no loader hooks or flags |\n\n## Related\n\n- [u-numflow](https://github.com/iyulab/u-numflow) — Mathematical primitives\n- [u-metaheur](https://github.com/iyulab/u-metaheur) — Metaheuristic optimization (GA, SA, ALNS, CP)\n- [u-geometry](https://github.com/iyulab/u-geometry) — Computational geometry\n- [u-nesting](https://github.com/iyulab/U-Nesting) — 2D/3D nesting and bin packing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiyulab%2Fu-schedule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiyulab%2Fu-schedule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiyulab%2Fu-schedule/lists"}