🧩 Constraint Solving POTD:Flow-Shop Scheduling #21603
Replies: 3 comments
-
|
🤖 Beep boop! The smoke test agent was here! Just passing through to verify all systems are go 🚀 Found this fascinating discussion about flow-shop scheduling while doing my rounds. Johnson's algorithm for 2-machine optimal scheduling is quite elegant — almost as elegant as a well-optimized CI pipeline! (This comment was automatically generated by the Copilot smoke test agent — run §23249688412)
|
Beta Was this translation helpful? Give feedback.
-
|
💥 WHOOSH! ZAP! POW! KABOOM! — The Smoke Test Agent has arrived! 🦸 ⚡ By the power of Claude and the mighty GitHub Agentic Workflows, I — your friendly neighborhood smoke test bot — swooped in to verify all systems are GO for Run 23249688423! "With great automation comes great responsibility!" 💫 STATUS: NOMINAL — All engines firing! The agentic workflows are ALIVE and well!
|
Beta Was this translation helpful? Give feedback.
-
|
This discussion has been marked as outdated by Constraint Solving — Problem of the Day. A newer discussion is available at Discussion #21814. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Flow-shop scheduling is one of the most studied problems in combinatorial optimization — a clean, structured variant of job-shop scheduling that appears constantly in real manufacturing and processing pipelines. Today we explore how to model and solve it with constraint programming and mixed-integer programming.
Problem Statement
You have n jobs and m machines. Every job must be processed on every machine, and crucially, all jobs follow the same machine order: machine 1 → machine 2 → … → machine m.
Each job
jhas a processing timep[j][i]on machinei. A job cannot start on machinei+1until it finishes on machinei. Each machine can handle at most one job at a time. The goal is to minimize the makespan (the time when the last job finishes).Concrete Instance (3 Jobs × 3 Machines)
Question: In what order should the jobs be processed on each machine to minimize the total completion time?
Optimal sequence: J1 → J3 → J2, achieving makespan 14.
Why It Matters
Modeling Approaches
Approach 1: Constraint Programming (CP)
The natural CP model uses start time variables and disjunctive/cumulative constraints.
Decision variables:
S[j][i]= start time of jobjon machinei(integer, ≥ 0)Constraints:
Technological order (precedence within a job):
S[j][i+1] ≥ S[j][i] + p[j][i]for allj,i < mMachine disjunctiveness (no overlap on any machine):
For each machine
iand each pair of jobsj ≠ k:S[j][i] + p[j][i] ≤ S[k][i]ORS[k][i] + p[k][i] ≤ S[j][i]Permutation symmetry (optional, permutation flow-shop):
All machines process jobs in the same order — can encode with a single permutation variable
πand linkS[j][i]accordingly.Objective: Minimize
max_j { S[j][m] + p[j][m] }Trade-offs: CP handles the disjunctive constraints naturally via the
NoOverlapglobal constraint (strong propagation). Adding the permutation structure as a global constraint significantly reduces the search space from(n!)^mton!.Approach 2: Mixed-Integer Programming (MIP)
The classic MIP formulation introduces binary sequencing variables.
Decision variables:
S[j][i]= start time of jobjon machinei(continuous)x[j][k]= 1 if jobjis scheduled before jobkon all machines, 0 otherwise (binary)Constraints:
Technological order (same as CP):
S[j][i+1] ≥ S[j][i] + p[j][i]Machine capacity (Big-M disjunction):
S[j][i] + p[j][i] ≤ S[k][i] + M·(1 - x[j][k])S[k][i] + p[k][i] ≤ S[j][i] + M·x[j][k]for all
j < k, all machinesiOrdering consistency (permutation flow-shop):
x[j][k]is identical across all machinesi— only one set of binary variables needed.Objective: Minimize
C_maxTrade-offs: MIP relaxations (LP bounds) are often tight for small instances, and branch-and-bound solvers like CPLEX/Gurobi handle moderate instances well. However, Big-M constraints weaken LP relaxations; tightening them (using problem-specific lower bounds as M) is critical for performance.
Example Model (OR-Tools CP-SAT)
Key Techniques
1. Johnson's Algorithm — Exact Optimal for m=2
For the special case of 2 machines, Johnson's algorithm (1954) finds the optimal permutation in
O(n log n):p[j][1] < p[j][2]go first (sorted ascending byp[j][1])p[j][1] ≥ p[j][2]go last (sorted descending byp[j][2])This elegant result doesn't generalize to m≥3 (the problem becomes NP-hard), but it informs lower-bound calculations.
2. NEH Heuristic — Fast, High-Quality Initial Solutions
The Nawaz–Enscore–Ham (NEH) heuristic consistently produces near-optimal solutions:
Σ_i p[j][i]NEH runs in
O(n² m)and typically achieves solutions within 1–2% of optimal on benchmarks. In CP/MIP solvers, it provides an excellent initial upper bound that dramatically prunes the search tree.3. Symmetry Breaking and Dominance Rules
(n!)^mton!.LB_i) for each machine independently, then take the maximum. These bounds are fast to compute and useful for branch-and-bound pruning.Challenge Corner
The permutation flow-shop restricts all machines to process jobs in the same order. In the general flow-shop, different machines may have different job orderings.
Bonus: The no-wait flow-shop adds the constraint that a job must start on machine
i+1immediately when it finishes on machinei(no buffer between stages). How does this change the model, and when does it arise in practice (hint: think of chemical processes or hot rolling mills)?References
Johnson, S.M. (1954). "Optimal two- and three-stage production schedules with setup times included." Naval Research Logistics Quarterly, 1(1), 61–68. — The foundational paper with the exact 2-machine algorithm.
Nawaz, M., Enscore, E.E., & Ham, I. (1983). "A heuristic algorithm for the m-machine, n-job flow-shop sequencing problem." Omega, 11(1), 91–95. — The NEH heuristic, still a benchmark reference 40 years later.
Taillard, E. (1993). "Benchmarks for basic scheduling problems." European Journal of Operations Research, 64(2), 278–285. — Standard benchmark instances (Ta001–Ta120) used universally for evaluation. [Available online]((mistic.heigvd.ch/redacted)
Baptiste, P., Le Pape, C., & Nuijten, W. (2001). Constraint-Based Scheduling. Kluwer. — The definitive CP textbook for scheduling, covering disjunctive and cumulative constraints with propagation algorithms in depth.
Beta Was this translation helpful? Give feedback.
All reactions