INNER CODE UNIT · Python

is_enroute

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

    def is_enroute(self):
        return self.destination is not None

    def current_location(self):
        if self.path == None:
            return (self.source.x, self.source.y)
        else:
            return self.path[self.location_pointer]
        
    def try_loading(self, quantity):
        if self.source.storage.try_take_units({ self.product_id: quantity }):
            self.payload = quantity
        
    def try_unloading(self):        
        unloaded = self.destination.storage.try_add_units({ self.product_id: self.payload }, all_or_nothing = False)
        if len(unloaded) > 0:
            unloaded_units = sum(unloaded.values())
            self.destination.consumer.on_order_reception(self.source.id, self.product_id, unloaded_units)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…