job-shop-lib 1.1.3__py3-none-any.whl → 1.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
job_shop_lib/__init__.py CHANGED
@@ -19,7 +19,7 @@ from job_shop_lib._schedule import Schedule
19
19
  from job_shop_lib._base_solver import BaseSolver, Solver
20
20
 
21
21
 
22
- __version__ = "1.1.3"
22
+ __version__ = "1.2.0"
23
23
 
24
24
  __all__ = [
25
25
  "Operation",
@@ -24,6 +24,7 @@ Problem step-by-step.
24
24
  get_matrix_setup_time_calculator
25
25
  get_breakdown_calculator
26
26
  get_job_dependent_setup_calculator
27
+ get_arrival_calculator
27
28
 
28
29
  Dispatching refers to the decision-making process of selecting which job
29
30
  should be processed next on a particular machine when that machine becomes
@@ -53,6 +54,7 @@ from ._start_time_calculators import (
53
54
  get_breakdown_calculator,
54
55
  get_job_dependent_setup_calculator,
55
56
  get_matrix_setup_time_calculator,
57
+ get_arrival_calculator,
56
58
  )
57
59
  from ._dispatcher_observer_config import DispatcherObserverConfig
58
60
  from ._factories import (
@@ -84,4 +86,5 @@ __all__ = [
84
86
  "get_matrix_setup_time_calculator",
85
87
  "get_breakdown_calculator",
86
88
  "get_job_dependent_setup_calculator",
89
+ "get_arrival_calculator",
87
90
  ]
@@ -193,3 +193,52 @@ def get_job_dependent_setup_calculator(
193
193
  return default_start + setup_time
194
194
 
195
195
  return calculator
196
+
197
+
198
+ def get_arrival_calculator(
199
+ arrival_times: Sequence[Sequence[int]] | NDArray[np.integer] | None = None,
200
+ ) -> StartTimeCalculator:
201
+ """Returns a start time calculator that respects operation arrival times.
202
+
203
+ This calculator uses a predefined matrix of arrival times to
204
+ ensure that no operation begins before its specified arrival
205
+ time. If the ``arrival_times`` matrix isn't provided directly,
206
+ the calculator attempts to retrieve it from the dispatcher's
207
+ instance metadata using the key ``"arrival_times_matrix"``.
208
+
209
+ Args:
210
+ arrival_times:
211
+ A 2D matrix where ``arrival_times[i][j]`` is the
212
+ arrival time for the operation at index ``j`` of
213
+ job ``i``. If ``None``, the calculator will
214
+ attempt to retrieve it from the dispatcher metadata.
215
+
216
+ Returns:
217
+ A start time calculator function that uses the arrival times.
218
+
219
+ Example:
220
+ >>> arrival_calc = get_arrival_calculator([[0, 2], [1, 0]])
221
+ >>> dispatcher = Dispatcher(
222
+ ... instance, start_time_calculator=arrival_calc
223
+ ... )
224
+ """
225
+
226
+ def calculator(
227
+ dispatcher: Dispatcher, operation: Operation, machine_id: int
228
+ ) -> int:
229
+ default_start_time = no_setup_time_calculator(
230
+ dispatcher, operation, machine_id
231
+ )
232
+ arrival_matrix = arrival_times
233
+ if arrival_matrix is None:
234
+ arrival_matrix = dispatcher.instance.metadata.get(
235
+ "arrival_times_matrix"
236
+ )
237
+ if arrival_matrix is None:
238
+ return default_start_time
239
+ operation_arrival_time = arrival_matrix[operation.job_id][
240
+ operation.position_in_job
241
+ ]
242
+ return max(default_start_time, operation_arrival_time)
243
+
244
+ return calculator
@@ -1,6 +1,6 @@
1
1
  """Home of the `InstanceGenerator` class."""
2
2
 
3
- import abc
3
+ from abc import ABC, abstractmethod
4
4
 
5
5
  import random
6
6
  from typing import Iterator
@@ -9,7 +9,7 @@ from job_shop_lib import JobShopInstance
9
9
  from job_shop_lib.exceptions import UninitializedAttributeError
10
10
 
11
11
 
12
- class InstanceGenerator(abc.ABC):
12
+ class InstanceGenerator(ABC):
13
13
  """Common interface for all generators.
14
14
 
15
15
  The class supports both single instance generation and iteration over
@@ -75,7 +75,7 @@ class InstanceGenerator(abc.ABC):
75
75
  self._current_iteration = 0
76
76
  self._iteration_limit = iteration_limit
77
77
 
78
- @abc.abstractmethod
78
+ @abstractmethod
79
79
  def generate(
80
80
  self,
81
81
  num_jobs: int | None = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: job-shop-lib
3
- Version: 1.1.3
3
+ Version: 1.2.0
4
4
  Summary: An easy-to-use and modular Python library for the Job Shop Scheduling Problem (JSSP)
5
5
  License: MIT
6
6
  Author: Pabloo22
@@ -1,4 +1,4 @@
1
- job_shop_lib/__init__.py,sha256=y-1uRgW-6xUddIIj3ksBlqxbSMJZkLZCSqBELQhL5mw,639
1
+ job_shop_lib/__init__.py,sha256=yXJFP7NB9jntS26eZXQCVjeCM45KPFcc2FS1PbTCLm8,639
2
2
  job_shop_lib/_base_solver.py,sha256=p17XmtufNc9Y481cqZUT45pEkUmmW1HWG53dfhIBJH8,1363
3
3
  job_shop_lib/_job_shop_instance.py,sha256=FkMBy9Yb8cNEGswI9vlN3Wh4mhtEX-QuDbKvSYUOXcM,18361
4
4
  job_shop_lib/_operation.py,sha256=lwCjgXwWlgESFuV3Yh4SCVofPGCd3hJU4vnK7peREac,4235
@@ -9,14 +9,14 @@ job_shop_lib/benchmarking/_load_benchmark.py,sha256=-cgyx0Kn6uAc3KdGFSQb6eUVQjQg
9
9
  job_shop_lib/benchmarking/benchmark_instances.json,sha256=F9EvyzFwVxiKAN6rQTsrMhsKstmyUmroyWduM7a00KQ,464841
10
10
  job_shop_lib/constraint_programming/__init__.py,sha256=kKQRUxxS_nVFUdXGnf4bQOD9mqrXxZZWElS753A4YiA,454
11
11
  job_shop_lib/constraint_programming/_ortools_solver.py,sha256=oMPeA2VHoYX1ZvmygQ8kYew40ITLAQATmM4OhgVFuXM,10482
12
- job_shop_lib/dispatching/__init__.py,sha256=eyiCpCWIsx3LDoSOtPImjYAkI6R8t93kz56hM03WODE,2558
12
+ job_shop_lib/dispatching/__init__.py,sha256=gbgY1_lhergmXaDa-VYVUmxMpOKzYko0ONREVAt_QPc,2643
13
13
  job_shop_lib/dispatching/_dispatcher.py,sha256=KnV_Kry3Ie81WbKhdpRQtOMsuFDNCuh5Kp2ZnelM-R8,23835
14
14
  job_shop_lib/dispatching/_dispatcher_observer_config.py,sha256=QF2d3rJWwmvutQBAkKxzQ1toJs6eMelT404LGS2z9HQ,2467
15
15
  job_shop_lib/dispatching/_factories.py,sha256=j3MhIwVXiq-B8JMit72ObvXSa2sdgWNhUD86gghL6Gg,4689
16
16
  job_shop_lib/dispatching/_history_observer.py,sha256=Vl8rQaxekUeEB-AyNxyC3c76zQakeh-rdri2iDnZvXw,610
17
17
  job_shop_lib/dispatching/_optimal_operations_observer.py,sha256=2EYxevjpeGMP3do-m0ZmtmjIjmNcxrWOSKzN_bW37gQ,4247
18
18
  job_shop_lib/dispatching/_ready_operation_filters.py,sha256=brhmhoyyoZ98wAEEfneZC-CD-aw9SerZHGMB1DpK8HY,5749
19
- job_shop_lib/dispatching/_start_time_calculators.py,sha256=sEtInDnFW9gsKDUEDUGQBaIjDWgCkFYvBca46j8XYfE,6408
19
+ job_shop_lib/dispatching/_start_time_calculators.py,sha256=N4kz3c4TmXbyFsY6ctxruYK2ucnjSVXWNMhvsUWFuDg,8192
20
20
  job_shop_lib/dispatching/_unscheduled_operations_observer.py,sha256=0he-j4OlvqtXAJZD5x1nuBnUKqZUfftVx9NT3CVxPyg,2708
21
21
  job_shop_lib/dispatching/feature_observers/__init__.py,sha256=EuJLvSpJpoXUK8A4UuC2k6Mpa293ZR3oCnnvYivIBtU,2240
22
22
  job_shop_lib/dispatching/feature_observers/_composite_feature_observer.py,sha256=tpvqTLIcNmbYROSFT62LiUZ_tI4fHWL_qCULKK43BU4,6429
@@ -38,7 +38,7 @@ job_shop_lib/dispatching/rules/_utils.py,sha256=m5qw4qyfaIvVrkmv51nuhreizr98-cg8
38
38
  job_shop_lib/exceptions.py,sha256=ARzpoZJCvRIvOesCiqqFSRxkv6w9WwEXx0aBP-l2IKA,1597
39
39
  job_shop_lib/generation/__init__.py,sha256=QaWwuBfBNnOiG0OPiP_CV_flBu9dX7r2o_HwL47tREM,822
40
40
  job_shop_lib/generation/_general_instance_generator.py,sha256=b_tnyP4H_buoN7b6lKQRLvDkeZDdys0mpqS3thB5-SQ,6544
41
- job_shop_lib/generation/_instance_generator.py,sha256=rT7CAJuv6E0zbmRFE_MFY6iaeZB06BshsBHl2_GyPzU,4567
41
+ job_shop_lib/generation/_instance_generator.py,sha256=doN6WySyI0k7wz3aKy_e6hj6t7WV3dNzve3YmTFShas,4584
42
42
  job_shop_lib/generation/_utils.py,sha256=TYBGt4Zjw94l6ukIjXBVAK3lmrrZXdyzyq_r1DMlL-E,3986
43
43
  job_shop_lib/graphs/__init__.py,sha256=wlYIiXTuZRE6Kx3K0RpPUoZikzoegBuN2hcdqMODtGk,2433
44
44
  job_shop_lib/graphs/_build_disjunctive_graph.py,sha256=UbUYdeQaaeEqLchcKJGHEFGl4wElfGLb1o_R-u8wqnA,5120
@@ -67,7 +67,7 @@ job_shop_lib/visualization/gantt/_plot_gantt_chart.py,sha256=_4UGUTRuIw0tLzsJD9G
67
67
  job_shop_lib/visualization/graphs/__init__.py,sha256=HUWzfgQLeklNROtjnxeJX_FIySo_baTXO6klx0zUVpQ,630
68
68
  job_shop_lib/visualization/graphs/_plot_disjunctive_graph.py,sha256=L9_ZGgvCFpGc2rTOdZESdtydFQqShjqedimIOhqZx6Y,16209
69
69
  job_shop_lib/visualization/graphs/_plot_resource_task_graph.py,sha256=nkkdZ-9_OBevw72Frecwzv1y3WyhGZ9r9lz0y9MXvZ8,13192
70
- job_shop_lib-1.1.3.dist-info/LICENSE,sha256=9mggivMGd5taAu3xbmBway-VQZMBzurBGHofFopvUsQ,1069
71
- job_shop_lib-1.1.3.dist-info/METADATA,sha256=O0G7p67y75GHe-gVPEepppAQGETiswCfkaB7JmbmwnI,19130
72
- job_shop_lib-1.1.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
73
- job_shop_lib-1.1.3.dist-info/RECORD,,
70
+ job_shop_lib-1.2.0.dist-info/LICENSE,sha256=9mggivMGd5taAu3xbmBway-VQZMBzurBGHofFopvUsQ,1069
71
+ job_shop_lib-1.2.0.dist-info/METADATA,sha256=jn2o3HTpGzqzkYdagJfNM-IVheqnLQ6SEUnQQt69sYc,19130
72
+ job_shop_lib-1.2.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
73
+ job_shop_lib-1.2.0.dist-info/RECORD,,