As mentioned here, the VariableKiosk handles its own updates for external states. To make the architecture cleaner and more flexible (especially for ML), we want to move this responsibility to the Engine. This turns the Kiosk into a simple data container and lets the Engine orchestrate the data flow.
Proposed Change
Modify the Engine to accept an update_external_states function. This function will be called during initialization and at every simulation step.
class Engine:
def __init__(self, update_external_states, ...):
self.kiosk = VariableKiosk()
self.update_external_states = update_external_states
# Initial state update
if self.update_external_states:
self.update_external_states(self.start_date, self.kiosk)
def _run(self):
self.day, delt = self.timer()
# Update states at each timestep
if self.update_external_states:
self.update_external_states(self.day, self.kiosk)
# Continue with simulation...
This will require the following modifications:
As mentioned here, the
VariableKioskhandles its own updates for external states. To make the architecture cleaner and more flexible (especially for ML), we want to move this responsibility to theEngine. This turns the Kiosk into a simple data container and lets the Engine orchestrate the data flow.Proposed Change
Modify the
Engineto accept anupdate_external_statesfunction. This function will be called during initialization and at every simulation step.This will require the following modifications:
update_external_statesargument toEngine.__init__and_run.VariableKiosk.__call__.