GreedyScheduler

class scml.scml2019.GreedyScheduler(manager_id, awi, max_insurance_premium=inf, horizon=None, add_catalog_prices=True, strategy='latest', profile_sorter='total-cost>time')[source]

Bases: scml.scml2019.schedulers.Scheduler

Default scheduler used by the DefaultFactoryManager

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

input_cost(info)

input_unit_cost(info)

rtype

float

production_cost(info)

rtype

float

production_unit_cost(info)

rtype

float

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

schedule_contract(contract[, ...])

Schedules this contract if possible and returns information about the resulting schedule

schedule_contracts(contracts[, end, ...])

Schedules a set of contracts and returns the ScheduleInfo.

total_cost(info)

rtype

float

total_unit_cost(info)

rtype

float

unit_time(info)

rtype

float

Methods Documentation

bookmark()

Sets a bookmark to the current location

Return type

int

Returns

bookmark ID

delete_bookmark(bookmark_id)

Commits everything since the bookmark so it cannot be rolled back

Parameters

bookmark (bookmark_id The bookmark ID returned from) –

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

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.

Returns

Schedule information (See ScheduleInfo for its contents).

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

Called by the FactoryManager after it is initialized

input_cost(info)[source]
input_unit_cost(info)[source]
Return type

float

production_cost(info)[source]
Return type

float

production_unit_cost(info)[source]
Return type

float

rollback(bookmark_id)

Rolls back to the given bookmark ID

Parameters

bookmark (bookmark_id The bookmark ID returned from) –

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)

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

Parameters
  • given (whatever it has scheduled before. If the state is) –

  • scheduling (it is taken as the initial state for) –

  • 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.

schedule_contract(contract, assume_no_further_negotiations=False, end=None, ensure_storage_for=0, start_at=0)[source]

Schedules this contract if possible and returns information about the resulting schedule

Parameters
  • contract (Contract) – The contract being scheduled

  • assume_no_further_negotiations – If true no further negotiations will be assumed possible

  • end (Optional[int]) – The scheduling horizon (None for the default).

  • ensure_storage_for (int) – The number of steps all needs must be in storage before they are consumed in production

  • start_at (int) – No jobs will be scheduled before that time.

Return type

ScheduleInfo

Returns

Full schedule information including validity, line schedulers, production needs, etc (see SchedulerInfo).

schedule_contracts(contracts, end=None, assume_no_further_negotiations=False, ensure_storage_for=0, start_at=0)[source]

Schedules a set of contracts and returns the ScheduleInfo.

Parameters
  • contracts (Collection[Contract]) – Contracts to schedule

  • assume_no_further_negotiations – If true, no further negotiations will be assumed to be possible

  • end (Optional[int]) – The end of the simulation for the schedule (exclusive)

  • ensure_storage_for (int) – Ensure that the outcome will be at the storage for at least this time

  • start_at (int) – The timestep at which to start scheduling

Return type

ScheduleInfo

Returns

ScheduleInfo giving the schedule after these contracts is included. valid member can be used to check whether this is a valid contract

total_cost(info)[source]
Return type

float

total_unit_cost(info)[source]
Return type

float

unit_time(info)[source]
Return type

float