@@ -25,6 +25,7 @@ class MachineInstance:
2525 jobs : list [list [TaskData ]] # also defines precedence constraints
2626 permutation : list [tuple [int , int ]] | None = None # tuples of machine idcs
2727 no_wait : bool = False
28+ open_shop : bool = False # if True, job tasks have no precedence
2829 setup_times : list [list [list [int ]]] | None = None
2930 objective : str = "makespan"
3031 due_dates : list [int ] | None = None
@@ -64,6 +65,10 @@ def data(self) -> ProblemData:
6465 for mach_idx , duration in task_data :
6566 model .add_mode (task , machines [mach_idx ], duration )
6667
68+ if self .open_shop :
69+ # Open shop: a job's tasks have no precedence among them.
70+ continue
71+
6772 for pred , succ in pairwise (job2tasks [job_idx ]):
6873 # Assume linear routing of tasks as presented in the job data.
6974 if self .no_wait :
@@ -197,6 +202,14 @@ def parse_npfsp(cls, loc: Path):
197202
198203 return MachineInstance (num_machines , jobs )
199204
205+ @classmethod
206+ def parse_osp (cls , loc : Path ):
207+ # Open shop has the same matrix format as NPFSP, but a job's tasks
208+ # may be processed in any order, so there is no precedence between them.
209+ instance = cls .parse_npfsp (loc )
210+ instance .open_shop = True
211+ return instance
212+
200213 @classmethod
201214 def parse_nw_pfsp (cls , loc : Path ):
202215 instance = cls .parse_npfsp (loc )
0 commit comments