Skip to content

Commit

Permalink
Remove automatic scheduling decision if there is only one job in queue
Browse files Browse the repository at this point in the history
  • Loading branch information
yura-hb committed Feb 24, 2024
1 parent de943a2 commit 1a36059
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
3 changes: 0 additions & 3 deletions diploma_thesis/environment/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,6 @@ def __select_job__(self):
if self.state.is_empty:
return None

if len(self.state.queue) == 1:
return self.state.queue[0]

job = self.shop_floor.schedule(self)

return job
Expand Down
5 changes: 0 additions & 5 deletions diploma_thesis/environment/work_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@ def __dispatch__(self):
self.history.with_decision_time(self.environment.now)

for job in self.state.queue:
if len(self.machines) == 1:
machine = self.machines[0]
machine.receive(job)
continue

self.shop_floor.will_dispatch(job, self)

machine = self.shop_floor.route(work_center=self, job=job)
Expand Down
25 changes: 13 additions & 12 deletions diploma_thesis/tape/queue/machine_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@ def clear_all(self):
@filter(lambda self, context, *args, **kwargs: context.shop_floor.id in self.queue)
@filter(lambda self, _, __, record: isinstance(record.result, Job))
def register(self, context: Context, machine: Machine, record: MachineModel.Record):
self.queue[context.shop_floor.id][machine.key][record.result.id] = TapeRecord(
record=Record(
state=record.state,
action=record.action,
next_state=None,
reward=None,
done=False,
batch_size=[]
),
context=self.reward.record_job_action(record.result, machine, context.moment),
moment=context.moment
)
if record.result:
self.queue[context.shop_floor.id][machine.key][record.result.id] = TapeRecord(
record=Record(
state=record.state,
action=record.action,
next_state=None,
reward=None,
done=False,
batch_size=[]
),
context=self.reward.record_job_action(record.result, machine, context.moment),
moment=context.moment
)

@filter(lambda self, context, machine, job: job.id in self.queue[context.shop_floor.id][machine.key])
def record_next_state(self, context: Context, machine: Machine, job: Job):
Expand Down

0 comments on commit 1a36059

Please sign in to comment.