Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Rl strategy for household #476

Draft
wants to merge 10 commits into
base: michael_thesis
Choose a base branch
from
5 changes: 2 additions & 3 deletions assume/common/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ def __init__(
self.write_dfs: dict = defaultdict(list)
self.locks = defaultdict(lambda: Lock())

if self.db is not None:
self.delete_db_scenario(self.simulation_id)

self.kpi_defs: dict[str, OutputDef] = {
"avg_price": {
"value": "avg(price)",
Expand Down Expand Up @@ -191,6 +188,8 @@ def setup(self):
def on_ready(self):
if self.db_uri:
self.db = create_engine(self.db_uri)
if self.db is not None:
self.delete_db_scenario(self.simulation_id)
if self.save_frequency_hours is not None:
recurrency_task = rr.rrule(
freq=rr.HOURLY,
Expand Down
3 changes: 3 additions & 0 deletions assume/markets/clearing_algorithms/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later

import logging
import math
import random
from datetime import timedelta
from itertools import groupby
Expand Down Expand Up @@ -445,6 +446,8 @@ def clear(
if demand_order["accepted_volume"]:
accepted_demand_orders.append(demand_order)
accepted_supply_orders.extend(to_commit)
if math.isclose(gen_vol, dem_vol, abs_tol=1e-8):
gen_vol, dem_vol = 0, 0

# if demand is fulfilled, we do have some additional supply orders
# these will be rejected
Expand Down
2 changes: 2 additions & 0 deletions assume/strategies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@
from assume.strategies.learning_strategies import (
RLStrategy,
StorageRLStrategy,
HouseholdStorageRLStrategy
)

bidding_strategies["pp_learning"] = RLStrategy
bidding_strategies["storage_learning"] = StorageRLStrategy
bidding_strategies["household_storage_learning"] = HouseholdStorageRLStrategy
bidding_strategies["learning_advanced_orders"] = RLAdvancedOrderStrategy

except ImportError:
Expand Down
Loading