sampo.schemas.contractor#

Overview#

Classes#

Contractor

Used to store information about the contractor and its resources

Function#

get_worker_contractor_pool(contractors)

Gets agent dictionary from contractors list.

get_contractor_for_resources_schedule(resources, contractor_capacity, contractor_id, contractor_name)

Generates a contractor, which satisfies the provided resources

Classes#

class sampo.schemas.contractor.Contractor#

Bases: sampo.schemas.serializable.AutoJSONSerializable[Contractor], sampo.schemas.identifiable.Identifiable

Used to store information about the contractor and its resources :param workers: dictionary, where the key is the employee’s specialty, and the value is the pool of employees of this specialty :param equipments: dictionary, where the key is the type of technique, and the value is the pool of techniques of that type

workers: dict[str, sampo.schemas.resources.Worker]#
equipments: dict[str, sampo.schemas.resources.Equipment]#
__post_init__()#
__hash__()#

Return hash(self).

serialize_workers(value)#
serialize_equipment(value)#
classmethod deserialize_workers(value)#
classmethod deserialize_equipment(value)#

Functions#

sampo.schemas.contractor.get_worker_contractor_pool(contractors: list[Contractor] | Contractor) WorkerContractorPool#

Gets agent dictionary from contractors list. Alias for frequently used functionality.

Parameters:

contractors – list of all the considered contractors

Returns:

Dictionary of workers by worker name, next by contractor id

sampo.schemas.contractor.get_contractor_for_resources_schedule(resources: pandas.DataFrame | list[dict[str, int]], contractor_capacity: int = DEFAULT_CONTRACTOR_CAPACITY, contractor_id: str = None, contractor_name: str = '') Contractor#

Generates a contractor, which satisfies the provided resources :param resources: list of resource requirements for each task :param contractor_id: ID of the new contractor. If None, a new UUID4 is generated :param contractor_name: Name of the new contractor. If None, an empty string should be passed :param contractor_capacity: Capacity of the generated contractor. It influences scale of resource capacities :return: A new contractor of the given type

Attributes#

sampo.schemas.contractor.WorkerContractorPool#
sampo.schemas.contractor.DEFAULT_CONTRACTOR_CAPACITY = 25#