# 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)