File size: 1,680 Bytes
7a0a17c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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)