Skip to content

Commit

Permalink
fix simulation runs wrong reporting learning_mode
Browse files Browse the repository at this point in the history
set the current episode correctly in run_learning
set learning_mode once, now that we have it in outputs directly
add simulation_id to tqdm
remove learning_mode from outputs
fix query if accepted_price is not float (whysoever)
  • Loading branch information
maurerle committed Sep 19, 2023
1 parent e2af08c commit cc598c6
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions assume/common/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def write_rl_params(self, rl_params):
if df.empty:
return
df["simulation"] = self.simulation_id
df["learning_mode"] = self.learning_mode
# get characters after last "_" of simulation id string
df["episode"] = self.episode
self.write_dfs["rl_params"].append(df)
Expand Down
2 changes: 1 addition & 1 deletion assume/common/scenario_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def run_learning(world: World, inputs_path: str, scenario: str, study_case: str)
inputs_path,
scenario,
study_case,
episode=world.learning_role.episodes_done,
episode=episode,
disable_learning=False,
)
# give the newly created rl_agent the buffer that we stored from the beginning
Expand Down
1 change: 0 additions & 1 deletion assume/common/units_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ def write_learning_to_output(self, start: datetime, marketconfig: MarketConfig):
"profit": unit.outputs["profit"].loc[start],
"reward": unit.outputs["reward"].loc[start],
"regret": unit.outputs["regret"].loc[start],
"learning_mode": unit.outputs["learning_mode"].loc[start],
"unit": unit_id,
}
noise_tuple = unit.outputs["rl_exploration_noise"].loc[start]
Expand Down
1 change: 0 additions & 1 deletion assume/strategies/learning_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ def calculate_reward(
unit.outputs["profit"].loc[start:end_excl] += float(profit)
unit.outputs["reward"].loc[start:end_excl] = reward
unit.outputs["regret"].loc[start:end_excl] = float(opportunity_cost)
unit.outputs["learning_mode"].loc[start:end_excl] = self.learning_mode

def load_actor_params(self, load_path):
"""
Expand Down
3 changes: 2 additions & 1 deletion assume/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ async def async_run(self, start_ts, end_ts):
if delta:
pbar.update(delta)
pbar.set_description(
f"{datetime.utcfromtimestamp(self.clock.time)}", refresh=False
f"{self.output_role.simulation_id} {datetime.utcfromtimestamp(self.clock.time)}",
refresh=False,
)
else:
self.clock.set_time(end_ts)
Expand Down
2 changes: 1 addition & 1 deletion docker_configs/dashboard-definitions/ASSUME.json
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@
],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n $__timeGroupAlias(start_time,$__interval),\n avg(accepted_price) AS \" \",\n bid_id AS \"bid_id\"\nFROM market_orders\nWHERE\n $__timeFilter(start_time) AND\n market_id = '$market' AND\n simulation = '$simulation'\nGROUP BY 1, bid_id\nORDER BY 1",
"rawSql": "SELECT\n $__timeGroupAlias(start_time,$__interval),\n avg(accepted_price::float) AS \" \",\n bid_id AS \"bid_id\"\nFROM market_orders\nWHERE\n $__timeFilter(start_time) AND\n market_id = '$market' AND\n simulation = '$simulation'\nGROUP BY 1, bid_id\nORDER BY 1",
"refId": "A",
"select": [
[
Expand Down

0 comments on commit cc598c6

Please sign in to comment.