LeMur Scheduler is a Python-based optimization tool designed to solve scheduling problems using Google's OR-Tools CP-SAT solver. The project incorporates evolutionary algorithms (EAs) for refinement, focusing on job scheduling, machine assignments, and constraints like maintenance, operator availability, and production deadlines.
The solution supports both a graphical user interface (GUI) for managing inputs and outputs and a comprehensive backend for performing advanced optimization tasks.
- web_app/: Contains the Gradio-based web interface and essential logic.
app.py: The entry point for the web application.- Supporting Python files:
data_init.py: Handles data preprocessing and initialization.solver.py: Contains the main optimization solver logic. You can also play aroung with the solver by directly running this file.ga_refiner.py: Implements genetic algorithm-based refinement for schedules.ga_utils.py: Utility functions for evolutionary algorithms.utils.py: General helper functions.
- data/: Contains script to process the data provided from Lemur to generate the required input files and simulate orders.
- extras/: Additional files for testing, data pre-processing and performance benchmarking.
-
Optimization Goals:
- Minimize makespan while balancing workload.
- Optimize machine and operator utilization.
-
Constraint Handling:
- Machine compatibility.
- Shift and operator scheduling.
- Maintenance windows and holidays.
-
Evolutionary Algorithm Refinement:
- Genetic algorithm to refine solutions.
- Handles complex scenarios like overlapping operations.
-
Interactive GUI:
- Upload and edit CSV/JSON input files.
- Configure solver parameters.
- Visualize schedules as Gantt charts.
Install the required Python packages:
pip install ortools gradio matplotlib pandas plotly inspyred intervaltreeThe following input files are required:
new_orders.csv: Defines the list of jobs to be scheduled.lista_articoli.csv: Provides production statistics for each article.articoli_macchine.json: Defines the compatibility between articles and machines.macchine_info.json: Contains machine-specific details.
Run the following command to start the Gradio-based GUI while inside the web_app/ directory:
python app.py-
Upload Input Files:
- Upload and edit CSV/JSON files.
- Save modified data back to the appropriate files.
-
Configure Solver Parameters:
- Adjust scheduling horizon, shift times, and operator availability.
- Define costs for setup, loading, and unloading operations.
-
Run the Solver:
- Execute the scheduler and view outputs in real-time.
- Visualize results as Gantt charts.
new_orders.csv:- Format:
- cliente
- cod_articolo
- quantity
- data inserimento
- data consegna
- Example:
SCORTA, 4407DN, 472, 2025-04-20, 2025-08-06
- Format:
running_orders.csv:- Format: - cliente - macchina - cod_articolo - quantity - fine operazione attuale - data consegna - levate rimanenti ciclo - tipo operazione attuale - operatore
- Example:
SCORTA,1,2277DN mini,124.37,2024-12-01 03:30:00,2025-11-19,1,2,0,0
lista_articoli.csv:- Production data for each article:
- codarticolo
- kg_ora (for a macine with 256 fusi)
- no_cicli
- ore_levata
- Example:
10353ZF, 1.87, 2, 96.0
- Production data for each article:
articoli_macchine.json:- Compatibility between articles and machines.
- Example:
{ "2277DN mini": [1,2,4,25,70], }macchine_info.json:- Contains the
n_fusifor each machine. - Example:
{ "1": { "n_fusi": "392", }, }- Contains the
-
Schedules:
output/schedule.txt: Initial schedule.output/refined_schedule.txt: Refined schedule after GA optimization.
-
Visualizations:
- Gantt charts for visualizing machine schedules.
Configure the solver by adjusting the following:
- Time Units:
- Set time granularity (e.g., 24, 48, or 96 units per day).
- Operator Configuration:
- Define the number of operator groups and members per group.
- Costs:
- Adjust costs for setup, load, and unload phases.
- Define
broken_machines,scheduled_maintenances, andfestive_daysto customize scheduling constraints.
- Missing Files: Ensure all input files are available before running the solver.
- Empty Rows in CSVs: The GUI automatically removes empty rows from uploaded files.
-
Upload the following:
new_orders.csv(Job list).lista_articoli.csv(Article statistics).articoli_macchine.json(Compatibility data).macchine_info.json(Machine details).
-
Configure parameters:
- Set scheduling horizon and operator availability.
-
Run the solver:
- View results in the "Run Solver" tab.
This repository is created for LeMur for the Industrial AI challenge. Contributors:
- Davide Cavicchini
- Luca Cazzola
- Alessandro Lorenzi
- Emanuele Poiana
- Andrea Decarlo
- Silvano Maddonni