overthesun / simoc

A scalable model of an interactive, off-world community
https://ngs.simoc.space/
GNU General Public License v3.0
2 stars 2 forks source link

"agent_logs" in step data has many repeats of same entries #69

Closed breathnach closed 5 years ago

breathnach commented 5 years ago

get_step calls game-runner.parse_step_data to get step data. The "agent_logs" returned by this has many many dublicate entries for agent_type "cabbage".

iurii-milovanov commented 5 years ago

Those are not duplicates. If the single_agent future is ON, an ABM creates only a single instance of an each agent type, but produces multiple step records depending on the amount of agents.

breathnach commented 5 years ago

The parse_step_data function previously returned "agent_type_counters","storage_capacities" and "agent_logs". I've now changed it so only "agent_type_counters" and "storage_capacities" are returned by default.

The following options are always returned, but if wanted could have option to filter out in future: {'user_id': 1, 'username': 'sinead', 'start_time': 1559046239, 'game_id': '7b966b7a', 'step_num': 3, 'hours_per_step': 1.0, 'is_terminated': 'False', 'time': 10800.0, 'termination_reason': None}

The info returned can be controlled from the front end by passing "parse_filters":[] to the get_step route. An empty list means none of the three are included.

An example of the output if the empty list is passed: {"2": {"user_id": 1, "username": "sinead", "start_time": 1559046596, "game_id": "139c995c", "step_num": 2, "hours_per_step": 1.0, "is_terminated": "False", "time": 7200.0, "termination_reason": null},"3": {"user_id": 1, "username": "sinead", "start_time": 1559046596, "game_id": "139c995c", "step_num": 3, "hours_per_step": 1.0, "is_terminated": "False", "time": 10800.0, "termination_reason": null}

an example of the default output: {"2": {"user_id": 1, "username": "sinead", "start_time": 1559046239, "game_id": "7b966b7a", "step_num": 2, "hours_per_step": 1.0, "is_terminated": "False", "time": 7200.0, "termination_reason": null, "agent_type_counters": [{"agent_type": "human_agent", "agent_counter": 2}, {"agent_type": "solid_waste_aerobic_bioreactor", "agent_counter": 1}, {"agent_type": "multifiltration_purifier_post_treament", "agent_counter": 1}, {"agent_type": "urine_recycling_processor_VCD", "agent_counter": 1}, {"agent_type": "oxygen_generation_SFWE", "agent_counter": 1}, {"agent_type": "co2_reduction_sabatier", "agent_counter": 1}, {"agent_type": "co2_removal_SAWD", "agent_counter": 1}, {"agent_type": "cabbage", "agent_counter": 100}, {"agent_type": "crew_habitat_small", "agent_counter": 1}, {"agent_type": "greenhouse_small", "agent_counter": 1}, {"agent_type": "solar_pv_array_mars", "agent_counter": 3}], "storage_capacities": [{"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_ch4", "value": 0.016031, "units": "kg", "capacity": 10000.0}, {"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_co2", "value": 3.7590000000000003, "units": "kg", "capacity": 10000.0}, {"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_h2", "value": 0.09609500000000001, "units": "kg", "capacity": 1000.0}, {"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_h2o", "value": 10.444000000000003, "units": "kg", "capacity": 1000.0}, {"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_n2", "value": 7886.0, "units": "kg", "capacity": 10000.0}, {"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_o2", "value": 2100.5363000000007, "units": "kg", "capacity": 10000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_2dd9641c", "currency": "h2o_potb", "value": 3999.3805182555784, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_2dd9641c", "currency": "h2o_totl", "value": 0.0, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_2dd9641c", "currency": "h2o_tret", "value": 0.68, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_2dd9641c", "currency": "h2o_urin", "value": 100.25670385395534, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_2dd9641c", "currency": "h2o_wste", "value": 98.63418926977687, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_77e95eb6", "currency": "h2o_potb", "value": 3999.3805182555784, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_77e95eb6", "currency": "h2o_totl", "value": 0.0, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_77e95eb6", "currency": "h2o_tret", "value": 996.6099999999999, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_77e95eb6", "currency": "h2o_urin", "value": 0.8083519269776878, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_77e95eb6", "currency": "h2o_wste", "value": 0.03212981744421907, "units": "kg", "capacity": 4000.0}, {"agent_type": "nutrient_storage", "agent_id": "StorageAgent_208ca56e", "currency": "sold_k", "value": 100.00122999999999, "units": "kg", "capacity": 1000.0}, {"agent_type": "nutrient_storage", "agent_id": "StorageAgent_208ca56e", "currency": "sold_n", "value": 100.00434999999999, "units": "kg", "capacity": 1000.0}, {"agent_type": "nutrient_storage", "agent_id": "StorageAgent_208ca56e", "currency": "sold_p", "value": 100.00052199999999, "units": "kg", "capacity": 1000.0}, {"agent_type": "nutrient_storage", "agent_id": "StorageAgent_208ca56e", "currency": "sold_wast", "value": 0.0, "units": "kg", "capacity": 1000.0}, {"agent_type": "food_storage", "agent_id": "StorageAgent_c82b123e", "currency": "food_edbl", "value": 999.6115212981745, "units": "kg", "capacity": 10000.0}, {"agent_type": "power_storage", "agent_id": "StorageAgent_3cb6c642", "currency": "enrg_kwh", "value": 0.01913052734500198, "units": "kWh", "capacity": 10000.0}]}, "3": {"user_id": 1, "username": "sinead", "start_time": 1559046239, "game_id": "7b966b7a", "step_num": 3, "hours_per_step": 1.0, "is_terminated": "False", "time": 10800.0, "termination_reason": null, "agent_type_counters": [{"agent_type": "human_agent", "agent_counter": 2}, {"agent_type": "solid_waste_aerobic_bioreactor", "agent_counter": 1}, {"agent_type": "multifiltration_purifier_post_treament", "agent_counter": 1}, {"agent_type": "urine_recycling_processor_VCD", "agent_counter": 1}, {"agent_type": "oxygen_generation_SFWE", "agent_counter": 1}, {"agent_type": "co2_reduction_sabatier", "agent_counter": 1}, {"agent_type": "co2_removal_SAWD", "agent_counter": 1}, {"agent_type": "cabbage", "agent_counter": 100}, {"agent_type": "crew_habitat_small", "agent_counter": 1}, {"agent_type": "greenhouse_small", "agent_counter": 1}, {"agent_type": "solar_pv_array_mars", "agent_counter": 3}], "storage_capacities": [{"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_ch4", "value": 0.019281, "units": "kg", "capacity": 10000.0}, {"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_co2", "value": 3.8885000000000005, "units": "kg", "capacity": 10000.0}, {"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_h2", "value": 0.141495, "units": "kg", "capacity": 1000.0}, {"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_h2o", "value": 10.666000000000004, "units": "kg", "capacity": 1000.0}, {"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_n2", "value": 7886.0, "units": "kg", "capacity": 10000.0}, {"agent_type": "air_storage", "agent_id": "StorageAgent_59d7f7e2", "currency": "atmo_o2", "value": 2100.804450000001, "units": "kg", "capacity": 10000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_2dd9641c", "currency": "h2o_potb", "value": 4000.0, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_2dd9641c", "currency": "h2o_totl", "value": 0.0, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_2dd9641c", "currency": "h2o_tret", "value": 0.0, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_2dd9641c", "currency": "h2o_urin", "value": 100.38505578093302, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_2dd9641c", "currency": "h2o_wste", "value": 97.9512839046653, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_77e95eb6", "currency": "h2o_potb", "value": 4000.0, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_77e95eb6", "currency": "h2o_totl", "value": 0.0, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_77e95eb6", "currency": "h2o_tret", "value": 994.9149999999998, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_77e95eb6", "currency": "h2o_urin", "value": 0.9367038539553753, "units": "kg", "capacity": 4000.0}, {"agent_type": "water_storage", "agent_id": "StorageAgent_77e95eb6", "currency": "h2o_wste", "value": 0.06425963488843814, "units": "kg", "capacity": 4000.0}, {"agent_type": "nutrient_storage", "agent_id": "StorageAgent_208ca56e", "currency": "sold_k", "value": 100.00184499999999, "units": "kg", "capacity": 1000.0}, {"agent_type": "nutrient_storage", "agent_id": "StorageAgent_208ca56e", "currency": "sold_n", "value": 100.00652499999998, "units": "kg", "capacity": 1000.0}, {"agent_type": "nutrient_storage", "agent_id": "StorageAgent_208ca56e", "currency": "sold_p", "value": 100.00078299999998, "units": "kg", "capacity": 1000.0}, {"agent_type": "nutrient_storage", "agent_id": "StorageAgent_208ca56e", "currency": "sold_wast", "value": 0.0, "units": "kg", "capacity": 1000.0}, {"agent_type": "food_storage", "agent_id": "StorageAgent_c82b123e", "currency": "food_edbl", "value": 999.4172819472617, "units": "kg", "capacity": 10000.0}, {"agent_type": "power_storage", "agent_id": "StorageAgent_3cb6c642", "currency": "enrg_kwh", "value": 3.7924872384463346, "units": "kWh", "capacity": 10000.0}]}