Bidding strategies

Contents

Bidding strategies#

Submodules#

assume.strategies.advanced_orders module#

class assume.strategies.advanced_orders.flexableEOMBlock(*args, **kwargs)#

Bases: BaseStrategy

A strategy that bids on the EOM-market with block bids.

foresight#

The foresight for the EOM-market.

Type:

pandas.Timedelta

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Calculates block bids for the EOM-market and returns a list of bids consisting of the start time, end time, only hours, price, volume and bid type.

The bids take the following form: One block bid with the minimum acceptance ratio set to 1 spanning the total clearing period. It uses the inflexible power and the weighted average price of the inflexible power as the price. This price is based on the marginal cost of the inflexible power and the starting costs. The starting costs are split across inflexible power and the average operation or down time of the unit depending on the operation status before. Additionally, for every hour where the unit is on, a separate flexible bid is created using the flexible power and marginal costs as bidding price.

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • market_config (MarketConfig) – A market configuration.

  • product_tuples (list[Product]) – A list of tuples containing the start and end time of each product.

  • kwargs (dict) – Additional arguments.

Returns:

A list of bids.

Return type:

Orderbook

calculate_reward(unit, marketconfig: MarketConfig, orderbook: list[assume.common.market_objects.Order])#

Calculates and writes the reward (costs and profit).

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • marketconfig (MarketConfig) – A market configuration.

  • orderbook (Orderbook) – An orderbook with accepted and rejected orders for the unit.

class assume.strategies.advanced_orders.flexableEOMLinked(*args, **kwargs)#

Bases: BaseStrategy

A strategy that bids on the EOM-market with block and linked bids.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Calculates block and linked bids for the EOM-market and returns a list of bids consisting of the start time, end time, only hours, price, volume and bid type.

The bids take the following form: One block bid with the minimum acceptance ratio set to 1 spanning the total clearing period. It uses the inflexible power and the weighted average price of the inflexible power as the price. This price is based on the marginal cost of the inflexible power and the starting costs. The starting costs are split across inflexible power and the average operation or down time of the unit depending on the operation status before. Additionally, for every hour where the unit is on, a separate flexible bid is created using the flexible power and marginal costs as bidding price. This bids are linked as children to the block bid.

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • market_config (MarketConfig) – A market configuration.

  • product_tuples (list[Product]) – A list of tuples containing the start and end time of each product.

  • kwargs (dict) – Additional arguments.

Returns:

A list of bids.

Return type:

Orderbook

calculate_reward(unit, marketconfig: MarketConfig, orderbook: list[assume.common.market_objects.Order])#

Calculates and writes the reward (costs and profit).

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • marketconfig (MarketConfig) – A market configuration.

  • orderbook (Orderbook) – An orderbook with accepted and rejected orders for the unit.

assume.strategies.dmas_powerplant module#

class assume.strategies.dmas_powerplant.DmasPowerplantStrategy(steps=[-10, -1, 0, 1, 10], *args, **kwargs)#

Bases: BaseStrategy

build_model(unit: SupportsMinMax, start: datetime, hour_count: int, emission_prices, fuel_prices, power_prices, runtime: int = None, p0: float = None) None#

Builds the optimization model and returns the cashflow.

Parameters:
  • unit (SupportsMinMax) – Unit to optimize.

  • start (datetime.datetime) – Start time.

  • hour_count (int) – Number of hours to optimize.

  • emission_prices (numpy.ndarray) – Emission prices.

  • fuel_prices (numpy.ndarray) – Fuel prices.

  • power_prices (numpy.ndarray) – Power prices.

  • runtime (int, optional) – Runtime of the unit. Defaults to None.

  • p0 (float, optional) – Initial power. Defaults to None.

Returns:

Cashflow.

Return type:

np.array

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market Returns a list of bids that the unit operator will submit to the market

Parameters:
Returns:

orderbook

Return type:

Orderbook

optimize(unit: SupportsMinMax, start: datetime, hour_count: int, prices: DataFrame = None, steps: tuple = None) array#

optimizes the unit

Parameters:
  • unit (SupportsMinMax) – unit to optimize

  • start (datetime.datetime) – start time

  • hour_count (int) – number of hours to optimize

  • prices (pd.DataFrame) – prices

  • steps (tuple) – steps to optimize

Returns:

generation

Return type:

np.array

assume.strategies.dmas_powerplant.get_solver_factory(solvers_str=['cbc', 'glpk', 'cbc', 'gurobi', 'cplex'])#

