Scheduler

class scml.scml2019.Scheduler(manager_id, awi, max_insurance_premium=inf, horizon=None)[source]

Bases: abc.ABC

Base class for all schedulers

Methods Summary

bookmark()

Sets a bookmark to the current location

delete_bookmark(bookmark_id)

Commits everything since the bookmark so it cannot be rolled back

find_schedule(contracts, start, end[, …])

Schedules a set of contracts and returns either the search_for_schedule or None if infeasible

init(simulator, products, processes, …)

Called by the FactoryManager after it is initialized

rollback(bookmark_id)

Rolls back to the given bookmark ID

schedule([contracts, …])

Schedules a set of contracts and returns either the search_for_schedule or None if infeasible

Methods Documentation

bookmark()[source]

Sets a bookmark to the current location

Return type

int

Returns

bookmark ID

delete_bookmark(bookmark_id)[source]

Commits everything since the bookmark so it cannot be rolled back

Parameters

The bookmark ID returned from bookmark (bookmark_id) –

Remarks:

  • You can only rollback in the reverse order of bookmarks. If the bookmark ID given here is not the one at the top of the bookmarks stack, the deletion will fail (return False)

Return type

bool

abstract find_schedule(contracts, start, end, assume_no_further_negotiations=False, ensure_storage_for=0, start_at=0)[source]

Schedules a set of contracts and returns either the search_for_schedule or None if infeasible

Parameters
  • start (int) –

  • end (int) –

  • contracts (Collection[Contract]) –

  • assume_no_further_negotiations

  • ensure_storage_for (int) –

  • start_at (int) – The time at which to start scheduling. No jobs will be scheduled before this time.

Return type

ScheduleInfo

Returns

Schedule information (See ScheduleInfo for its contents).

init(simulator, products, processes, profiles, producing)[source]

Called by the FactoryManager after it is initialized

rollback(bookmark_id)[source]

Rolls back to the given bookmark ID

Parameters

The bookmark ID returned from bookmark (bookmark_id) –

Remarks:

  • You can only rollback in the reverse order of bookmarks. If the bookmark ID given here is not the one at the top of the bookmarks stack, the rollback will fail (return False)

Return type

bool

schedule(contracts=(), assume_no_further_negotiations=False, ensure_storage_for=0, start_at=0)[source]

Schedules a set of contracts and returns either the search_for_schedule or None if infeasible

Parameters
  • it has scheduled before. If the state is given, it is taken as the initial state for scheduling (whatever) –

  • contracts (Collection[Contract]) – The contracts to be scheduled

  • assume_no_further_negotiations – whether to assume that more negotiations can take place (to secure

  • needs) (production) –

  • ensure_storage_for (int) – A minimum time to ensure that products are available in storage before contract delivery

  • times (sell contracts) –

  • start_at (int) – The time at which to start scheduling. No jobs will be scheduled before this time.

Return type

ScheduleInfo

Returns

ScheduleInfo describing the schedulo and any production needs and updates to be carried out.