scml.scml2019.schedulers

Classes

ScheduleInfo

Scheduler

Base class for all schedulers

GreedyScheduler

Default scheduler used by the DefaultFactoryManager

Module Contents

class scml.scml2019.schedulers.ScheduleInfo[source]
final_balance: float[source]

balance at the end of the schedule

valid: bool = True[source]

Is this a valid schedule?

start: int | None = None[source]

The starting step of this schedule

end: int | None = None[source]

The step after the last step in this simulation

needs: List[scml.scml2019.common.ProductionNeed][source]

The products needed but not still in storage needed to complete this schedule.

jobs: List[scml.scml2019.common.Job][source]

The jobs that need to be scheduled

failed_contracts: List[negmas.situated.Contract][source]

A list of contracts that failed to be scheduled.

ignored_contracts: List[negmas.situated.Contract][source]

A list of contracts ignored for this schedule because they are in the past.

__str__()[source]

Return str(self).

combine(other: ScheduleInfo) None[source]
class scml.scml2019.schedulers.Scheduler(manager_id: str, awi: scml.scml2019.awi.SCMLAWI, max_insurance_premium: float = float('inf'), horizon: int | None = None)[source]

Bases: abc.ABC

Base class for all schedulers

bookmark() int[source]

Sets a bookmark to the current location

Returns:

bookmark ID

rollback(bookmark_id: int) bool[source]

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)

delete_bookmark(bookmark_id: int) bool[source]

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)

init(simulator: scml.scml2019.simulators.FactorySimulator, products: List[scml.scml2019.common.Product], processes: List[scml.scml2019.common.Process], profiles: List[scml.scml2019.common.ManufacturingProfileCompiled], producing: Dict[int, List[scml.scml2019.common.ProductManufacturingInfo]])[source]

Called by the FactoryManager after it is initialized

schedule(contracts: Collection[negmas.situated.Contract] = (), assume_no_further_negotiations=False, ensure_storage_for: int = 0, start_at: int = 0) ScheduleInfo[source]

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 – 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 – A minimum time to ensure that products are available in storage before contract delivery

  • times (sell contracts)

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

Returns:

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

abstract find_schedule(contracts: Collection[negmas.situated.Contract], start: int, end: int, assume_no_further_negotiations=False, ensure_storage_for: int = 0, start_at: int = 0) ScheduleInfo[source]

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

Parameters:
  • start

  • end

  • contracts

  • assume_no_further_negotiations

  • ensure_storage_for

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

Returns:

Schedule information (See ScheduleInfo for its contents).

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

Bases: Scheduler

Default scheduler used by the DefaultFactoryManager

__getstate__()[source]

Helper for pickle.

__setstate__(state)[source]
init(simulator: scml.scml2019.simulators.FactorySimulator, products: List[scml.scml2019.common.Product], processes: List[scml.scml2019.common.Process], profiles: List[scml.scml2019.common.ManufacturingProfileCompiled], producing: Dict[int, List[scml.scml2019.common.ProductManufacturingInfo]])[source]

Called by the FactoryManager after it is initialized

_profile_sorter(info: scml.scml2019.common.ProductManufacturingInfo) Any[source]
unit_time(info: scml.scml2019.common.ProductManufacturingInfo) float[source]
total_cost(info: scml.scml2019.common.ProductManufacturingInfo) float[source]
total_unit_cost(info: scml.scml2019.common.ProductManufacturingInfo) float[source]
production_cost(info: scml.scml2019.common.ProductManufacturingInfo) float[source]
production_unit_cost(info: scml.scml2019.common.ProductManufacturingInfo) float[source]
input_cost(info: scml.scml2019.common.ProductManufacturingInfo)[source]
input_unit_cost(info: scml.scml2019.common.ProductManufacturingInfo) float[source]
schedule_contract(contract: negmas.situated.Contract, assume_no_further_negotiations=False, end: int = None, ensure_storage_for: int = 0, start_at: int = 0) ScheduleInfo[source]

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

Parameters:
  • contract – The contract being scheduled

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

  • end – The scheduling horizon (None for the default).

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

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

Returns:

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

schedule_contracts(contracts: Collection[negmas.situated.Contract], end: int = None, assume_no_further_negotiations=False, ensure_storage_for: int = 0, start_at: int = 0) ScheduleInfo[source]

Schedules a set of contracts and returns the ScheduleInfo.

Parameters:
  • contracts – Contracts to schedule

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

  • end – The end of the simulation for the schedule (exclusive)

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

  • start_at – The timestep at which to start scheduling

Returns:

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

find_schedule(contracts: Collection[negmas.situated.Contract], start: int, end: int, assume_no_further_negotiations=False, ensure_storage_for: int = 0, start_at: int = 0)[source]

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

Parameters:
  • start

  • end

  • contracts

  • assume_no_further_negotiations

  • ensure_storage_for

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

Returns:

Schedule information (See ScheduleInfo for its contents).