Three-machine flow shop scheduling
AbbreviationFlow-shop instances#✓fully proved
A flow-shop instance is a pair consisting of a finite list of jobs, each a finite list of natural numbers (its processing times on machines 1, 2 and 3, in that order), and a natural number \(D\), the deadline. The type does not force a job to have exactly three entries; that is part of well-formedness.
DefinitionWell-formed flow-shop instances#✓fully proved
A flow-shop instance is well formed when every job in it is a list of exactly three natural numbers.
def WellFormed (i : FlowShopInstance) : Prop :=
∀ job ∈ i.1, job.length = 3
abbrev FlowShopInstance := List (List ℕ) × ℕ
WantedExt/Complexity/NPComplete/FlowShopWanted.lean:50
Uses 1 · Used by 1
DefinitionFeasible flow-shop schedules#✓fully proved
Let an instance consist of jobs \(1, \dots, n\), where job \(j\) is a list of natural numbers whose \(k\)-th entry \(p_{j,k}\) is its processing time on machine \(k\) (read as \(0\) if the list has fewer than \(k\) entries), and a deadline \(D\). The instance is feasible when there are natural numbers \(s_{j,k}\), for each job \(j\) and each \(k \in \{1, 2, 3\}\), such that for every job \(j\) we have \(s_{j,1} + p_{j,1} \le s_{j,2}\), \(s_{j,2} + p_{j,2} \le s_{j,3}\) and \(s_{j,3} + p_{j,3} \le D\), and for every machine \(k \in \{1, 2, 3\}\) and all jobs \(a < b\) we have \(s_{a,k} + p_{a,k} \le s_{b,k}\) or \(s_{b,k} + p_{b,k} \le s_{a,k}\).
Here \(s_{j,k}\) is the start time of job \(j\) on machine \(k\): each job visits machines 1, 2, 3 in that order, no machine processes two jobs at once, and every job finishes by \(D\).
def FlowShopFeasible
(i : FlowShopInstance) : Prop :=
∃ start : List (List ℕ), start.length = i.1.length ∧
(∀ row ∈ start, row.length = 3) ∧
(∀ j < i.1.length, (start.getD j []).getD 0 0 + (i.1.getD j []).getD 0 0 ≤
(start.getD j []).getD 1 0 ∧
(start.getD j []).getD 1 0 + (i.1.getD j []).getD 1 0 ≤
(start.getD j []).getD 2 0 ∧
(start.getD j []).getD 2 0 + (i.1.getD j []).getD 2 0 ≤ i.2) ∧
∀ k < 3, ∀ a < i.1.length, ∀ b < i.1.length, a < b →
(start.getD a []).getD k 0 + (i.1.getD a []).getD k 0 ≤
(start.getD b []).getD k 0 ∨
(start.getD b []).getD k 0 + (i.1.getD b []).getD k 0 ≤
(start.getD a []).getD k 0
abbrev FlowShopInstance := List (List ℕ) × ℕ
WantedExt/Complexity/NPComplete/FlowShopWanted.lean:50
Uses 1 · Used by 1
DefinitionThe 3-machine flow shop scheduling decision problem#✓fully proved
The decision problem 3-MACHINE FLOW SHOP SCHEDULING accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding of flow-shop instances, to an instance that is well formed and feasible. Bitstrings that do not decode to an instance are rejected.
noncomputable def flowShopDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := FlowShopInstance) x with
| some i => decide (WellFormed i ∧ FlowShopFeasible i)
| none => false
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def bitDecode [BitstringEncoding α] (l : List Bool) : Option α := toEncoding.decode l
MathlibExt/Computability/Complexity.lean:58
abbrev FlowShopInstance := List (List ℕ) × ℕ
WantedExt/Complexity/NPComplete/FlowShopWanted.lean:50
def WellFormed (i : FlowShopInstance) : Prop :=
∀ job ∈ i.1, job.length = 3
WantedExt/Complexity/NPComplete/FlowShopWanted.lean:53
def FlowShopFeasible
(i : FlowShopInstance) : Prop :=
∃ start : List (List ℕ), start.length = i.1.length ∧
(∀ row ∈ start, row.length = 3) ∧
(∀ j < i.1.length, (start.getD j []).getD 0 0 + (i.1.getD j []).getD 0 0 ≤
(start.getD j []).getD 1 0 ∧
(start.getD j []).getD 1 0 + (i.1.getD j []).getD 1 0 ≤
(start.getD j []).getD 2 0 ∧
(start.getD j []).getD 2 0 + (i.1.getD j []).getD 2 0 ≤ i.2) ∧
∀ k < 3, ∀ a < i.1.length, ∀ b < i.1.length, a < b →
(start.getD a []).getD k 0 + (i.1.getD a []).getD k 0 ≤
(start.getD b []).getD k 0 ∨
⋯
WantedExt/Complexity/NPComplete/FlowShopWanted.lean:57
Uses 12 · Used by 1
Theorem3-MACHINE FLOW SHOP SCHEDULING is NP-complete#●ready to prove
The 3-machine flow shop scheduling decision problem belongs to NP, and every decision problem in NP reduces to it by a polynomial-time many-one reduction.
public theorem_wanted flowShop_npComplete :
flowShopDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L flowShopDec
noncomputable def flowShopDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := FlowShopInstance) x with
| some i => decide (WellFormed i ∧ FlowShopFeasible i)
| none => false
WantedExt/Complexity/NPComplete/FlowShopWanted.lean:74
def NP : DecisionComplexityClass :=
{ L | ∃ (p : Polynomial ℕ), ∃ R : (List Bool × List Bool) → Bool,
IsPolyTime R ∧
∀ x, L x ↔ ∃ w : List Bool, w.length ≤ p.eval x.length ∧ R (x, w) }
MathlibExt/Computability/Complexity.lean:200
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def PolyManyOneRed (L₁ L₂ : MetaMathlibExt.ComplexityTheory.DecisionProblem) : Prop :=
∃ reduce : List Bool → List Bool,
MetaMathlibExt.ComplexityTheory.IsPolyTime reduce ∧ ∀ x, L₁ x = L₂ (reduce x)
CSLibExt/Computability/CookLevin.lean:396
Sources
- M. R. Garey, D. S. Johnson, and R. Sethi, "The complexity of flowshop and jobshop scheduling", Mathematics of Operations Research 1 (1976), 117-129; T. F. Gonzalez and S. Sahni, "Flowshop and jobshop schedules: complexity and approximation", Operations Research 26 (1978), 36-52.
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.