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.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
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
-
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
-
rollback
(bookmark_id)¶ 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)¶ 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 scheduledassume_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 deliverytimes (sell contracts) –
start_at (
int
) – The time at which to start scheduling. No jobs will be scheduled before this time.
- Return type
- 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 scheduledassume_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 productionstart_at (
int
) – No jobs will be scheduled before that time.
- Return type
- 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 scheduleassume_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 timestart_at (
int
) – The timestep at which to start scheduling
- Return type
- Returns
ScheduleInfo giving the schedule after these contracts is included.
valid
member can be used to check whether this is a valid contract