select the first available solver from the list

Parameters:

solvers_str (list, optional) – list of solvers

Returns:

solver factory

Return type:

SolverFactory

assume.strategies.dmas_storage module#

class assume.strategies.dmas_storage.DmasStorageStrategy(*args, **kwargs)#

Bases: BaseStrategy

Strategy for a storage unit that uses DMAS to optimize its operation

build_model(unit: SupportsMinMaxCharge, start: datetime, hour_count: int)#

Builds the optimization model

Parameters:
Returns:

power

Return type:

np.array

calculate_bids(unit: SupportsMinMaxCharge, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market

Returns a list of bids that the unit operator will submit to the market

Parameters:
Returns:

bids

Return type:

Orderbook

optimize(unit: SupportsMinMaxCharge, market_id: str, start: datetime, hour_count: int)#

Optimizes the unit operation

Parameters:
Returns:

optimization results

Return type:

dict

assume.strategies.dmas_storage.get_solver_factory(solvers_str=['glpk', 'cbc', 'gurobi', 'cplex']) <pyomo.opt.base.solvers.SolverFactoryClass object at 0x7f330e217980>#

Returns the first available solver from the list of solvers

Parameters:

solvers_str (list, optional) – default solvers. Defaults to [“glpk”, “cbc”, “gurobi”, “cplex”].

Raises:

Exception – if no solvers available

Returns:

the first working solver

Return type:

SolverFactory

assume.strategies.dmas_storage.shaping(prc, type_: str = 'peak')#

Shifts the price curve up or down

Parameters:
  • prc (numpy.ndarray) – price curve

  • type (str) – type of shift. default is ‘peak’. other options are ‘pv’ and ‘demand’.

  • type – str: (Default value = “peak”)

Returns:

shifted price curve

Return type:

np.array

assume.strategies.dmas_storage.shift(prc, type_: str = 'first')#

Shifts the price curve up or down

Parameters:
  • prc (numpy.ndarray) – price curve

  • type (str) – type of shift. default is ‘first’

  • type – str: (Default value = “first”)

Returns:

shifted price curve

Return type:

np.array

assume.strategies.extended module#

class assume.strategies.extended.MarkupStrategy(*args, abs_markup=0, rel_markup=0, **kwargs)#

Bases: BaseStrategy

Strategy for Markup (over the counter trading) markets

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market

Returns a list of bids that the unit operator will submit to the market.

Parameters:
  • unit (SupportsMinMax) – Unit to dispatch.

  • market_config (MarketConfig) – Market configuration.

  • product_tuples (list[Product]) – List of products to dispatch.

  • **kwargs (dict) – Additional arguments.

Returns:

The orderbook.

Return type:

Orderbook

class assume.strategies.extended.OTCStrategy(*args, scale_firm_power_capacity=1.0, **kwargs)#

Bases: BaseStrategy

Strategy for OTC (over the counter trading) markets

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market.

Returns a list of bids that the unit operator will submit to the market.

Parameters:
  • unit (SupportsMinMax) – Unit to dispatch.

  • market_config (MarketConfig) – Market configuration.

  • product_tuples (list[Product]) – List of products to dispatch.

  • **kwargs (dict) – Additional arguments.

Returns:

Orderbook.

Return type:

Orderbook

class assume.strategies.extended.SupportStrategy(contract_types: list[str] = [], contract_value=0, contract_amount_fraction=1, evaluation_frequency=2, *args, **kwargs)#

Bases: NaiveSingleBidStrategy

Strategy for support markets. A list of allowed contract_types is given, as well as a value which is used to bid contracts. As often not everything which is possible should be bid on contracts, this can be defined through contract_amount_fraction - as well as an execution schedule.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market.

Parameters:
  • unit (SupportsMinMax) – Unit to dispatch.

  • market_config (MarketConfig) – Market configuration.

  • product_tuples (List[Product]) – List of products to dispatch.

  • **kwargs (dict) – Additional arguments.

Returns:

The orderbook.

Return type:

Orderbook

assume.strategies.extended.is_co2emissionless(units)#

assume.strategies.flexable module#

assume.strategies.flexable.calculate_EOM_price_if_off(unit: SupportsMinMax, marginal_cost_inflex, bid_quantity_inflex, op_time, avg_op_time=1)#

The powerplant is currently off and calculates a startup markup as an extra to the marginal cost.

The startup markup is calculated as follows: starting_cost / avg_operating_time / bid_quantity_inflex

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • marginal_cost_inflex (float) – The marginal cost of the unit.

  • bid_quantity_inflex (float) – The bid quantity of the unit.

  • op_time (int) – The operation time of the unit.

  • avg_op_time (int) – The average operation time of the unit.

Returns:

The inflexible bid price of the unit.

Return type:

float

assume.strategies.flexable.calculate_EOM_price_if_on(unit: SupportsMinMax, market_id: str, start, marginal_cost_flex, bid_quantity_inflex, foresight, avg_down_time=-1)#

The powerplant is currently on and calculates a price reduction to prevent shutdowns.

The price reduction is calculated as follows: starting_cost / -avg_down_time / bid_quantity_inflex If the unit is a CHP, the heat generation costs are added to the price reduction with the following formula: heat_gen_cost = (heat_output * (natural_gas_price / 0.9)) / bid_quantity_inflex If the estimated revenue for the time defined in foresight is positive, but the marginal costs are below the forecasted market clearing price, the marginal costs are set to 0.

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • start (datetime.datetime) – The start time of the product.

  • marginal_cost_flex (float) – The marginal cost of the unit.

  • bid_quantity_inflex (float) – The bid quantity of the unit.

  • foresight (datetime.timedelta) – The foresight of the unit.

  • avg_down_time (int) – The average down time of the unit.

Returns:

The inflexible bid price of the unit.

Return type:

float

assume.strategies.flexable.calculate_reward_EOM(unit, marketconfig: MarketConfig, orderbook: list[assume.common.market_objects.Order])#

Calculates and writes reward (costs and profit) for EOM market.

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • marketconfig (MarketConfig) – A market configuration.

  • orderbook (Orderbook) – An orderbook with accepted and rejected orders for the unit.

class assume.strategies.flexable.flexableEOM(*args, **kwargs)#

Bases: BaseStrategy

A strategy that bids on the EOM-market.

foresight#

The foresight of the unit.

Type:

datetime.timedelta

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Calculates bids for the EOM-market and returns a list of bids consisting of the start time, end time, only hours, price, volume and bid type.

The bids take the following form: For each hour one inflexible and one flexible bid is formulated. The inflexible bid is the minimum power of the unit depending on the ramp up limitations. The price for this bid is calculated by the marginal cost of the unit plus a markup for the startup costs. The flexible bid is the maximum power of the unit depending on the ramp up limitations minus the inflexible bid. Here, the price is equal to the marginal costs of the unit.

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • market_config (MarketConfig) – A market configuration.

  • product_tuples (list[Product]) – A list of tuples containing the start and end time of each product.

  • kwargs (dict) – Additional arguments.

Returns:

A list of bids.

Return type:

Orderbook

calculate_reward(unit, marketconfig: MarketConfig, orderbook: list[assume.common.market_objects.Order])#

Calculates and writes the reward (costs and profit).

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • marketconfig (MarketConfig) – A market configuration.

  • orderbook (Orderbook) – An orderbook with accepted and rejected orders for the unit.

class assume.strategies.flexable.flexableNegCRM(*args, **kwargs)#

Bases: BaseStrategy

A strategy that bids the energy_price or the capacity_price of the unit on the negative CRM(reserve market).

foresight#

The foresight of the unit.

Type:

datetime.timedelta

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market. Returns a list of bids consisting of the start time, end time, only hours, price and volume.

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • market_config (MarketConfig) – A market configuration.

  • product_tuples (list[Product]) – A list of tuples containing the start and end time of each product.

  • kwargs (dict) – Additional arguments.

Returns:

A list of bids.

Return type:

Orderbook

class assume.strategies.flexable.flexablePosCRM(*args, **kwargs)#

Bases: BaseStrategy

A strategy that bids the energy_price or the capacity_price of the unit on the CRM (reserve market).

foresight#

The foresight of the unit.

Type:

datetime.timedelta

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Calculates bids for the CRM-market.

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market. Returns a list of bids consisting of the start time, end time, only hours, price and volume.

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • market_config (MarketConfig) – A market configuration.

  • product_tuples (list[Product]) – A list of tuples containing the start and end time of each product.

  • kwargs (dict) – Additional arguments.

Returns:

A list of bids.

Return type:

Orderbook

assume.strategies.flexable.get_specific_revenue(price_forecast, marginal_cost: float, t: datetime, foresight: timedelta)#

Calculates the specific revenue as difference between price forecast and marginal costs for the time defined by the foresight.

Parameters:
Returns:

The specific revenue of the unit.

Return type:

float

assume.strategies.flexable_storage module#

assume.strategies.flexable_storage.calculate_price_average(unit, current_time, foresight, price_forecast)#

Calculates the average price for a given foresight and returns the average price.

Parameters:
Returns:

The average price.

Return type:

float

class assume.strategies.flexable_storage.flexableEOMStorage(*args, **kwargs)#

Bases: BaseStrategy

The strategy is analogue to the storage strategy in flexABLE.

If the current price forecast is higher than the average price forecast for a given foresight, the unit will discharge. The price is then set as the average price divided by the discharge efficiency of the unit. Otherwise, the unit will charge with the price defined as the average price multiplied by the charge efficiency of the unit.

foresight#

Foresight for the average price calculation.

Type:

pandas.Timedelta

Parameters:
  • *args – Additional arguments.

  • **kwargs – Additional keyword arguments.

calculate_bids(unit: SupportsMinMaxCharge, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market.

Parameters:
  • unit (SupportsMinMaxCharge) – The unit that is dispatched.

  • market_config (MarketConfig) – The market configuration.

  • product_tuples (list[Product]) – List of product tuples.

  • **kwargs – Additional keyword arguments.

Returns:

Bids containing start_time, end_time, only_hours, price, volume.

Return type:

Orderbook

Note

The strategy is analogue to flexABLE

calculate_reward(unit: SupportsMinMaxCharge, marketconfig: MarketConfig, orderbook: list[assume.common.market_objects.Order])#

Calculates the reward (costs and profit).

The profit is defined by the cashflow minus the costs.

Parameters:
  • unit (SupportsMinMaxCharge) – The unit to calculate reward for.

  • marketconfig (MarketConfig) – The market configuration.

  • orderbook (Orderbook) – The orderbook.

class assume.strategies.flexable_storage.flexableNegCRMStorage(*args, **kwargs)#

Bases: BaseStrategy

A strategy that bids the energy_price or the capacity_price of the unit on the negative CRM(reserve market).

foresight#

Foresight for the average price calculation.

Type:

pandas.Timedelta

Parameters:
  • *args – Additional arguments.

  • **kwargs – Additional keyword arguments.

calculate_bids(unit: SupportsMinMaxCharge, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market. Returns a list of bids consisting of the start time, end time, only hours, price and volume.

Parameters:
  • unit (SupportsMinMax) – A unit that the unit operator manages.

  • market_config (MarketConfig) – A market configuration.

  • product_tuples (list[Product]) – A list of tuples containing the start and end time of each product.

  • kwargs (dict) – Additional arguments.

Returns:

A list of bids.

Return type:

Orderbook

class assume.strategies.flexable_storage.flexablePosCRMStorage(*args, **kwargs)#

Bases: BaseStrategy

The strategy is analogue to the storage strategy in flexABLE.

The strategy bids the energy_price for the energy_pos product if the specific revenue is positive. Otherwise, the strategy bids the capacity_price for the capacity_pos product.

foresight#

Foresight for the average price calculation.

Type:

pandas.Timedelta

Parameters:
  • *args – Additional arguments.

  • **kwargs – Additional keyword arguments.

calculate_bids(unit: SupportsMinMaxCharge, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Calculates bids for the positive CRM market.

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market and returns bids containing start_time, end_time, only_hours, price, volume.

Parameters:
  • unit (SupportsMinMaxCharge) – The unit that is dispatched.

  • market_config (MarketConfig) – The market configuration.

  • product_tuples (list[Product]) – List of product tuples.

  • **kwargs – Additional keyword arguments.

Returns:

A list of bids.

Return type:

Orderbook

assume.strategies.flexable_storage.get_specific_revenue(unit, marginal_cost, t, foresight, price_forecast)#

Calculates the specific revenue as difference between price forecast and marginal costs for the time defined by the foresight.

Parameters:
Returns:

The specific revenue.

Return type:

float

assume.strategies.learning_advanced_orders module#

class assume.strategies.learning_advanced_orders.RLAdvancedOrderStrategy(*args, **kwargs)#

Bases: LearningStrategy

Reinforcement Learning Strategy for an Energy-Only-Market with simple hourly, block and linked orders.

foresight#

Number of time steps to look ahead. Default 24.

Type:

int

max_bid_price#

The maximum bid price.

Type:

float

max_demand#

The maximum demand.

Type:

float

device#

The device to run on.

Type:

str

float_type#

The float type to use.

Type:

str

learning_mode#

Whether to use learning mode.

Type:

bool

actor#

The actor network.

Type:

torch.nn.Module

order_types#

The list of order types to use (SB, LB, BB).

Type:

list[str]

episodes_collecting_initial_experience#

Number of episodes to collect initial experience.

Type:

int

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Note

This strategy is based on the strategy in flexable.py, but uses the actor network to determine the prices instead of using the marginal costs as in flexable.py. The two prices for flexible and inflexible power are determined by the actor network, which is trained with the MATD3 algorithm. The maximum of those two prices is used for the flexible bid and the minimum for the inflexible bid. The order type is set implicitly (not by the RL agent itself) and the structure depends on the allowed order types: If only simple hourly orders (SB) are allowed, the strategy will only use SB for both inflexible and flexible power. If SB and linked orders (LB) are allowed, the strategy will use SB for the inflexible power and LB for the flexible power. If SB and block orders (BB) are allowed, the strategy will use BB for the inflexible power and SB for the flexible power. If all three order types (SB, BB, LB) are allowed, the strategy will use BB for the inflexible power and LB for the flexible power, exept the inflexible power is 0, then it will use SB for the flexible power (as for VREs).

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Calculates bids for a unit.

Parameters:
Returns:

Bids containing start time, end time, price, volume and bid type

Return type:

Orderbook

calculate_reward(unit, marketconfig: MarketConfig, orderbook: list[assume.common.market_objects.Order])#

Calculate and write reward, profit and regret to unit outputs.

Parameters:
  • unit (SupportsMinMax) – The unit to calculate reward for.

  • marketconfig (MarketConfig) – The market configuration.

  • orderbook (Orderbook) – The Orderbook.

Note

The reward is calculated as the profit minus the opportunity cost, which is the loss of income we have because we are not running at full power. The regret is the opportunity cost. Because the regret_scale is set to 0 the reward equals the profit. The profit is the income we have from the accepted bids. The total costs are the running costs and the start-up costs.

create_observation(unit: SupportsMinMax, market_id: str, start: datetime, end: datetime)#

Create observation.

Parameters:
Returns:

Observation containing residual load forecast, price forecast, must run time, max power and marginal cost

Return type:

Observation (torch.Tensor)

Note

The dimension of the observation space is defined by 2 * product_len (int): number of hours in the clearing horizon + 2 * (foresight-1) (int): number of hours we look ahead + 3 (int): must run time, max power and marginal cost The observation space is scaled to the range [-1,1] to make it easier for the actor neuronal net to learn. The scaling factors are defined by the maximum residual load, the maximum bid price and the maximum capacity of the unit.

get_actions(next_observation)#

Gets actions for a unit containing two bid prices depending on the observation

Parameters:

next_observation (torch.Tensor) – Next observation

Returns:

Actions containing two bid prices

Return type:

Actions (torch.Tensor)

Note

If the agent is in learning mode, the actions are chosen by the actor neuronal net and noise is added to the action. In the first X episodes the agent is in initial exploration mode, where the action is chosen by noise only to explore the entire action space. X is defined by episodes_collecting_initial_experience. If the agent is not in learning mode, the actions are chosen by the actor neuronal net without noise.

load_actor_params(load_path)#

Load actor parameters.

Parameters:

load_path (str) – Thze path to load parameters from.

assume.strategies.learning_strategies module#

class assume.strategies.learning_strategies.RLStrategy(*args, **kwargs)#

Bases: LearningStrategy

Reinforcement Learning Strategy, that lets agent learn to bid on an Energy Only Makret.

The agent submittes two price bids - one for the infelxible (P_min) and one for the flexible part (P_max-P_min) of ist capacity.

foresight#

Number of time steps to look ahead. Defaults to 24.

Type:

int

max_bid_price#

Maximum bid price. Defaults to 100.

Type:

float

max_demand#

Maximum demand. Defaults to 10e3.

Type:

float

device#

Device to run on. Defaults to “cpu”.

Type:

str

float_type#

Float type to use. Defaults to “float32”.

Type:

str

learning_mode#

Whether to use learning mode. Defaults to False.

Type:

bool

actor#

Actor network. Defaults to None.

Type:

torch.nn.Module

order_types#

Order types to use. Defaults to [“SB”].

Type:

list[str]

action_noise#

Action noise. Defaults to None.

Type:

NormalActionNoise

collect_initial_experience_mode#

Whether to collect initial experience. Defaults to True.

Type:

bool

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Calculates bids for a unit, based on the actions from the actors.

Parameters:
  • unit (SupportsMinMax) – Unit to calculate bids for.

  • market_config (MarketConfig) – Market configuration.

  • product_tuples (list[Product]) – Product tuples.

  • **kwargs – Keyword arguments.

Returns:

Bids containing start time, end time, price, volume and bid type.

Return type:

Orderbook

calculate_reward(unit, marketconfig: MarketConfig, orderbook: list[assume.common.market_objects.Order])#

Calculates the reward for the unit.

Parameters:
  • unit (SupportsMinMax) – Unit to calculate reward for.

  • marketconfig (MarketConfig) – Market configuration.

  • orderbook (Orderbook) – Orderbook.

create_observation(unit: SupportsMinMax, market_id: str, start: datetime, end: datetime)#

Creates an observation.

Parameters:
Returns:

Observation.

Return type:

Observation (torch.Tensor)

get_actions(next_observation)#

Gets actions for a unit containing two bid prices depending on the observation.

Parameters:

next_observation (torch.Tensor) – Next observation.

Returns:

Actions containing two bid prices.

Return type:

Actions (torch.Tensor)

Note

If the agent is in learning mode, the actions are chosen by the actor neuronal net and noise is added to the action In the first x episodes the agent is in initial exploration mode, where the action is chosen by noise only to explore the entire action space. X is defined by episodes_collecting_initial_experience. If the agent is not in learning mode, the actions are chosen by the actor neuronal net without noise.

load_actor_params(load_path)#

Loads actor parameters.

Parameters:

load_path (str) – Path to load from.

assume.strategies.naive_strategies module#

class assume.strategies.naive_strategies.NaiveNegReserveStrategy(*args, **kwargs)#

Bases: BaseStrategy

A naive strategy that bids the ramp down volume on the negative reserve market (price = 0).

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market.

Parameters:
  • unit (SupportsMinMax) – The unit to be dispatched.

  • market_config (MarketConfig) – The market configuration.

  • product_tuples (list[Product]) – The list of all products the unit can offer.

Returns:

The bids consisting of the start time, end time, only hours, price and volume.

Return type:

Orderbook

class assume.strategies.naive_strategies.NaivePosReserveStrategy(*args, **kwargs)#

Bases: BaseStrategy

A naive strategy that bids the ramp up volume on the positive reserve market (price = 0).

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market.

Parameters:
  • unit (SupportsMinMax) – The unit to be dispatched.

  • market_config (MarketConfig) – The market configuration.

  • product_tuples (list[Product]) – The list of all products the unit can offer.

Returns:

The bids consisting of the start time, end time, only hours, price and volume.

Return type:

Orderbook

class assume.strategies.naive_strategies.NaiveProfileStrategy(*args, **kwargs)#

Bases: BaseStrategy

A naive strategy that bids the marginal cost of the unit as block bids over 24 hours on the day ahead market.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market.

Parameters:
  • unit (SupportsMinMax) – The unit to be dispatched.

  • market_config (MarketConfig) – The market configuration.

  • product_tuples (list[Product]) – The list of all products the unit can offer.

Returns:

The bids consisting of the start time, end time, only hours, price and volume.

Return type:

Orderbook

class assume.strategies.naive_strategies.NaiveRedispatchStrategy(*args, **kwargs)#

Bases: BaseStrategy

A naive strategy that simply submits all information about the unit and currently dispatched power for the following hours to the redispatch market. Information incldes the marginal cost, the ramp up and down values, and the dispatch.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market

Parameters:
  • unit (SupportsMinMax) – the unit to be dispatched

  • market_config (MarketConfig) – the market configuration

  • product_tuples (list[Product]) – list of all products the unit can offer

Returns:

the bids consisting of the start time, end time, only hours, price and volume.

Return type:

Orderbook

class assume.strategies.naive_strategies.NaiveSingleBidStrategy(*args, **kwargs)#

Bases: BaseStrategy

A naive strategy that bids the marginal cost of the unit on the market.

calculate_bids(unit: SupportsMinMax, market_config: MarketConfig, product_tuples: list[assume.common.market_objects.Product], **kwargs) list[assume.common.market_objects.Order]#

Takes information from a unit that the unit operator manages and defines how it is dispatched to the market.

Parameters:
  • unit (SupportsMinMax) – The unit to be dispatched.

  • market_config (MarketConfig) – The market configuration.

  • product_tuples (list[Product]) – The list of all products the unit can offer.

Returns:

The bids consisting of the start time, end time, only hours, price and volume.

Return type:

Orderbook

Module contents#