This repository provides a Python-based MILP optimizer using PuLP for solving multistage batch production problems in a steel manufacturing setup with shared resources
A Mixed-Integer Linear Programming (MILP) optimizer for multistage batch production scheduling in a steel manufacturing environment, considering shared resources, cleaning changeovers, and storage limits
In Steel manufacturing environment, there are three major divisions:
- CRD (Cold Rolling Division)
- HRD (Hot Rolling Division)
- SPD (Special Product Division)
Each product must be scheduled and processed under various constraints like:
- Batch sizes
- Campaign cleaning restrictions
- Changeover cleaning time
- Intermediate storage capacity
- Demand fulfillment
- OTIF improvement
Steel manufacturing often involves batch operations across multiple stages with shared equipment and cleaning constraints. Improper sequencing leads to excessive downtime, batch waste, and late deliveries.
This MILP optimizer helps planners:
- Plan batches per division respecting minimum campaign sizes before cleaning is mandatory
- Sequence production runs to minimize costly changeovers
- Schedule production to meet customer demand and improve OTIF metrics
- Multi-stage production: CRD -> HRD -> SPD
- Max batch size = 15 units
- Variable batch sizes supported (especially for last batches)
- Campaign Logic = Minimum and maximum runs per product before cleaning
- Changeover times between different product runs
- Intermediate storage constraints between stages
- Demand fulfillment for each product
- Objective: Minimize total processing time while meeting demand and avoiding resource conflicts
- Minimize makespan
- Maximize throughput
- Meet product demand
- Respect all campaign constraints
- Improve OTIF (On Time In Full)
- x[p][s][t] ∈ {0,1}: Whether product p is scheduled at stage s at time t
- z[p][s][t] ∈ {0,15}: Actual batch size of product p at stage s, time t (0 if not active)
- start_time[b] - start time for batch 'b'
- batch_size[b] - batch size of batch 'b'
- assign[p, b] - binary variable to assign product p to batch b
- sequence[i, j]- binary variable to order batches (to model sequencing, '1' if 'b1' before 'b2')
- makespan - total time to finish all campaigns
- Demand per product 'D_p'
- Minimum and maximum campaign lengths per product 'min_campaign_p', 'max_campaign_p'
- Processing time per batch 'proc_time_p'
- Cleaning time for changeover from product 'i' to 'j' in a stage 'clean_time_stage[i][j]'
- Storage capacity limits between stages 'storage_max_stage'
- Batch size limits per product
- Time horizon 'H'
-
minimize Σ(processing_time[p][s] * x[p][s][t]
- Campaign run length between min_campaign[p] and max_campaign[p]
- Changeover time enforcement between product switches
- Storage buffer limits between stages
- Demand fulfillment using variable batch sizes
- Batch size z[p][s][t] linked to binary decision x[p][s][t]
- Python 3.13
- PuLP - Python Linear Programming API
- ChatGPT
- Perplexity Pro
- Knowledge on Manufacturing puzzles
- Basic idea on prompt engineering to get code scripts in AI interface
"When I wrote this code, only God and I understood what I did" - Shuaib Abdurahman