-
Notifications
You must be signed in to change notification settings - Fork 3
[Model] OpenShopScheduling #506
Description
Important
Build as optimization, not decision. Value = Min<usize>.
Objective: Minimize makespan (completion time of the last task).
Do not add a bound/threshold field — let the solver find the optimum directly. See #765.
Motivation
OPEN-SHOP SCHEDULING (P198) from Garey & Johnson, A5 SS14. A classical NP-hard scheduling problem in which each job consists of one task per machine, and tasks of the same job may be processed in any order (unlike flow-shop where the order is fixed, or job-shop where each job has a prescribed route). The goal is to minimize the makespan. NP-complete for m ≥ 3 machines by reduction from PARTITION (Gonzalez & Sahni, 1976). Polynomial for m = 2 machines and for the preemptive variant with any number of machines.
Associated rules:
- R143: Partition → OpenShopScheduling (this model is the target)
Definition
Name: OpenShopScheduling
Reference: Garey & Johnson, Computers and Intractability, A5 SS14
Mathematical definition:
INSTANCE: Number m ∈ Z⁺ of machines, set J of n jobs, each job j ∈ J consisting of m tasks t₁[j], t₂[j], …, tₘ[j] (task tᵢ[j] is executed by machine i), and for each task a processing time p(j, i) ∈ Z⁰⁺.
OBJECTIVE: Find an open-shop schedule — a collection of one-machine schedules σᵢ for i = 1, …, m — that minimizes the makespan (completion time of the last task), subject to:
- Machine constraint: On each machine i, tasks do not overlap (non-preemptive).
- Job constraint: For each job j, its tasks on different machines do not overlap in time (a job occupies at most one machine at a time).
The corresponding decision problem (GJ SS14) asks whether a schedule exists with makespan ≤ D for a given deadline D.
Variables
- Count: n × m (one variable per job-machine pair, representing the start time). The start time domain is bounded by D_max = Σ_j max_i p(j,i) · n (a loose upper bound).
- Per-variable domain: For ILP formulation, binary ordering variables x_{j,k,i} (job j before job k on machine i) plus integer start time variables. For brute-force, enumerate orderings of jobs on each machine: (n!)^m permutations.
- Meaning: σᵢ(j) is the start time of job j's task on machine i. The evaluate function computes the makespan and checks both constraints.
dims() returns [n; n × m] (permutation of n jobs on each of m machines).
Schema (data type)
Type name: OpenShopScheduling
Variants: none (no type parameters)
| Field | Type | Description | Getter |
|---|---|---|---|
num_machines |
usize |
Number of machines m | num_machines() |
processing_times |
Vec<Vec<usize>> |
Processing time matrix: p[j][i] for job j, machine i (n × m) | num_jobs() → self.processing_times.len() |
Problem type: Optimization (minimization)
Value type: Min<usize>
Complexity
- Decision complexity: NP-complete for m ≥ 3 (Gonzalez & Sahni, 1976; transformation from PARTITION). NP-complete in the strong sense for arbitrary m (Lenstra, 1977). Polynomial for m = 2.
- Best known exact algorithm: Brute-force enumerates (n!)^m orderings across all machines. For the general case, exact methods use ILP or constraint programming.
- Complexity string for
declare_variants!:"factorial(num_jobs)^num_machines"(enumerate all orderings of jobs on each machine) - Special cases:
- m = 2: polynomial (Gonzalez & Sahni, 1976)
- Preemptive variant: polynomial for any m (Gonzalez & Sahni, 1976)
- Preemptive with release times: polynomial for m = 2 (Cho & Sahni, 1978)
- References:
- [Gonzalez & Sahni, 1976] T. Gonzalez and S. Sahni, "Open shop scheduling to minimize finish time", JACM 23(4), pp. 665-679, 1976.
- [Lenstra, 1977] J. K. Lenstra, "Sequencing by enumerative methods", Mathematisch Centrum, Amsterdam, 1977.
- [Cho & Sahni, 1978] Y. Cho and S. Sahni, "Preemptive scheduling of independent jobs with release and due dates on open, flow and job shop", 1978.
Extra Remark
Full book text:
INSTANCE: Number m in Z+ of processors, set J of jobs, each job j in J consisting of m tasks t1[j],t2[j], ..., tm[j] (with ti[j] to be executed by processor i), a length l(t) in Z0+ for each such task t, and an overall deadline D in Z+.
QUESTION: Is there an open-shop schedule for J that meets the deadline, i.e., a collection of one-processor schedules sigmai: J->Z0+, 1 <= i <= m, such that sigmai(j) > sigmai(k) implies sigmai(j) >= sigmai(k) + l(ti[k]), such that for each j in J the intervals [sigmai(j), sigmai(j) + l(ti[j])) are all disjoint, and such that sigmai(j) + l(ti[j]) <= D for 1 <= i <= m, 1 <= j <= |J|?
Reference: [Gonzalez and Sahni, 1976]. Transformation from PARTITION.
Comment: Remains NP-complete if m = 3, but can be solved in polynomial time if m = 2. NP-complete in the strong sense for m arbitrary [Lenstra, 1977]. The general problem is solvable in polynomial time if "preemptive" schedules are allowed [Gonzalez and Sahni, 1976], even if two distinct release times are allowed [Cho and Sahni, 1978].
Note: The original GJ formulation is a decision problem with deadline D. This issue reformulates it as an optimization problem (minimize makespan). The decision version is recovered by checking whether the optimal makespan ≤ D.
How to solve
- It can be solved by (existing) bruteforce. Enumerate all (n!)^m orderings of jobs on each machine; for each, greedily compute start times respecting job constraints; return minimum makespan.
- It can be solved by reducing to integer programming. Binary ILP with ordering variables x_{j,k,i} ∈ {0,1} (job j before k on machine i), integer start times σᵢ(j), non-overlap constraints, and makespan minimization.
- Other: Polynomial for m = 2 (Gonzalez-Sahni); preemptive variant solvable in polynomial time by LP.
Example Instance
Input:
m = 3 machines, J = {J₁, J₂, J₃, J₄} (n = 4 jobs)
Processing time matrix p[j][i]:
| Job | Machine 1 | Machine 2 | Machine 3 |
|---|---|---|---|
| J₁ | 3 | 1 | 2 |
| J₂ | 2 | 3 | 1 |
| J₃ | 1 | 2 | 3 |
| J₄ | 2 | 2 | 1 |
Per-machine totals: M₁ = 8, M₂ = 8, M₃ = 7. Per-job totals: J₁ = 6, J₂ = 6, J₃ = 6, J₄ = 5.
Lower bound: max(8, 6) = 8.
Optimal schedule (makespan = 11):
| Machine | Schedule |
|---|---|
| M₁ | J₃[0,1), J₂[1,3), J₁[3,6), J₄[6,8) |
| M₂ | J₃[1,3), J₂[3,6), J₁[6,7), J₄[8,10) |
| M₃ | J₃[3,6), J₁[7,9), J₂[9,10), J₄[10,11) |
Job timelines (verify no overlap within each job):
- J₁: M₁[3,6) → M₂[6,7) → M₃[7,9) — disjoint ✓
- J₂: M₁[1,3) → M₂[3,6) → M₃[9,10) — disjoint ✓
- J₃: M₁[0,1) → M₂[1,3) → M₃[3,6) — disjoint ✓
- J₄: M₁[6,8) → M₂[8,10) → M₃[10,11) — disjoint ✓
Makespan = 11 (J₄ finishes last on M₃ at time 11).
Suboptimal feasible schedules (confirming non-triviality):
- Makespan 12: 30 valid orderings achieve this
- Makespan 13: 113 valid orderings
- Makespan 15+: majority of the 13,824 orderings
Out of 13,824 total machine-ordering combinations (24³), only 4 achieve the optimal makespan of 11, with 13 distinct makespan values ranging from 11 to 23.
Expected outcome: Min(11)
Reduction Rule Crossref
- R143: Partition → OpenShopScheduling
- Direct ILP: OpenShopScheduling → ILP (ordering + start time formulation)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status