INNER CODE UNIT · Python

schedule

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

    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

    def path_len(self):
        if self.path == None:
            return 0
        else:
            return len(self.path)
    
    def is_enroute(self):
        return self.destination is not None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…