INNER CODE UNIT · Python
unloaded_units
ikatsov/tensor-house · supply-chain/world_of_supply/world_of_supply_environment.py:112
unloaded_units = sum(unloaded.values())
self.destination.consumer.on_order_reception(self.source.id, self.product_id, unloaded_units)
self.payload = 0 # all units that were not sucessfully unloaded will be lost
def act(self, control):
if self.step > 0:
if self.location_pointer == 0 and self.payload == 0:
self.try_loading(self.requested_quantity)
if self.payload > 0: # will stay at the source until loaded
if self.location_pointer < len(self.path) - 1:
self.location_pointer += self.step
else:
self.step = -1 # arrived to the destination
if self.step < 0:
if self.location_pointer == len(self.path) - 1 and self.payload > 0:
self.try_unloading()