sampo.generator.environment.contractor#

Overview#

Function#

_get_stochastic_counts(pack_count, sigma_scaler, proportions, available_types, rand)

Return random quantity of each type of resources. Random value is gotten from Gaussian distribution

_dict_subtract(d, subtractor)

param d:

dict[str:

get_contractor_with_equal_proportions(number_of_workers_in_contractors, number_of_contractors)

Generates a contractors list of specified length with specified capacities

get_contractor(pack_worker_count, sigma_scaler, index, worker_proportions, available_worker_types, rand)

Generates a contractor for a synthetic graph for a given resource scalar and generation parameters

Functions#

sampo.generator.environment.contractor._get_stochastic_counts(pack_count: float, sigma_scaler: float, proportions: dict[str, float] | None, available_types: list | None = None, rand: random.Random | None = None) dict[str, int]#

Return random quantity of each type of resources. Random value is gotten from Gaussian distribution

Parameters:
  • pack_count – The number of resource sets

  • sigma_scaler – parameter to calculate the scatter by Gaussian distribution with mean=0 amount from the

transferred proportions :param proportions: proportions of quantity for contractor resources to be scaled by pack_worker_count :param available_types: Worker types for generation, if a subset of worker_proportions is used, if None, all worker_proportions are used :param rand: Number generator with a fixed seed, or None for no fixed seed

sampo.generator.environment.contractor._dict_subtract(d: dict[str, float], subtractor: float) dict[str, float]#
Parameters:
  • d – dict[str:

  • float]

  • subtractor – float:

sampo.generator.environment.contractor.get_contractor_with_equal_proportions(number_of_workers_in_contractors: int or list[int], number_of_contractors: int = 1) list[sampo.schemas.contractor.Contractor]#

Generates a contractors list of specified length with specified capacities

Parameters:

number_of_workers_in_contractors – How many workers of all each contractor contains in itself.

One int for all or list[int] for each contractor. If list, its length should be equal to number_of_contractors :param number_of_contractors: Number of generated contractors. :returns: list with contractors

sampo.generator.environment.contractor.get_contractor(pack_worker_count: float, sigma_scaler: float | None = 0.1, index: int = 0, worker_proportions: dict[str, int] | None = WORKER_PROPORTIONS, available_worker_types: list | None = None, rand: random.Random | None = None) sampo.schemas.contractor.Contractor#

Generates a contractor for a synthetic graph for a given resource scalar and generation parameters

Parameters:
  • pack_worker_count – The number of resource sets

  • sigma_scaler – parameter to calculate the scatter by Gaussian distribution with mean=0 amount from the

transferred proportions :param index: a parameter for naming a contractor :param worker_proportions: proportions of quantity for contractor resources to be scaled by pack_worker_count :param available_worker_types: Worker types for generation, if a subset of worker_proportions is used, if None, all worker_proportions are used :param rand: Number generator with a fixed seed, or None for no fixed seed :returns: the contractor