Generalized assignment problem
AbbreviationGeneralized-assignment instances#✓fully proved
A generalized-assignment instance is a tuple \((R, C, c, K)\) where \(R\) and \(C\) are finite lists of finite lists of natural numbers, read as matrices indexed by job and machine (\(R_{j,i}\) is the resource job \(j\) consumes on machine \(i\) and \(C_{j,i}\) is the cost of assigning job \(j\) to machine \(i\)), \(c\) is a finite list of natural numbers (the machine capacities \(c_i\)), and \(K\) is a natural number (the cost bound).
DefinitionWell-formed generalized-assignment instances#✓fully proved
A generalized-assignment instance \((R, C, c, K)\) is well formed when \(R\) and \(C\) have the same number of rows and every row of \(R\) and every row of \(C\) has as many entries as \(c\) (one per machine).
def WellFormed (i : GeneralizedAssignmentInstance) : Prop :=
(∀ row ∈ i.1, row.length = i.2.2.1.length) ∧
(∀ row ∈ i.2.1, row.length = i.2.2.1.length) ∧ i.1.length = i.2.1.length
abbrev GeneralizedAssignmentInstance := List (List ℕ) × List (List ℕ) × List ℕ × ℕ
WantedExt/Complexity/NPComplete/GeneralizedAssignmentWanted.lean:47
Uses 1 · Used by 1
DefinitionFeasible generalized assignments#✓fully proved
Let \((R, C, c, K)\) be a generalized-assignment instance, let \(n\) be the number of rows of \(R\) (the jobs) and \(m\) the length of \(c\) (the machines), and read entries missing from \(R\) or \(C\) as \(0\). The instance is feasible when there are machines \(a_1, \dots, a_n \in \{1, \dots, m\}\) such that for every machine \(i\) the sum of \(R_{j,i}\) over the jobs \(j\) with \(a_j = i\) is at most \(c_i\), and \(\sum_{j=1}^{n} C_{j,a_j} \le K\).
def GeneralizedAssignmentFeasible
(i : GeneralizedAssignmentInstance) : Prop :=
∃ assign : List ℕ, assign.length = i.1.length ∧
(∀ j < i.1.length, assign.getD j 0 < i.2.2.1.length) ∧
(∀ m < i.2.2.1.length,
(Finset.range i.1.length).sum (fun j =>
if assign.getD j 0 = m then (i.1.getD j []).getD m 0 else 0) ≤
i.2.2.1.getD m 0) ∧
(Finset.range i.1.length).sum
(fun j => (i.2.1.getD j []).getD (assign.getD j 0) 0) ≤ i.2.2.2
abbrev GeneralizedAssignmentInstance := List (List ℕ) × List (List ℕ) × List ℕ × ℕ
WantedExt/Complexity/NPComplete/GeneralizedAssignmentWanted.lean:47
Uses 1 · Used by 1
DefinitionThe generalized assignment decision problem#✓fully proved
The decision problem GENERALIZED ASSIGNMENT accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding of generalized-assignment instances, to an instance that is well formed and feasible. Bitstrings that do not decode to an instance are rejected.
noncomputable def generalizedAssignmentDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := GeneralizedAssignmentInstance) x with
| some i => decide (WellFormed i ∧ GeneralizedAssignmentFeasible 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 GeneralizedAssignmentInstance := List (List ℕ) × List (List ℕ) × List ℕ × ℕ
WantedExt/Complexity/NPComplete/GeneralizedAssignmentWanted.lean:47
def WellFormed (i : GeneralizedAssignmentInstance) : Prop :=
(∀ row ∈ i.1, row.length = i.2.2.1.length) ∧
(∀ row ∈ i.2.1, row.length = i.2.2.1.length) ∧ i.1.length = i.2.1.length
WantedExt/Complexity/NPComplete/GeneralizedAssignmentWanted.lean:50
def GeneralizedAssignmentFeasible
(i : GeneralizedAssignmentInstance) : Prop :=
∃ assign : List ℕ, assign.length = i.1.length ∧
(∀ j < i.1.length, assign.getD j 0 < i.2.2.1.length) ∧
(∀ m < i.2.2.1.length,
(Finset.range i.1.length).sum (fun j =>
if assign.getD j 0 = m then (i.1.getD j []).getD m 0 else 0) ≤
i.2.2.1.getD m 0) ∧
(Finset.range i.1.length).sum
(fun j => (i.2.1.getD j []).getD (assign.getD j 0) 0) ≤ i.2.2.2
WantedExt/Complexity/NPComplete/GeneralizedAssignmentWanted.lean:55
Uses 12 · Used by 1
TheoremGENERALIZED ASSIGNMENT is NP-complete#●ready to prove
The generalized assignment decision problem belongs to NP, and every decision problem in NP reduces to it by a polynomial-time many-one reduction.
public theorem_wanted generalizedAssignment_npComplete :
generalizedAssignmentDec ∈ MetaMathlibExt.ComplexityTheory.NP ∧
∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ MetaMathlibExt.ComplexityTheory.NP →
Cslib.CookLevin.PolyManyOneRed L generalizedAssignmentDec
noncomputable def generalizedAssignmentDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := GeneralizedAssignmentInstance) x with
| some i => decide (WellFormed i ∧ GeneralizedAssignmentFeasible i)
| none => false
WantedExt/Complexity/NPComplete/GeneralizedAssignmentWanted.lean:68
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 and D. S. Johnson, Computers and Intractability (1979), GENERALIZED ASSIGNMENT PROBLEM.
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.