DND-DRDC-RDDC / OS_ORIGAME

ORIGAME is a Python-based discrete event modelling and simulation environment. It has a full-featured graphical user interface (GUI) in which users build models and run Monte Carlo simulations.
GNU General Public License v3.0
6 stars 1 forks source link

Batch Sim Not Functioning #2

Closed ryan-ambrose-gc closed 1 year ago

ryan-ambrose-gc commented 1 year ago

Summary

Currently, it appears as though the batch simulation is not working for either console or GUI versions of ORIGAME out-of-the-box. Whenever a batch run is started, it invariably fails due to AttributeError: 'tuple' object has no attribute 'scenario_def'.

Details

As far as I can tell, the issue is with the ScenarioManager class found within manager.py. Within the load function, the scenario file is loaded into a Scenario object to be used throughout the batch process. However, the load method returns a tuple containing this Scenario object and a _non_serializedobject (presumably, to handle some unexpected things from the depickling process?). During the batch processing, it appears as though the code expects the output of ScenarioManager to be just the Scenario object.

This can be seen in bg_replication.py in the Replication class, within the init process. Just under the comment to "load scenario" (line 436) ScenarioManager() is called. The load method is called and stored within "scen" which then has attributes called, breaking the simulation as ScenarioManager returns a tuple. This occurs again in batch_sim_manager.py in the _BsmStateRunning class in the __gen_and_save_batch_data method. Again, the result of ScenioManager.load() is stored within "scen" which is then treated as a Scenario object, not a tuple.

Potential Solution

  1. Simply pulling the Scenario object from the tuple in the two instances separately resolves the issue.
  2. Change the load method of ScenarioManager to just output the Scenario object, not a tuple

I'm not sure the best approach to take, as I'm not sure if/when non_serialized_obj is used within the batch mode.