From caabadba66476157f893317c1e699a3166f05b65 Mon Sep 17 00:00:00 2001 From: Nick Harder <56074305+nick-harder@users.noreply.github.com> Date: Mon, 25 Sep 2023 17:54:52 +0200 Subject: [PATCH] Disable writing data during learning process (#205) * no more outputs written when learning * separate setting for learning output * adjusted learning dashboard --- assume/common/outputs.py | 63 +- assume/common/units_operator.py | 39 +- assume/markets/base_market.py | 28 +- assume/world.py | 31 +- .../ASSUME Comparison.json | 2 +- .../dashboard-definitions/ASSUME.json | 154 +-- .../ASSUME_Learning.json | 884 ++++++++++++------ examples/inputs/example_01_rl/config.yaml | 4 +- 8 files changed, 813 insertions(+), 392 deletions(-) diff --git a/assume/common/outputs.py b/assume/common/outputs.py index 392644f8..61f47f3b 100644 --- a/assume/common/outputs.py +++ b/assume/common/outputs.py @@ -9,7 +9,7 @@ from mango import Role from pandas.api.types import is_numeric_dtype from sqlalchemy import inspect, text -from sqlalchemy.exc import ProgrammingError +from sqlalchemy.exc import OperationalError, ProgrammingError logger = logging.getLogger(__name__) @@ -339,52 +339,45 @@ async def on_stop(self): # insert left records into db await self.store_dfs() + if self.db is None: return + queries = [ f"select 'avg_price' as variable, market_id as ident, avg(price) as value from market_meta where simulation = '{self.simulation_id}' group by market_id", f"select 'total_cost' as variable, market_id as ident, sum(price*demand_volume_energy) as value from market_meta where simulation = '{self.simulation_id}' group by market_id", f"select 'total_volume' as variable, market_id as ident, sum(demand_volume_energy) as value from market_meta where simulation = '{self.simulation_id}' group by market_id", f"select 'capacity_factor' as variable, market_id as ident, avg(power/max_power) as value from market_dispatch ud join power_plant_meta um on ud.unit_id = um.\"index\" and ud.simulation=um.simulation where um.simulation = '{self.simulation_id}' group by variable, market_id", + f"SELECT 'sum_reward' as variable, simulation as ident, sum(reward) as value FROM rl_params WHERE episode='{self.episode}' AND simulation='{self.simulation_id}' GROUP BY simulation", + f"SELECT 'sum_regret' as variable, simulation as ident, sum(regret) as value FROM rl_params WHERE episode='{self.episode}' AND simulation='{self.simulation_id}' GROUP BY simulation", + f"SELECT 'sum_profit' as variable, simulation as ident, sum(profit) as value FROM rl_params WHERE episode='{self.episode}' AND simulation='{self.simulation_id}' GROUP BY simulation", ] - dfs = [] - learning_queries = self.learning_queries() - if learning_queries: - queries.extend(learning_queries) - - try: - for query in queries: + dfs = [] + for query in queries: + try: df = pd.read_sql(query, self.db) - dfs.append(df) - df = pd.concat(dfs) - df.reset_index() - df["simulation"] = self.simulation_id - if self.export_csv_path: - kpi_data_path = self.p.joinpath("kpis.csv") - df.to_csv( - kpi_data_path, - mode="a", - header=not kpi_data_path.exists(), - index=None, - ) - if self.db is not None and not df.empty: - with self.db.begin() as db: - df.to_sql("kpis", self.db, if_exists="append", index=None) - except ProgrammingError as e: - self.db.rollback() - logger.error(f"No scenario run Yet {e}") + except OperationalError: + continue - def learning_queries(self): - if not self.learning_mode: - return [] + dfs.append(df) - queries = [ - f"SELECT 'sum_reward' as variable, simulation as ident, sum(reward) as value FROM rl_params WHERE episode='{self.episode}' AND simulation='{self.simulation_id}' GROUP BY simulation", - f"SELECT 'sum_regret' as variable, simulation as ident, sum(regret) as value FROM rl_params WHERE episode='{self.episode}' AND simulation='{self.simulation_id}' GROUP BY simulation", - f"SELECT 'sum_profit' as variable, simulation as ident, sum(profit) as value FROM rl_params WHERE episode='{self.episode}' AND simulation='{self.simulation_id}' GROUP BY simulation", - ] - return queries + df = pd.concat(dfs) + df.reset_index() + df["simulation"] = self.simulation_id + + if self.export_csv_path: + kpi_data_path = self.p.joinpath("kpis.csv") + df.to_csv( + kpi_data_path, + mode="a", + header=not kpi_data_path.exists(), + index=None, + ) + + if self.db is not None and not df.empty: + with self.db.begin() as db: + df.to_sql("kpis", self.db, if_exists="append", index=None) def get_sum_reward(self): query = text( diff --git a/assume/common/units_operator.py b/assume/common/units_operator.py index 98ac0fd0..952ec4a0 100644 --- a/assume/common/units_operator.py +++ b/assume/common/units_operator.py @@ -231,6 +231,10 @@ def write_actual_dispatch(self): data["unit"] = unit_id unit_dispatch_dfs.append(data) + self.valid_orders = list( + filter(lambda x: x["end_time"] >= now, self.valid_orders) + ) + db_aid = self.context.data_dict.get("output_agent_id") db_addr = self.context.data_dict.get("output_agent_addr") if db_aid and db_addr: @@ -255,10 +259,6 @@ def write_actual_dispatch(self): }, ) - self.valid_orders = list( - filter(lambda x: x["end_time"] >= now, self.valid_orders) - ) - async def submit_bids(self, opening: OpeningMessage): """ formulates an orderbook and sends it to the market. @@ -394,8 +394,9 @@ def write_learning_to_output(self, start: datetime, marketconfig: MarketConfig): output_dict[f"actions_{i}"] = action_tuple[i] output_agent_list.append(output_dict) - db_aid = self.context.data_dict.get("output_agent_id") - db_addr = self.context.data_dict.get("output_agent_addr") + + db_aid = self.context.data_dict.get("learning_output_agent_id") + db_addr = self.context.data_dict.get("learning_output_agent_addr") if db_aid and db_addr: self.context.schedule_instant_acl_message( receiver_id=db_aid, @@ -416,9 +417,6 @@ def write_to_learning( device: str, learning_unit_count: int, ): - learning_role_id = "learning_agent" - learning_role_addr = self.context.addr - all_observations = [] all_rewards = [] try: @@ -426,7 +424,6 @@ def write_to_learning( except ImportError: logger.error("tried writing learning_params, but torch is not installed") - all_actions = np.zeros((learning_unit_count, act_dim)) return all_observations = th.zeros((learning_unit_count, obs_dim), device=device) @@ -450,15 +447,19 @@ def write_to_learning( all_rewards = np.array(all_rewards) rl_agent_data = (np.array(all_observations), all_actions, all_rewards) - self.context.schedule_instant_acl_message( - receiver_id=learning_role_id, - receiver_addr=learning_role_addr, - content={ - "context": "rl_training", - "type": "replay_buffer", - "data": rl_agent_data, - }, - ) + learning_role_id = self.context.data_dict.get("learning_agent_id") + learning_role_addr = self.context.data_dict.get("learning_agent_addr") + + if learning_role_id and learning_role_addr: + self.context.schedule_instant_acl_message( + receiver_id=learning_role_id, + receiver_addr=learning_role_addr, + content={ + "context": "rl_training", + "type": "replay_buffer", + "data": rl_agent_data, + }, + ) def write_learning_params(self, orderbook: Orderbook, marketconfig: MarketConfig): """ diff --git a/assume/markets/base_market.py b/assume/markets/base_market.py index bd60c072..af49a802 100644 --- a/assume/markets/base_market.py +++ b/assume/markets/base_market.py @@ -406,15 +406,17 @@ async def store_order_book(self, orderbook: Orderbook): :param orderbook: The order book to be stored :type orderbook: Orderbook """ - message = { - "context": "write_results", - "type": "store_order_book", - "sender": self.marketconfig.name, - "data": orderbook, - } + db_aid = self.context.data_dict.get("output_agent_id") db_addr = self.context.data_dict.get("output_agent_addr") + if db_aid and db_addr: + message = { + "context": "write_results", + "type": "store_order_book", + "sender": self.marketconfig.name, + "data": orderbook, + } await self.context.send_acl_message( receiver_id=db_aid, receiver_addr=db_addr, @@ -429,15 +431,17 @@ async def store_market_results(self, market_meta): :param market_meta: The metadata of the market :type market_meta: any """ - message = { - "context": "write_results", - "type": "store_market_results", - "sender": self.marketconfig.name, - "data": market_meta, - } + db_aid = self.context.data_dict.get("output_agent_id") db_addr = self.context.data_dict.get("output_agent_addr") + if db_aid and db_addr: + message = { + "context": "write_results", + "type": "store_market_results", + "sender": self.marketconfig.name, + "data": market_meta, + } await self.context.send_acl_message( receiver_id=db_aid, receiver_addr=db_addr, diff --git a/assume/world.py b/assume/world.py index a4ae873f..2fb01889 100644 --- a/assume/world.py +++ b/assume/world.py @@ -13,7 +13,6 @@ from mango.util.termination_detection import tasks_complete_or_sleeping from sqlalchemy import create_engine from sqlalchemy.exc import OperationalError -from sqlalchemy.orm import scoped_session, sessionmaker from tqdm import tqdm from assume.common import ( @@ -158,7 +157,10 @@ async def setup_learning(self): # if self.same_process: # separate process does not support buffer and learning if True: - rl_agent = RoleAgent(self.container, suggested_aid="learning_agent") + self.learning_agent_addr = (self.addr, "learning_agent") + rl_agent = RoleAgent( + self.container, suggested_aid=self.learning_agent_addr[1] + ) rl_agent.add_role(self.learning_role) else: @@ -220,10 +222,19 @@ def add_unit_operator( self.unit_operators[id] = units_operator # after creation of an agent - we set additional context params - unit_operator_agent._role_context.data_dict = { - "output_agent_addr": self.output_agent_addr[0], - "output_agent_id": self.output_agent_addr[1], - } + unit_operator_agent._role_context.data_dict = {} + if self.learning_mode: + unit_operator_agent._role_context.data_dict = { + "learning_output_agent_addr": self.output_agent_addr[0], + "learning_output_agent_id": self.output_agent_addr[1], + "learning_agent_addr": self.learning_agent_addr[0], + "learning_agent_id": self.learning_agent_addr[1], + } + else: + unit_operator_agent._role_context.data_dict = { + "output_agent_addr": self.output_agent_addr[0], + "output_agent_id": self.output_agent_addr[1], + } async def async_add_unit( self, @@ -313,8 +324,12 @@ def add_market_operator( # after creation of an agent - we set additional context params market_operator_agent._role_context.data_dict = { - "output_agent_addr": self.output_agent_addr[0], - "output_agent_id": self.output_agent_addr[1], + "output_agent_addr": None + if self.learning_mode + else self.output_agent_addr[0], + "output_agent_id": None + if self.learning_mode + else self.output_agent_addr[1], } self.market_operators[id] = market_operator_agent diff --git a/docker_configs/dashboard-definitions/ASSUME Comparison.json b/docker_configs/dashboard-definitions/ASSUME Comparison.json index dbbf3919..14a7d72a 100644 --- a/docker_configs/dashboard-definitions/ASSUME Comparison.json +++ b/docker_configs/dashboard-definitions/ASSUME Comparison.json @@ -2329,7 +2329,7 @@ }, "timepicker": {}, "timezone": "", - "title": "ASSUME Comparison", + "title": "ASSUME: Compare scenarios", "uid": "vP8U8-q4k", "version": 2, "weekStart": "" diff --git a/docker_configs/dashboard-definitions/ASSUME.json b/docker_configs/dashboard-definitions/ASSUME.json index e6eb9d40..573adaaf 100644 --- a/docker_configs/dashboard-definitions/ASSUME.json +++ b/docker_configs/dashboard-definitions/ASSUME.json @@ -365,7 +365,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -381,7 +382,7 @@ "h": 9, "w": 12, "x": 0, - "y": 296 + "y": 32 }, "id": 19, "options": { @@ -558,7 +559,7 @@ "h": 9, "w": 12, "x": 12, - "y": 296 + "y": 32 }, "id": 20, "options": { @@ -678,7 +679,7 @@ "h": 1, "w": 24, "x": 0, - "y": 305 + "y": 41 }, "id": 74, "panels": [], @@ -767,7 +768,7 @@ "h": 12, "w": 10, "x": 0, - "y": 306 + "y": 42 }, "id": 72, "options": { @@ -803,7 +804,7 @@ "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n simulation,\n sum(round(CAST(value AS numeric), 2)) FILTER (WHERE variable = 'total_cost') as \"Total cost\",\n sum(round(CAST(value AS numeric), 2)) FILTER (WHERE variable = 'total_volume') as \"Total volume\"\nFROM kpis\ngroup by simulation\nORDER BY simulation", + "rawSql": "SELECT\n simulation,\n sum(round(CAST(value AS numeric), 2)) FILTER (WHERE variable = 'total_cost') as \"Total cost\",\n sum(round(CAST(value AS numeric), 2)) FILTER (WHERE variable = 'total_volume') as \"Total volume\"\nFROM kpis\nWHERE simulation = '$simulation'\ngroup by simulation", "refId": "Cost", "select": [ [ @@ -901,7 +902,7 @@ "h": 12, "w": 9, "x": 10, - "y": 306 + "y": 42 }, "id": 76, "options": { @@ -986,7 +987,7 @@ "h": 12, "w": 5, "x": 19, - "y": 306 + "y": 42 }, "id": 7, "options": { @@ -1079,7 +1080,7 @@ "h": 3, "w": 24, "x": 0, - "y": 318 + "y": 54 }, "id": 22, "options": { @@ -1134,7 +1135,7 @@ "h": 1, "w": 24, "x": 0, - "y": 321 + "y": 57 }, "id": 41, "panels": [], @@ -1189,7 +1190,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1205,7 +1207,7 @@ "h": 9, "w": 18, "x": 0, - "y": 322 + "y": 58 }, "id": 24, "options": { @@ -1322,7 +1324,7 @@ "h": 9, "w": 6, "x": 18, - "y": 322 + "y": 58 }, "id": 26, "options": { @@ -1453,7 +1455,7 @@ "h": 8, "w": 12, "x": 0, - "y": 331 + "y": 67 }, "id": 70, "options": { @@ -1474,6 +1476,39 @@ }, "pluginVersion": "9.2.15", "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "P7B13B9DF907EC40C" + }, + "format": "time_series", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n avg(accepted_price::float) AS \"Accepted price:\",\r\n concat(unit_id, ' - ', market_id) as \"unit_id\"\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time) AND\r\n unit_id in ($Gen_Units) AND\r\n simulation = '$simulation'\r\nGROUP BY 1, unit_id, market_id\r\nORDER BY 1\r\n", + "refId": "B", + "select": [ + [ + { + "params": [ + "power" + ], + "type": "column" + } + ] + ], + "table": "market_dispatch", + "timeColumn": "datetime", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, { "datasource": { "type": "postgres", @@ -1497,7 +1532,7 @@ ], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n accepted_price AS \"Accepted price:\",\r\n price AS \"Bid price:\",\r\n concat(unit_id, ' - ', market_id) as \"unit_id\"\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time) AND\r\n unit_id in ($Gen_Units) AND\r\n simulation = '$simulation'\r\nGROUP BY 1, unit_id, market_id, price, accepted_price\r\nORDER BY 1", + "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n price AS \"Bid price:\",\r\n unit_id as \"unit_id\",\r\n bid_id as \"bid_id\"\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time) AND\r\n unit_id in ($Gen_Units) AND\r\n simulation = '$simulation'\r\nGROUP BY 1, unit_id, market_id, price, bid_id\r\nORDER BY 1", "refId": "A", "select": [ [ @@ -1661,7 +1696,7 @@ "h": 8, "w": 12, "x": 12, - "y": 331 + "y": 67 }, "id": 78, "options": { @@ -1723,7 +1758,7 @@ "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n avg(volume) AS \"Bid volume:\",\r\n unit_id\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time) AND\r\n unit_id in ($Gen_Units) AND\r\n simulation = '$simulation'\r\nGROUP BY 1, unit_id\r\nORDER BY 1", + "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n volume AS \"Bid volume:\",\r\n unit_id as \"unit_id\",\r\n bid_id as \"bid_id\"\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time) AND\r\n unit_id in ($Gen_Units) AND\r\n simulation = '$simulation'\r\nGROUP BY 1, unit_id, market_id, volume, bid_id\r\nORDER BY 1", "refId": "B", "select": [ [ @@ -1813,7 +1848,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1844,7 +1880,7 @@ "h": 9, "w": 24, "x": 0, - "y": 339 + "y": 75 }, "id": 82, "options": { @@ -1941,7 +1977,7 @@ "h": 1, "w": 24, "x": 0, - "y": 348 + "y": 84 }, "id": 39, "panels": [], @@ -1993,7 +2029,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2009,7 +2046,7 @@ "h": 9, "w": 18, "x": 0, - "y": 349 + "y": 85 }, "id": 36, "options": { @@ -2125,7 +2162,7 @@ "h": 9, "w": 6, "x": 18, - "y": 349 + "y": 85 }, "id": 37, "options": { @@ -2226,7 +2263,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2255,7 +2293,7 @@ "h": 9, "w": 12, "x": 0, - "y": 358 + "y": 94 }, "id": 89, "options": { @@ -2299,7 +2337,7 @@ ], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n accepted_price AS \"Accepted price:\",\r\n price AS \"Bid price:\",\r\n concat(unit_id, ' - ', market_id) as \"unit_id\"\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time) AND\r\n unit_id in ($Demand_Units) AND\r\n simulation = '$simulation'\r\nGROUP BY 1, unit_id, market_id, price, accepted_price\r\nORDER BY 1", + "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n avg(accepted_price::float) AS \"Accepted price:\",\r\n price AS \"Bid price:\",\r\n concat(unit_id, ' - ', market_id) as \"unit_id\"\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time) AND\r\n unit_id in ($Demand_Units) AND\r\n simulation = '$simulation'\r\nGROUP BY 1, unit_id, market_id, price\r\nORDER BY 1", "refId": "A", "select": [ [ @@ -2463,7 +2501,7 @@ "h": 9, "w": 12, "x": 12, - "y": 358 + "y": 94 }, "id": 90, "options": { @@ -2615,7 +2653,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2647,7 +2686,7 @@ "h": 9, "w": 24, "x": 0, - "y": 367 + "y": 103 }, "id": 86, "options": { @@ -2743,7 +2782,7 @@ "h": 1, "w": 24, "x": 0, - "y": 376 + "y": 112 }, "id": 44, "panels": [], @@ -2795,7 +2834,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -2811,7 +2851,7 @@ "h": 9, "w": 18, "x": 0, - "y": 377 + "y": 113 }, "id": 65, "options": { @@ -2927,7 +2967,7 @@ "h": 9, "w": 6, "x": 18, - "y": 377 + "y": 113 }, "id": 47, "options": { @@ -3027,7 +3067,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -3043,7 +3084,7 @@ "h": 9, "w": 24, "x": 0, - "y": 386 + "y": 122 }, "id": 80, "options": { @@ -3163,7 +3204,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -3192,7 +3234,7 @@ "h": 9, "w": 12, "x": 0, - "y": 395 + "y": 131 }, "id": 91, "options": { @@ -3400,7 +3442,7 @@ "h": 9, "w": 12, "x": 12, - "y": 395 + "y": 131 }, "id": 92, "options": { @@ -3552,7 +3594,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -3584,7 +3627,7 @@ "h": 9, "w": 24, "x": 0, - "y": 404 + "y": 140 }, "id": 84, "options": { @@ -3684,21 +3727,21 @@ { "current": { "selected": false, - "text": "example_01a_base", - "value": "example_01a_base" + "text": "example_01_rl_base", + "value": "example_01_rl_base" }, "datasource": { "type": "postgres", "uid": "P7B13B9DF907EC40C" }, - "definition": "-- this construct is needed to execute a join query if rl_params exist\n-- else execute a query without a join on rl_params\nCREATE OR REPLACE FUNCTION get_simulation_data()\nRETURNS TABLE (\n market_simulation TEXT\n) AS $$\nBEGIN\n IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'rl_params') THEN\n -- Table rl_params exists, execute the join query\n RETURN QUERY EXECUTE '\n SELECT DISTINCT\n m.simulation AS market_simulation\n FROM \n market_meta m\n LEFT OUTER JOIN\n rl_params o\n ON\n m.simulation = o.simulation\n WHERE\n o.learning_mode is not true\n ';\n ELSE\n -- Table rl_params doesn't exist, execute the query for market_meta only\n RETURN QUERY EXECUTE '\n SELECT DISTINCT\n simulation AS market_simulation\n FROM \n market_meta\n ';\n END IF;\nEND;\n$$ LANGUAGE plpgsql;\n\nSELECT * FROM get_simulation_data();\n", + "definition": "SELECT simulation\nFROM market_meta", "description": "Can choose which simulation we want to show ", "hide": 0, "includeAll": false, "multi": false, "name": "simulation", "options": [], - "query": "-- this construct is needed to execute a join query if rl_params exist\n-- else execute a query without a join on rl_params\nCREATE OR REPLACE FUNCTION get_simulation_data()\nRETURNS TABLE (\n market_simulation TEXT\n) AS $$\nBEGIN\n IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'rl_params') THEN\n -- Table rl_params exists, execute the join query\n RETURN QUERY EXECUTE '\n SELECT DISTINCT\n m.simulation AS market_simulation\n FROM \n market_meta m\n LEFT OUTER JOIN\n rl_params o\n ON\n m.simulation = o.simulation\n WHERE\n o.learning_mode is not true\n ';\n ELSE\n -- Table rl_params doesn't exist, execute the query for market_meta only\n RETURN QUERY EXECUTE '\n SELECT DISTINCT\n simulation AS market_simulation\n FROM \n market_meta\n ';\n END IF;\nEND;\n$$ LANGUAGE plpgsql;\n\nSELECT * FROM get_simulation_data();\n", + "query": "SELECT simulation\nFROM market_meta", "refresh": 2, "regex": "", "skipUrlSync": false, @@ -3731,9 +3774,15 @@ }, { "current": { - "selected": false, - "text": "Unit 1", - "value": "Unit 1" + "selected": true, + "text": [ + "Unit 1", + "Unit 3" + ], + "value": [ + "Unit 1", + "Unit 3" + ] }, "datasource": { "type": "postgres", @@ -3813,21 +3862,16 @@ }, "timepicker": { "refresh_intervals": [ - "5s", - "10s", - "30s", "1m", "5m", "15m", "30m", - "1h", - "2h", - "1d" + "1h" ] }, "timezone": "", - "title": "ASSUME", + "title": "ASSUME: Main overview", "uid": "mQ3Lvkr4k", - "version": 12, + "version": 6, "weekStart": "" } diff --git a/docker_configs/dashboard-definitions/ASSUME_Learning.json b/docker_configs/dashboard-definitions/ASSUME_Learning.json index a2caeede..1357d080 100644 --- a/docker_configs/dashboard-definitions/ASSUME_Learning.json +++ b/docker_configs/dashboard-definitions/ASSUME_Learning.json @@ -303,7 +303,7 @@ "group": [], "metricColumn": "simulation", "rawQuery": true, - "rawSql": "SELECT\n datetime,\n simulation,\n unit,\n episode,\n reward\nFROM rl_params\nwhere simulation like ${simulation} || '_%'\nand learning_mode is true", + "rawSql": "SELECT\n datetime,\n simulation,\n unit,\n episode,\n reward\nFROM rl_params\nwhere simulation like '${simulation}' || '_%'\nand learning_mode is true", "refId": "A", "select": [ [ @@ -535,7 +535,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "-- this query creates a cumulative sum of the reward until now\r\nSELECT \r\n $__timeGroupAlias(datetime,$__interval),\r\n 'episode ' || episode AS \"episode\",\r\n sum(sum(reward)) OVER (PARTITION BY episode ORDER BY datetime) AS \"reward\"\r\nFROM\r\n rl_params\r\nWHERE\r\n $__timeFilter(datetime) \r\n and simulation like ${simulation} || '_%'\r\nGROUP BY 1, datetime, episode\r\nORDER BY 1", + "rawSql": "-- this query creates a cumulative sum of the reward until now\r\nSELECT \r\n $__timeGroupAlias(datetime,$__interval),\r\n 'episode ' || episode AS \"episode\",\r\n sum(sum(reward)) OVER (PARTITION BY episode ORDER BY datetime) AS \"reward\"\r\nFROM\r\n rl_params\r\nWHERE\r\n $__timeFilter(datetime) \r\n and simulation like '${simulation}' || '_%'\r\nGROUP BY 1, datetime, episode\r\nORDER BY 1", "refId": "A", "select": [ [ @@ -649,7 +649,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT \r\n $__timeGroupAlias(datetime,$__interval),\r\n 'episode ' || episode AS \"episode\",\r\n sum(sum(profit)) OVER (PARTITION BY episode ORDER BY datetime) AS \"profit\"\r\nFROM\r\n rl_params\r\nWHERE\r\n $__timeFilter(datetime)\r\n and simulation like ${simulation} || '_%'\r\nGROUP BY 1, datetime, episode\r\nORDER BY 1", + "rawSql": "SELECT \r\n $__timeGroupAlias(datetime,$__interval),\r\n 'episode ' || episode AS \"episode\",\r\n sum(sum(profit)) OVER (PARTITION BY episode ORDER BY datetime) AS \"profit\"\r\nFROM\r\n rl_params\r\nWHERE\r\n $__timeFilter(datetime)\r\n and simulation like '${simulation}' || '_%'\r\nGROUP BY 1, datetime, episode\r\nORDER BY 1", "refId": "A", "select": [ [ @@ -763,7 +763,7 @@ "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n avg(accepted_volume/volume) AS \"accepted_volume\",\r\n 'episode ' || simulation AS \"episode\"\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time)\r\n and simulation like ${simulation} || '_%'\r\nGROUP BY 1, start_time, episode\r\nORDER BY 1", + "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n avg(accepted_volume/volume) AS \"accepted_volume\"\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time)\r\n and simulation = '$simulation'\r\nGROUP BY 1, start_time\r\nORDER BY 1", "refId": "B", "select": [ [ @@ -896,40 +896,26 @@ "type": "postgres", "uid": "P7B13B9DF907EC40C" }, - "description": "", "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" + "mode": "thresholds" }, "custom": { "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, + "fillOpacity": 80, "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false }, - "lineInterpolation": "linear", "lineWidth": 1, - "pointSize": 5, "scaleDistribution": { "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" } }, "mappings": [], @@ -947,70 +933,511 @@ ] } }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "reward (mean)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + } + ] }, "gridPos": { - "h": 12, + "h": 8, "w": 12, "x": 0, "y": 65 }, - "id": 2, + "id": 31, "options": { + "barRadius": 0, + "barWidth": 0.97, + "groupWidth": 0.7, "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, + "orientation": "auto", + "showValue": "always", + "stacking": "none", "tooltip": { "mode": "single", "sort": "none" - } + }, + "xField": "episode", + "xTickLabelRotation": 0, + "xTickLabelSpacing": 100 }, + "pluginVersion": "9.2.15", "targets": [ { "datasource": { "type": "postgres", "uid": "P7B13B9DF907EC40C" }, - "format": "time_series", - "group": [ + "format": "table", + "group": [], + "metricColumn": "simulation", + "rawQuery": true, + "rawSql": "SELECT\n datetime,\n simulation,\n unit,\n episode,\n reward\nFROM rl_params\nwhere simulation like '${simulation}' || '_%' AND\n unit = '$rl_unit'", + "refId": "A", + "select": [ + [ + { + "params": [ + "reward" + ], + "type": "column" + }, + { + "params": [ + "avg", + "24" + ], + "type": "moving_window" + }, + { + "params": [ + "avg_reward" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "reward" + ], + "type": "column" + }, + { + "params": [ + "avg", + "24" + ], + "type": "moving_window" + }, + { + "params": [ + "avg_reward" + ], + "type": "alias" + } + ] + ], + "table": "rl_params", + "timeColumn": "index", + "timeColumnType": "timestamp", + "where": [ { - "params": [ - "$__interval", - "none" - ], - "type": "time" + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Avg. reward of unit $rl_unit", + "transformations": [ + { + "id": "calculateField", + "options": { + "binary": { + "left": "index", + "reducer": "sum", + "right": "episode" }, - { - "params": [ - "simulation" - ], - "type": "column" + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "groupBy", + "options": { + "fields": { + "episode": { + "aggregations": [], + "operation": "groupby" + }, + "index episode": { + "aggregations": [], + "operation": "aggregate" + }, + "reward": { + "aggregations": [ + "mean" + ], + "operation": "aggregate" + } + } + } + }, + { + "id": "sortBy", + "options": { + "fields": {}, + "sort": [ + { + "field": "episode" + } + ] + } + } + ], + "type": "barchart" + }, + { + "datasource": { + "type": "postgres", + "uid": "P7B13B9DF907EC40C" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "profit (sum)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 16, + "w": 12, + "x": 12, + "y": 65 + }, + "id": 33, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "auto", + "showValue": "always", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xField": "episode", + "xTickLabelRotation": 0, + "xTickLabelSpacing": 100 + }, + "pluginVersion": "9.2.15", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "P7B13B9DF907EC40C" + }, + "format": "table", + "group": [], + "metricColumn": "simulation", + "rawQuery": true, + "rawSql": "SELECT\n datetime,\n simulation,\n unit,\n episode,\n profit\nFROM rl_params\nwhere simulation like '${simulation}' || '_%' AND\n unit = '$rl_unit'", + "refId": "A", + "select": [ + [ + { + "params": [ + "reward" + ], + "type": "column" + }, + { + "params": [ + "avg", + "24" + ], + "type": "moving_window" + }, + { + "params": [ + "avg_reward" + ], + "type": "alias" + } + ], + [ + { + "params": [ + "reward" + ], + "type": "column" + }, + { + "params": [ + "avg", + "24" + ], + "type": "moving_window" + }, + { + "params": [ + "avg_reward" + ], + "type": "alias" + } + ] ], - "metricColumn": "none", + "table": "rl_params", + "timeColumn": "index", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Total profit of unit $rl_unit", + "transformations": [ + { + "id": "calculateField", + "options": { + "binary": { + "left": "index", + "reducer": "sum", + "right": "episode" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "groupBy", + "options": { + "fields": { + "episode": { + "aggregations": [], + "operation": "groupby" + }, + "index episode": { + "aggregations": [], + "operation": "aggregate" + }, + "profit": { + "aggregations": [ + "sum" + ], + "operation": "aggregate" + }, + "regret": { + "aggregations": [ + "mean" + ], + "operation": "aggregate" + }, + "reward": { + "aggregations": [ + "mean" + ], + "operation": "aggregate" + } + } + } + }, + { + "id": "sortBy", + "options": { + "fields": {}, + "sort": [ + { + "field": "episode" + } + ] + } + } + ], + "type": "barchart" + }, + { + "datasource": { + "type": "postgres", + "uid": "P7B13B9DF907EC40C" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "regret (mean)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "purple", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 73 + }, + "id": 32, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "auto", + "showValue": "always", + "stacking": "none", + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xField": "episode", + "xTickLabelRotation": 0, + "xTickLabelSpacing": 100 + }, + "pluginVersion": "9.2.15", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "P7B13B9DF907EC40C" + }, + "format": "table", + "group": [], + "metricColumn": "simulation", "rawQuery": true, - "rawSql": "SELECT\n $__timeGroupAlias(datetime,$__interval),\n avg(profit) AS \"profit\",\n simulation AS \"simulation\"\nFROM rl_params\nWHERE\n $__timeFilter(datetime) AND\n simulation IN ($simulation) AND\n unit = '$rl_unit'\nGROUP BY 1, simulation\nORDER BY 1", + "rawSql": "SELECT\n datetime,\n simulation,\n unit,\n episode,\n regret\nFROM rl_params\nwhere simulation like ${simulation} || '_%' AND\n unit = '$rl_unit'", "refId": "A", "select": [ [ { "params": [ - "profit" + "reward" ], "type": "column" }, { "params": [ - "avg" + "avg", + "24" ], - "type": "aggregate" + "type": "moving_window" }, { "params": [ - "profit" + "avg_reward" ], "type": "alias" } @@ -1018,13 +1445,20 @@ [ { "params": [ - "simulation" + "reward" ], "type": "column" }, { "params": [ - "simulation" + "avg", + "24" + ], + "type": "moving_window" + }, + { + "params": [ + "avg_reward" ], "type": "alias" } @@ -1038,32 +1472,66 @@ "name": "$__timeFilter", "params": [], "type": "macro" - }, - { - "datatype": "text", - "name": "", - "params": [ - "simulation", - "IN", - "($simulation)" - ], - "type": "expression" - }, - { - "datatype": "text", - "name": "", - "params": [ - "unit", - "=", - "'$rl_unit'" - ], - "type": "expression" } ] } ], - "title": "Unitwise Profit for $rl_unit in $simulation", - "type": "timeseries" + "title": "Arg. regret of unit $rl_unit", + "transformations": [ + { + "id": "calculateField", + "options": { + "binary": { + "left": "index", + "reducer": "sum", + "right": "episode" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + } + } + }, + { + "id": "groupBy", + "options": { + "fields": { + "episode": { + "aggregations": [], + "operation": "groupby" + }, + "index episode": { + "aggregations": [], + "operation": "aggregate" + }, + "regret": { + "aggregations": [ + "mean" + ], + "operation": "aggregate" + }, + "reward": { + "aggregations": [ + "mean" + ], + "operation": "aggregate" + } + } + } + }, + { + "id": "sortBy", + "options": { + "fields": {}, + "sort": [ + { + "field": "episode" + } + ] + } + } + ], + "type": "barchart" }, { "datasource": { @@ -1120,52 +1588,15 @@ ] } }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "reward" - }, - "properties": [ - { - "id": "unit", - "value": "none" - }, - { - "id": "custom.axisPlacement", - "value": "left" - }, - { - "id": "max", - "value": 5 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "regret" - }, - "properties": [ - { - "id": "unit", - "value": "none" - }, - { - "id": "custom.axisPlacement", - "value": "right" - } - ] - } - ] + "overrides": [] }, "gridPos": { - "h": 12, + "h": 8, "w": 12, - "x": 12, - "y": 65 + "x": 0, + "y": 81 }, - "id": 4, + "id": 29, "options": { "legend": { "calcs": [], @@ -1178,6 +1609,7 @@ "sort": "none" } }, + "pluginVersion": "9.2.15", "targets": [ { "datasource": { @@ -1185,114 +1617,34 @@ "uid": "P7B13B9DF907EC40C" }, "format": "time_series", - "group": [ - { - "params": [ - "$__interval", - "none" - ], - "type": "time" - }, - { - "params": [ - "simulation" - ], - "type": "column" - } - ], + "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n $__timeGroupAlias(datetime,$__interval),\n avg(regret) AS \"regret\",\n avg(reward) AS \"reward\",\n simulation AS \"simulation\"\nFROM rl_params\nWHERE\n $__timeFilter(datetime) AND\n simulation IN ($simulation) AND\n unit = '$rl_unit'\nGROUP BY 1, simulation\nORDER BY 1", + "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n price AS \"Bid price:\",\r\n bid_id as \"bid_id\"\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time) AND\r\n simulation = '$simulation'\r\n AND unit_id = '$rl_unit'\r\nGROUP BY 1, unit_id, price, bid_id\r\nORDER BY 1", "refId": "A", "select": [ [ { "params": [ - "regret" - ], - "type": "column" - }, - { - "params": [ - "avg" - ], - "type": "aggregate" - }, - { - "params": [ - "regret" - ], - "type": "alias" - } - ], - [ - { - "params": [ - "reward" - ], - "type": "column" - }, - { - "params": [ - "avg" - ], - "type": "aggregate" - }, - { - "params": [ - "reward" - ], - "type": "alias" - } - ], - [ - { - "params": [ - "simulation" + "price" ], "type": "column" - }, - { - "params": [ - "simulation" - ], - "type": "alias" } ] ], - "table": "rl_params", - "timeColumn": "index", + "table": "market_orders", + "timeColumn": "datetime", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" - }, - { - "datatype": "text", - "name": "", - "params": [ - "simulation", - "IN", - "($simulation)" - ], - "type": "expression" - }, - { - "datatype": "text", - "name": "", - "params": [ - "unit", - "=", - "'$rl_unit'" - ], - "type": "expression" } ] } ], - "title": "Unitwise Regret&Reward for $rl_unit in $simulation", + "title": "Bid price", "type": "timeseries" }, { @@ -1303,12 +1655,37 @@ "fieldConfig": { "defaults": { "color": { - "mode": "thresholds" + "mode": "palette-classic" }, "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } }, "mappings": [], "thresholds": { @@ -1328,21 +1705,23 @@ "overrides": [] }, "gridPos": { - "h": 16, + "h": 8, "w": 12, - "x": 0, - "y": 77 + "x": 12, + "y": 81 }, - "id": 29, + "id": 34, "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "showHeader": true + "tooltip": { + "mode": "single", + "sort": "none" + } }, "pluginVersion": "9.2.15", "targets": [ @@ -1351,11 +1730,11 @@ "type": "postgres", "uid": "P7B13B9DF907EC40C" }, - "format": "table", + "format": "time_series", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\r\n*\r\nFROM \r\nmarket_orders\r\nwhere\r\n$__timeFilter(start_time) and\r\nsimulation in ($simulation) \r\n\r\n\r\n\r\n\r\n", + "rawSql": "SELECT\r\n $__timeGroupAlias(start_time,$__interval),\r\n volume AS \"Bid volume:\",\r\n bid_id as \"bid_id\"\r\nFROM market_orders\r\nWHERE\r\n $__timeFilter(start_time) AND\r\n simulation = '$simulation'\r\n AND unit_id = '$rl_unit'\r\nGROUP BY 1, unit_id, volume, bid_id\r\nORDER BY 1", "refId": "A", "select": [ [ @@ -1379,8 +1758,8 @@ ] } ], - "title": "Bid Overview", - "type": "table" + "title": "Bid volume", + "type": "timeseries" }, { "datasource": { @@ -1442,8 +1821,8 @@ "gridPos": { "h": 8, "w": 12, - "x": 12, - "y": 77 + "x": 0, + "y": 89 }, "id": 26, "options": { @@ -1468,7 +1847,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n $__timeGroupAlias(datetime,$__interval),\n actions_0 AS \"action_Pinflex\",\n actions_0+exploration_noise_0 AS \"noisy_action_Pinflex\",\n simulation AS \"simulation\"\nFROM rl_params\nWHERE\n $__timeFilter(datetime) AND\n simulation IN ($simulation) AND\n unit = '$rl_unit'\n\nORDER BY 1", + "rawSql": "SELECT\n $__timeGroupAlias(datetime,$__interval),\n actions_0 AS \"action_Pinflex\",\n actions_0+exploration_noise_0 AS \"noisy_action_Pinflex\",\n simulation AS \"simulation\"\nFROM rl_params\nWHERE\n $__timeFilter(datetime) AND\n simulation = '$simulation' AND\n unit = '$rl_unit'\n\nORDER BY 1", "refId": "A", "select": [ [ @@ -1541,7 +1920,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1556,7 +1936,7 @@ "h": 8, "w": 12, "x": 12, - "y": 85 + "y": 89 }, "id": 30, "options": { @@ -1581,7 +1961,7 @@ "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "SELECT\n $__timeGroupAlias(datetime,$__interval),\n actions_1 AS \"action_Pflex\",\n actions_1+exploration_noise_1 AS \"noisy_action_Pflex\",\n simulation AS \"simulation\"\nFROM rl_params\nWHERE\n $__timeFilter(datetime) AND\n simulation IN ($simulation) AND\n unit = '$rl_unit'\n\nORDER BY 1", + "rawSql": "SELECT\n $__timeGroupAlias(datetime,$__interval),\n actions_1 AS \"action_Pflex\",\n actions_1+exploration_noise_1 AS \"noisy_action_Pflex\",\n simulation AS \"simulation\"\nFROM rl_params\nWHERE\n $__timeFilter(datetime) AND\n simulation = '$simulation' AND\n unit = '$rl_unit'\n\nORDER BY 1", "refId": "A", "select": [ [ @@ -1616,31 +1996,6 @@ "tags": [], "templating": { "list": [ - { - "current": { - "selected": false, - "text": "Unit 3", - "value": "Unit 3" - }, - "datasource": { - "type": "postgres", - "uid": "P7B13B9DF907EC40C" - }, - "definition": "SELECT distinct unit\nFROM rl_params\nwhere simulation like ${simulation} || '_%'", - "description": "All units that have an reinforcment learning strategy and hence have the Rl specific parameteres logged", - "hide": 0, - "includeAll": false, - "label": "rl_unit", - "multi": false, - "name": "rl_unit", - "options": [], - "query": "SELECT distinct unit\nFROM rl_params\nwhere simulation like ${simulation} || '_%'", - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, { "current": { "selected": true, @@ -1655,15 +2010,15 @@ "type": "postgres", "uid": "P7B13B9DF907EC40C" }, - "definition": "SELECT DISTINCT\n SUBSTRING(m.simulation, 0, LENGTH(m.simulation) +1 - strpos(REVERSE(m.simulation),'_')) AS market_simulation\n FROM \n market_meta m\n LEFT OUTER JOIN\n rl_params o\n ON\n m.simulation = o.simulation\n WHERE\n o.learning_mode is true", + "definition": "SELECT DISTINCT\n SUBSTRING(m.simulation, 0, LENGTH(m.simulation) +1 - strpos(REVERSE(m.simulation),'_')) AS market_simulation\n FROM \n rl_params m", "description": "Can choose which simulation we want to show ", "hide": 0, "includeAll": false, - "multi": true, + "multi": false, "name": "simulation", "options": [], - "query": "SELECT DISTINCT\n SUBSTRING(m.simulation, 0, LENGTH(m.simulation) +1 - strpos(REVERSE(m.simulation),'_')) AS market_simulation\n FROM \n market_meta m\n LEFT OUTER JOIN\n rl_params o\n ON\n m.simulation = o.simulation\n WHERE\n o.learning_mode is true", - "refresh": 1, + "query": "SELECT DISTINCT\n SUBSTRING(m.simulation, 0, LENGTH(m.simulation) +1 - strpos(REVERSE(m.simulation),'_')) AS market_simulation\n FROM \n rl_params m", + "refresh": 2, "regex": "", "skipUrlSync": false, "sort": 1, @@ -1672,26 +2027,26 @@ { "current": { "selected": false, - "text": "1", - "value": "1" + "text": "Unit 3", + "value": "Unit 3" }, "datasource": { "type": "postgres", "uid": "P7B13B9DF907EC40C" }, - "definition": "SELECT \n distinct episode\nFROM rl_params\nwhere simulation like ${simulation} || '_%';", - "description": "Gives us the number of runs of the simulation period learned ", + "definition": "SELECT distinct unit\nFROM rl_params\nwhere simulation like ${simulation} || '_%'", + "description": "All units that have an reinforcment learning strategy and hence have the Rl specific parameteres logged", "hide": 0, "includeAll": false, - "label": "learning episode", + "label": "rl_unit", "multi": false, - "name": "episode", + "name": "rl_unit", "options": [], - "query": "SELECT \n distinct episode\nFROM rl_params\nwhere simulation like ${simulation} || '_%';", - "refresh": 1, + "query": "SELECT distinct unit\nFROM rl_params\nwhere simulation like ${simulation} || '_%'", + "refresh": 2, "regex": "", "skipUrlSync": false, - "sort": 3, + "sort": 0, "type": "query" } ] @@ -1700,10 +2055,19 @@ "from": "2018-12-31T23:00:00.000Z", "to": "2019-01-05T22:59:59.000Z" }, - "timepicker": {}, + "timepicker": { + "refresh_intervals": [ + "1m", + "5m", + "15m", + "30m", + "1h", + "2h" + ] + }, "timezone": "", - "title": "Assume_Learning", + "title": "Assume: Training progress", "uid": "JKQzx0q4k", - "version": 13, + "version": 6, "weekStart": "" } diff --git a/examples/inputs/example_01_rl/config.yaml b/examples/inputs/example_01_rl/config.yaml index 636d1bdb..7142c9fd 100644 --- a/examples/inputs/example_01_rl/config.yaml +++ b/examples/inputs/example_01_rl/config.yaml @@ -1,8 +1,8 @@ base: start_date: 2019-01-01 00:00 - end_date: 2019-01-05 00:00 + end_date: 2019-02-01 00:00 time_step: 1h - save_frequency_hours: 24 + save_frequency_hours: Null learning_config: observation_dimension: 50