From 4204969da9580310ad019768dd88a7897c910618 Mon Sep 17 00:00:00 2001 From: Maximilian Schlosser Date: Sun, 9 Jul 2017 13:15:30 +0200 Subject: [PATCH 1/2] helper method to extract single jobs --- src/Parser/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Parser/__init__.py b/src/Parser/__init__.py index 85b3742..bc4f79a 100644 --- a/src/Parser/__init__.py +++ b/src/Parser/__init__.py @@ -93,6 +93,8 @@ class JobShopProblem(Mapping): def __len__(self) -> int: return sum(map(len, self.problem_data)) + def get_tasks_by_job(self, job): + return self.problem_data[job] class JobShopVisitor(arpeggio.PTNodeVisitor): """contains visitor functions needed for both jobshop1 (list of instances) From ae43bd526424c36c3dc6d904d34d397921646c27 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Sun, 9 Jul 2017 17:20:07 +0200 Subject: [PATCH 2/2] add typing annotations to get_task_by_job --- src/Parser/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Parser/__init__.py b/src/Parser/__init__.py index bc4f79a..d42e09c 100644 --- a/src/Parser/__init__.py +++ b/src/Parser/__init__.py @@ -93,7 +93,7 @@ class JobShopProblem(Mapping): def __len__(self) -> int: return sum(map(len, self.problem_data)) - def get_tasks_by_job(self, job): + def get_tasks_by_job(self, job: int) -> List[Tuple[int, int]]: return self.problem_data[job] class JobShopVisitor(arpeggio.PTNodeVisitor):