| # Scheduling Optimizer API | |
| REST API and optional web UI for task/resource scheduling. The backend uses **OR-Tools** (CP-SAT) to compute an optimal or near-optimal schedule; the API accepts task and resource definitions and returns the schedule. | |
| ## Overview | |
| Designed for integration into planning tools: send a JSON payload with tasks (durations, dependencies, resources) and get back start times and assignments. A simple Streamlit or Gradio frontend is provided for manual try-out. | |
| ## Usage | |
| **API:** | |
| ```bash | |
| pip install -r requirements.txt | |
| uvicorn main:app --reload --host 0.0.0.0 --port 8000 | |
| ``` | |
| **Endpoints:** | |
| - `POST /schedule` β body: `{ "tasks": [ {"id": "A", "duration": 2}, {"id": "B", "duration": 1} ], "horizon": 10000 }` (horizon optional); response: `{ "schedule": [...], "makespan": N }`. | |
| - `GET /health` β health check. | |
| **UI (optional):** | |
| ```bash | |
| streamlit run app_ui.py | |
| ``` | |
| ## Files | |
| - `solver.py` β `solve_single_machine(tasks)` using OR-Tools CP-SAT (interval variables, NoOverlap, minimize makespan). | |
| - `main.py` β FastAPI app: `POST /schedule`, `GET /health`. | |
| - `app_ui.py` β Streamlit UI; expects the API at `http://localhost:8000` (or set `SCHEDULER_API_URL`). | |
| ## Limitations / future work | |
| - Single objective (makespan); could add due dates, priorities, or multi-resource skills. | |
| - Optional: Dockerfile for containerized deployment. | |
| ## Author | |
| **Alireza Aminzadeh** | |
| - Email: [alireza.aminzadeh@hotmail.com](mailto:alireza.aminzadeh@hotmail.com) | |
| - Hugging Face: [syeedalireza](https://huggingface.co/syeedalireza) | |
| - LinkedIn: [alirezaaminzadeh](https://www.linkedin.com/in/alirezaaminzadeh) | |