INNER CODE UNIT · Python

__init__

ikatsov/tensor-house · supply-chain/world_of_supply/world_of_supply_environment.py:71

    def __init__(self, source, economy):
        self.source = source
        self.destination = None
        self.path = None
        self.location_pointer = 0
        self.step = 0
        self.payload = 0 # units
        self.economy = economy

    def schedule(self, world, destination, product_id, quantity):
        self.destination = destination
        self.product_id = product_id
        self.requested_quantity = quantity
        self.path = world.find_path(self.source.x, self.source.y, self.destination.x, self.destination.y)
        if self.path == None:
            raise Exception(f"Destination {destination} is unreachable")
        self.step = 1    # 1 - to destination, -1 - to source, 0 - finished
        self.location_pointer = 0

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…