One family for serial and parallel batching
Lax434175.BatchFamily · concepts/Lax434175/BatchFamily.lean · lax-434175
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Theorem
Serial and parallel batching share one machine model, in which a schedule partitions the jobs into numbered batches and gives every batch a start time and a processing time. All jobs of a batch start when the batch starts and complete when it completes, at its start plus its processing time. A schedule is feasible for this model if a setup precedes every batch, as in batch scheduling.
The batching field has the values serial and parallel: the processing time of every batch is the sum, or the maximum, of the processing times of its jobs. The two values are incomparable. The other fields are those of batching.
A batching problem in a mode determines the problem of this family with the same values and that mode.
Theorem. The two problems are special cases of each other. The fields of the family are sound, so that a specification that is field by field a special case of another describes a special case of the other's problem, and one that reduces to another describes a problem whose decision version reduces to that of the other.
Concept map
Evidence
Lean source view on GitHub
| 1 | import Lax434175.BatchProblems |
| 2 | |
| 3 | /-! |
| 4 | --- |
| 5 | title: One family for serial and parallel batching |
| 6 | type: theorem |
| 7 | --- |
| 8 | Serial and parallel batching share one machine model, in which a schedule |
| 9 | partitions the jobs into numbered batches and gives every batch a start time |
| 10 | and a processing time. All jobs of a batch start when the batch starts and |
| 11 | complete when it completes, at its start plus its processing time. A |
| 12 | schedule is feasible for this model if a setup precedes every batch, as in |
| 13 | batch scheduling. |
| 14 | |
| 15 | The batching field has the values serial and parallel: the processing time of |
| 16 | every batch is the sum, or the maximum, of the processing times of its jobs. |
| 17 | The two values are incomparable. The other fields are those of batching. |
| 18 | |
| 19 | A batching problem in a mode determines the problem of this family with the |
| 20 | same values and that mode. |
| 21 | |
| 22 | **Theorem.** The two problems are special cases of each other. The fields of |
| 23 | the family are sound, so that a specification that is field by field a |
| 24 | special case of another describes a special case of the other's problem, and |
| 25 | one that reduces to another describes a problem whose decision version |
| 26 | reduces to that of the other. |
| 27 | -/ |
| 28 | |
| 29 | namespace Lax434175.BatchFamily |
| 30 | open Lax434175.Problems Lax434175.Kernels Lax434175.Modules Lax434175.Assembly |
| 31 | open Lax434175 |
| 32 | open Lax434175.Batching (Inst Capacity ProcessingTimes members) |
| 33 | |
| 34 | /-- A batch schedule with the processing time of every batch. -/ |
| 35 | structure Sched (x : Inst) where |
| 36 | /-- The number of the batch of a job. -/ |
| 37 | batch : Fin x.jobs → ℕ |
| 38 | /-- The start time of a batch. -/ |
| 39 | start : ℕ → ℕ |
| 40 | /-- The processing time of a batch. -/ |
| 41 | length : ℕ → ℕ |
| 42 | |
| 43 | /-- The batches and start times of a schedule. -/ |
| 44 | def Sched.plain {x : Inst} (σ : Sched x) : Batching.Sched x := ⟨σ.batch, σ.start⟩ |
| 45 | |
| 46 | /-- The completion time of a batch. -/ |
| 47 | def finish {x : Inst} (σ : Sched x) (k : ℕ) : ℕ := σ.start k + σ.length k |
| 48 | |
| 49 | /-- A setup precedes every batch. -/ |
| 50 | def feasible (x : Inst) (σ : Sched x) : Prop := |
| 51 | (∀ j, x.setup ≤ σ.start (σ.batch j)) ∧ |
| 52 | ∀ i j, σ.batch i < σ.batch j → finish σ (σ.batch i) + x.setup ≤ σ.start (σ.batch j) |
| 53 | |
| 54 | /-- The kernel of batch scheduling. -/ |
| 55 | def kernel : Kernel where |
| 56 | Inst := Inst |
| 57 | jobs := Inst.jobs |
| 58 | release := Inst.r |
| 59 | Sched := Sched |
| 60 | feasible := feasible |
| 61 | start _ σ j := (σ.start (σ.batch j) : NNRat) |
| 62 | completion _ σ j := (finish σ (σ.batch j) : NNRat) |
| 63 | |
| 64 | def modeLe : Batching.Mode → Batching.Mode → Bool |
| 65 | | .serial, .serial | .parallel, .parallel => true |
| 66 | | _, _ => false |
| 67 | |
| 68 | /-- The batching field. -/ |
| 69 | def mode : Module kernel where |
| 70 | Value := Batching.Mode |
| 71 | Data _ _ := Unit |
| 72 | admits _ _ _ := True |
| 73 | constraint v x _ σ := ∀ k, σ.length k = Batching.length v x σ.plain k |
| 74 | le := modeLe |
| 75 | embed _ _ _ := () |
| 76 | |
| 77 | /-- The capacity field. -/ |
| 78 | def capacity : Module kernel where |
| 79 | Value := Capacity |
| 80 | Data := Capacity.Data |
| 81 | admits _ _ _ := True |
| 82 | constraint v _ d σ := ∀ k, ∑ j ∈ members σ.plain k, v.size d j ≤ v.bound d |
| 83 | le := Capacity.le |
| 84 | embed := Capacity.embed |
| 85 | |
| 86 | /-- The processing-time field. -/ |
| 87 | def processingTimes : Module kernel := |
| 88 | Module.ofRestriction ProcessingTimes ProcessingTimes.holds |
| 89 | (fun v w => decide (v.rank ≤ w.rank)) |
| 90 | |
| 91 | /-- The fields of the family: batching and the fields of batch scheduling. -/ |
| 92 | inductive FieldName |
| 93 | | mode |
| 94 | | field (i : BatchProblems.FieldName) |
| 95 | deriving DecidableEq |
| 96 | |
| 97 | instance : Fintype FieldName where |
| 98 | elems := {.mode, .field .capacity, .field .jobCount, .field .processingTimes, |
| 99 | .field .releaseDates, .field .deadlines, .field .precedence} |
| 100 | complete x := by |
| 101 | cases x with |
| 102 | | mode => decide |
| 103 | | field i => cases i <;> decide |
| 104 | |
| 105 | /-- The batching problems. -/ |
| 106 | abbrev family : Family kernel := |
| 107 | Thresholds.family FieldName fun |
| 108 | | .mode => mode |
| 109 | | .field .capacity => capacity |
| 110 | | .field .jobCount => Counts.module _ kernel.jobs |
| 111 | | .field .processingTimes => processingTimes |
| 112 | | .field .releaseDates => ReleaseDates.module _ |
| 113 | | .field .deadlines => Deadlines.module _ |
| 114 | | .field .precedence => Precedence.oneMachine _ |
| 115 | |
| 116 | instance : Fintype family.ModuleName := |
| 117 | inferInstanceAs (Fintype FieldName) |
| 118 | |
| 119 | /-- The specification `1 | β | γ` of a batching problem. -/ |
| 120 | def spec (mode : Batching.Mode) (capacity : Capacity) |
| 121 | (jobCount : Counts.Bound := .any) |
| 122 | (processingTimes : ProcessingTimes := .arbitrary) |
| 123 | (release : ReleaseDates.Value := .none) |
| 124 | (deadline : Deadlines.Value := .none) |
| 125 | (precedence : Precedence.Value := .none) |
| 126 | (objective : Objectives.Value) : Spec family where |
| 127 | module |
| 128 | | .mode => mode |
| 129 | | .field .capacity => capacity |
| 130 | | .field .jobCount => jobCount |
| 131 | | .field .processingTimes => processingTimes |
| 132 | | .field .releaseDates => release |
| 133 | | .field .deadlines => deadline |
| 134 | | .field .precedence => precedence |
| 135 | objective := objective |
| 136 | |
| 137 | /-- The specification of the family with the values of a batching problem in |
| 138 | a mode. -/ |
| 139 | def ofSpec (m : Batching.Mode) (s : Spec (BatchProblems.family m)) : Spec family where |
| 140 | module |
| 141 | | .mode => m |
| 142 | | .field .capacity => s.module .capacity |
| 143 | | .field .jobCount => s.module .jobCount |
| 144 | | .field .processingTimes => s.module .processingTimes |
| 145 | | .field .releaseDates => s.module .releaseDates |
| 146 | | .field .deadlines => s.module .deadlines |
| 147 | | .field .precedence => s.module .precedence |
| 148 | objective := s.objective |
| 149 | |
| 150 | axiom faithful (m : Batching.Mode) (s : Spec (BatchProblems.family m)) : |
| 151 | SpecialCase (problem _ s) (problem family (ofSpec m s)) ∧ |
| 152 | SpecialCase (problem family (ofSpec m s)) (problem _ s) |
| 153 | |
| 154 | axiom family_sound : family.Sound |
| 155 | |
| 156 | axiom specialCase_of_le {s t : Spec family} : |
| 157 | s.le t → SpecialCase (problem family s) (problem family t) |
| 158 | |
| 159 | axiom reducible_of_reduces {s t : Spec family} : |
| 160 | Thresholds.Reduces s t → Reducible (problem family s) (problem family t) |
| 161 | |
| 162 | end Lax434175.BatchFamily |
| 163 |
Builds on
Used by
From Mathlib
none
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments