Cargo Generators#

class airlift.envs.generators.cargo_generators.CargoGenerator(num_initial_tasks, max_cargo_per_episode, max_stagger_steps=0, max_weight=1)#

Handles the generation of Cargo Tasks

generate_cargo_weight()#

Generates a random weight for a cargo.

class airlift.envs.generators.cargo_generators.CargoInfo(id: int, source_airport_id: int, end_airport_id: int, weight: float = 1, soft_deadline: int = 4294967296, hard_deadline: int = 4294967296, time_available: int = 0)#

Primarily used in testing purposes for the hard coded cargo generator. Properties resemble that of the Cargo class

end_airport_id: int#

Alias for field number 2

hard_deadline: int#

Alias for field number 5

id: int#

Alias for field number 0

soft_deadline: int#

Alias for field number 4

source_airport_id: int#

Alias for field number 1

time_available: int#

Alias for field number 6

weight: float#

Alias for field number 3

class airlift.envs.generators.cargo_generators.DynamicCargoGenerator(cargo_creation_rate: float, max_cargo_to_create: int, num_initial_tasks: int, soft_deadline_multiplier=1, hard_deadline_multiplier=1.5, dynamic_soft_deadline_multiplier=None, dynamic_hard_deadline_multiplier=None, max_stagger_steps=100, max_weight=1)#

Handles the dynamic generation of cargo using the Poisson process as utilized by Flatlands for train malfunctions

generate_dynamic_orders(elapsed_steps, max_cycles) List[Cargo]#

The EventGenerator controls whether a new dynamic cargo is generated or not using poisson distribution. Makes sure that the upperbound limit of max cargo generated per episode is also adhered to.

Returns:

cargo_task : a List that contains a single Cargo or an empty list if no cargo was generated

class airlift.envs.generators.cargo_generators.EarliestPickupCargoGenerator(num_of_tasks=1, soft_deadline_multiplier=1, hard_deadline_multiplier=1.5, time_step_interval=1, min_range=0, max_range=15000)#
generate_cargo_order(cargo_id, drop_off_airports: OrderedSet[Airport], pickup_airports: OrderedSet[Airport], time_available=0) Cargo#

Generates cargo orders based on several parameters. Takes into account if we are running a scenario with a concentrated drop off or pick up location as well as non-concentrated locations that utilize the entire map. The dynamic cargo generator accesses this function without going through the above generate_order function.

Parameters:
  • cargo_id – Incremental count of what cargo to create

  • drop_off_airports – List that contains all the airports that are drop off locations’

  • pick_up_airports – List that contains all the airports that are pick up locations

Returns:

cargo_task : A fully generated cargo task

class airlift.envs.generators.cargo_generators.HardcodedCargoGenerator(initialcargoinfo=None)#

A basic cargo generator that allows for the initialization of cargo using pre-determined values instead of the static or dynamic generators. Generally used for testing purposes.

generate_initial_orders() set#

Generates the initial hard-coded cargo values.

Returns:

initialcargo : A set that contains the cargo.

class airlift.envs.generators.cargo_generators.NoCargoGenerator#

Initialize an environment with no cargo. Generally used for testing purposes.

class airlift.envs.generators.cargo_generators.StaticCargoGenerator(num_of_tasks=1, soft_deadline_multiplier=50, hard_deadline_multiplier=100, max_stagger_steps=100, max_weight=1)#

Handles the generation of static cargo tasks. These are initialized upon the creation of the environment.

create_schedule(source, destination, soft_deadline_multiplier=None, hard_deadline_multiplier=None) Tuple[int, int]#

Creates a schedule that cargo must be delivered by for it to be considered late (soft deadline) or completely missed (hard deadline)

Parameters:
  • source – Source Airport

  • destination – Destination Airport

Returns:

(soft_deadline, hard_deadline) : Returns a tuple[int, int] containing soft/hard deadlines for cargo.

generate_cargo_order(cargo_id, drop_off_airports: OrderedSet[Airport], pickup_airports: OrderedSet[Airport], time_available=0, soft_deadline_multiplier=None, hard_deadline_multiplier=None) Cargo#

Generates cargo orders based on several parameters. Takes into account if we are running a scenario with a concentrated drop off or pick up location as well as non-concentrated locations that utilize the entire map. The dynamic cargo generator accesses this function without going through the above generate_order function.

Parameters:
  • cargo_id – Incremental count of what cargo to create

  • drop_off_airports – List that contains all the airports that are drop off locations’

  • pick_up_airports – List that contains all the airports that are pick up locations

Returns:

cargo_task : A fully generated cargo task

generate_initial_orders() list#

Generates static cargo orders upon creation of the environment.

Returns:

order_list - Returns a set that contains all the (static) generated cargo orders