citylearn.agents.baseline module

class citylearn.agents.baseline.BusinessAsUsualAgent(env: CityLearnEnv, ev_target_soc: float = 1.0, ev_follow_required_soc: bool = False, ev_service_margin_rate: float = 0.02, ev_service_floor_rate: float = 0.0, storage_min_soc: float = 0.2, storage_max_soc: float = 0.9, storage_deadband_kw: float = 0.05, deferrable_start_action: float = 1.0, **kwargs: Any)[source]

Bases: Agent

Deterministic operational baseline for day-to-day equipment use.

The policy represents a conservative non-optimizing operator: connected EVs charge toward their declared departure service target when available, deferrable appliances start as soon as they can, and electrical storage performs simple PV self-consumption.

predict(observations: List[List[float]], deterministic: bool = None) List[List[float]][source]

Provide actions for current time step.

Return randomly sampled actions from action_space.

Parameters:
  • observations (List[List[float]]) – Environment observations

  • deterministic (bool, default: False) – Wether to return purely exploitatative deterministic actions.

Returns:

actions – Action values

Return type:

List[List[float]]

reset()[source]

Reset environment to initial state.

Calls reset_time_step.

Notes

Override in subclass for custom implementation when reseting environment.

class citylearn.agents.baseline.CommunityAwareBaselineAgent(env: CityLearnEnv, community_surplus_charge_soc_ceiling: float = 0.65, community_import_threshold_kw: float = 1.0, community_storage_discharge_rate: float = 0.75, community_surplus_threshold_kw: float = 0.05, **kwargs: Any)[source]

Bases: RBCCommunityPolicy

Backward-compatible alias for the CityLearn v3 community RBC baseline.

class citylearn.agents.baseline.GridAwareBaselineAgent(env: CityLearnEnv, pv_charge_rate: float = 1.0, storage_discharge_rate: float = 0.65, import_peak_threshold_kw: float = 7.0, price_charge_rate: float = 0.0, ev_service_floor_rate: float = 0.0, ev_service_margin_rate: float = 0.03, ev_urgency_hours: float = 2.0, **kwargs: Any)[source]

Bases: RBCSmartPolicy

Backward-compatible alias for the CityLearn v3 smart RBC baseline.

class citylearn.agents.baseline.NormalNoBatteryPolicy(env: CityLearnEnv, ev_target_soc: float = 1.0, ev_follow_required_soc: bool = False, ev_service_margin_rate: float = 0.02, ev_service_floor_rate: float = 0.0, storage_min_soc: float = 0.2, storage_max_soc: float = 0.9, storage_deadband_kw: float = 0.05, deferrable_start_action: float = 1.0, **kwargs: Any)[source]

Bases: ServiceOnlyBaselineAgent

Day-to-day baseline without stationary battery control.

class citylearn.agents.baseline.NormalPolicy(env: CityLearnEnv, ev_target_soc: float = 1.0, ev_follow_required_soc: bool = False, ev_service_margin_rate: float = 0.02, ev_service_floor_rate: float = 0.0, storage_min_soc: float = 0.2, storage_max_soc: float = 0.9, storage_deadband_kw: float = 0.05, deferrable_start_action: float = 1.0, **kwargs: Any)[source]

Bases: BusinessAsUsualAgent

Day-to-day baseline with full EV charging, earliest schedulable service and PV self-consumption.

class citylearn.agents.baseline.RBCBasicPolicy(env: CityLearnEnv, low_price_quantile: float = 0.35, high_price_quantile: float = 0.75, price_charge_rate: float = 0.6, price_discharge_rate: float = 0.45, ev_price_charge_rate: float = 0.7, ev_service_floor_rate: float = 0.25, ev_service_margin_rate: float = 0.05, **kwargs: Any)[source]

Bases: BusinessAsUsualAgent

Basic rule-based controller with service-aware EV charging and simple price response.

reset()[source]

Reset environment to initial state.

Calls reset_time_step.

Notes

Override in subclass for custom implementation when reseting environment.

class citylearn.agents.baseline.RBCCommunityPolicy(env: CityLearnEnv, community_surplus_charge_soc_ceiling: float = 0.65, community_import_threshold_kw: float = 1.0, community_storage_discharge_rate: float = 0.75, community_surplus_threshold_kw: float = 0.05, **kwargs: Any)[source]

Bases: RBCSmartPolicy

Community-aware rule-based controller that uses REC surplus and import context.

class citylearn.agents.baseline.RBCSmartPolicy(env: CityLearnEnv, pv_charge_rate: float = 1.0, storage_discharge_rate: float = 0.65, import_peak_threshold_kw: float = 7.0, price_charge_rate: float = 0.0, ev_service_floor_rate: float = 0.0, ev_service_margin_rate: float = 0.03, ev_urgency_hours: float = 2.0, **kwargs: Any)[source]

Bases: RBCBasicPolicy

Solar, price and peak-aware rule-based controller with conservative EV service.

class citylearn.agents.baseline.ServiceOnlyBaselineAgent(env: CityLearnEnv, ev_target_soc: float = 1.0, ev_follow_required_soc: bool = False, ev_service_margin_rate: float = 0.02, ev_service_floor_rate: float = 0.0, storage_min_soc: float = 0.2, storage_max_soc: float = 0.9, storage_deadband_kw: float = 0.05, deferrable_start_action: float = 1.0, **kwargs: Any)[source]

Bases: BusinessAsUsualAgent

Serve EV and schedulable loads without using stationary storage.

class citylearn.agents.baseline.ZeroActionBaselineAgent(env: CityLearnEnv, **kwargs: Any)[source]

Bases: Agent

Baseline that requests zero for every action dimension.

predict(observations: List[List[float]], deterministic: bool = None) List[List[float]][source]

Provide actions for current time step.

Return randomly sampled actions from action_space.

Parameters:
  • observations (List[List[float]]) – Environment observations

  • deterministic (bool, default: False) – Wether to return purely exploitatative deterministic actions.

Returns:

actions – Action values

Return type:

List[List[float]]